# CheatWindow Struct Reference

GUI for the cheats. More...

Inheritance diagram for CheatWindow:

## Public Member Functions
| CheatWindow (const WindowDesc *desc)
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | UpdateWidgetSize (int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
| Update size and resize step of a widget in the window.
virtual void | OnClick (Point pt, int widget, int click_count)
| A click with the left mouse button has been made on the window.
virtual void | OnTimeout ()
| Called when this window's timeout has been reached.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
## Data Fields
int | clicked
int | header_height

## Detailed Description

GUI for the cheats.

Definition at line 197 of file cheat_gui.cpp.

## Member Function Documentation

virtual void CheatWindow::DrawWidget | ( | const Rect & | r,
|  | int | widget |
| ) |  |  | const`[inline, virtual]`

Draw the contents of a nested widget.

Parameters:

  | r | Rectangle occupied by the widget.
  | widget | Number of the widget to draw.

Note:
  This method may not change any state, it may only use drawing functions.

Reimplemented from Window.

Definition at line 206 of file cheat_gui.cpp.

References _current_text_dir, _date, _local_company, CheatEntry::been_used, DrawArrowButtons(), DrawCompanyIcon(), DrawFrameRect(), DrawSprite(), DrawString(), DrawStringMultiLine(), FONT_HEIGHT_NORMAL, FR_LOWERED, GetStringBoundingBox(), lastof, lengthof, ReadValue(), SA_CENTER, SetDParam(), CheatEntry::str, TD_RTL, CheatEntry::type, CheatEntry::variable, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, and WD_PAR_VSEP_NORMAL.

virtual void CheatWindow::OnClick | ( | Point | pt,
|  | int | widget,
|  | int | click_count |
| ) |  |  | `[inline, virtual]`

A click with the left mouse button has been made on the window.

Parameters:

  | pt | the point inside the window that has been clicked.
  | widget | the clicked widget.
  | click_count | Number of fast consecutive clicks at same position

Reimplemented from Window.

Definition at line 320 of file cheat_gui.cpp.

References _current_text_dir, CheatEntry::been_used, CHT_CHANGE_DATE, CHT_MONEY, CS_NUMERAL, NWidgetBase::current_x, Window::flags4, FONT_HEIGHT_NORMAL, IsInsideMM(), lengthof, NWidgetBase::pos_x, NWidgetBase::pos_y, CheatEntry::proc, QSF_ACCEPT_UNCHANGED, ReadValue(), Window::SetDirty(), SetDParam(), ShowQueryString(), TD_RTL, CheatEntry::type, CheatEntry::variable, WD_FRAMERECT_TOP, WD_PAR_VSEP_NORMAL, WF_TIMEOUT_BEGIN, and WriteValue().

virtual void CheatWindow::OnQueryTextFinished | ( | char * | str | ) | `[inline, virtual]`

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string, NULL if the window was cancelled or an empty string when the default button was pressed, i.e. StrEmpty(str).

Reimplemented from Window.

Definition at line 374 of file cheat_gui.cpp.

References CheatEntry::been_used, CHT_CHANGE_DATE, CheatEntry::proc, ReadValue(), Window::SetDirty(), StrEmpty(), CheatEntry::type, CheatEntry::variable, and WriteValue().

virtual void CheatWindow::UpdateWidgetSize | ( | int | widget,
|  | Dimension * | size,
|  | const Dimension & | padding,
|  | Dimension * | fill,
|  | Dimension * | resize |
| ) |  |  | `[inline, virtual]`

Update size and resize step of a widget in the window.

After retrieval of the minimal size and the resize-steps of a widget, this function is called to allow further refinement, typically by computing the real maximal size of the content. Afterwards, size is taken to be the minimal size of the widget and resize is taken to contain the resize steps. For the convenience of the callee, padding contains the amount of padding between the content and the edge of the widget. This should be added to the returned size.

Parameters:

  | widget | Widget number.
  | size | Size of the widget.
  | padding | Recommended amount of space between the widget content and the widget edge.
  | fill | Fill step of the widget.
  | resize | Resize step of the widget.

Reimplemented from Window.

Definition at line 269 of file cheat_gui.cpp.

References ConvertYMDToDate(), FONT_HEIGHT_NORMAL, GetStringBoundingBox(), GetStringHeight(), lengthof, max(), MAX_YEAR, SetDParam(), CheatEntry::str, CheatEntry::type, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WD_FRAMERECT_TOP, WD_PAR_VSEP_NORMAL, WD_PAR_VSEP_WIDE, and Window::width.

The documentation for this struct was generated from the following file:

- src/cheat_gui.cpp