# AISettingsWindow Struct Reference

Window for settings the parameters of an AI. More...

Inheritance diagram for AISettingsWindow:

## Public Member Functions

| AISettingsWindow (const WindowDesc *desc, CompanyID slot)
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 | OnPaint ()
| The window must be repainted.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
virtual void | OnClick (Point pt, int widget)
| A click with the left mouse button has been made on the window.
virtual void | OnQueryTextFinished (char *str)
| The query window opened from this window has closed.
virtual void | OnResize ()
| Called after the window got resized.
virtual void | OnTick ()
| Called once per (game) tick.

## Data Fields

CompanyID | slot
AIConfig * | ai_config
int | clicked_button
bool | clicked_increase
int | timeout
int | clicked_row
int | line_height

## Detailed Description

Window for settings the parameters of an AI.

Definition at line 243 of file ai_gui.cpp.

## Member Function Documentation

virtual void AISettingsWindow::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 264 of file ai_gui.cpp.

References AIS_WIDGET_BACKGROUND, FONT_HEIGHT_NORMAL, GB(), Dimension::height, MAT_ROW_BITS, MAT_ROW_START, WD_MATRIX_BOTTOM, WD_MATRIX_TOP, and Dimension::width.

virtual void AISettingsWindow::OnPaint | ( |  | ) | `[inline, virtual]`

The window must be repainted.

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

Reimplemented from Window.

Definition at line 275 of file ai_gui.cpp.

References Window::DrawWidgets().

virtual void AISettingsWindow::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 280 of file ai_gui.cpp.

References _dynlang, AICONFIG_BOOLEAN, AIS_WIDGET_BACKGROUND, DrawArrowButtons(), DrawFrameRect(), DrawString(), FR_LOWERED, Scrollbar::IsVisible(), Rect::left, max(), min(), Rect::right, SetDParam(), TD_RTL, DynamicLanguages::text_dir, Rect::top, Window::vscroll, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and WD_MATRIX_TOP.

virtual void AISettingsWindow::OnClick | ( | Point | pt,
|  | int | widget |
| ) |  |  | `[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.

Reimplemented from Window.

Definition at line 319 of file ai_gui.cpp.

References _dynlang, _settings_newgame, AICONFIG_BOOLEAN, AIS_WIDGET_ACCEPT, AIS_WIDGET_BACKGROUND, AIS_WIDGET_RESET, CS_NUMERAL, NWidgetBase::current_x, DifficultySettings::diff_level, GameSettings::difficulty, Scrollbar::GetPosition(), INVALID_STRING_ID, IsInsideMM(), NWidgetBase::pos_x, NWidgetBase::pos_y, Window::SetDirty(), SetDParam(), ShowErrorMessage(), ShowQueryString(), TD_RTL, DynamicLanguages::text_dir, Window::vscroll, Point::x, and Point::y.

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

The query window opened from this window has closed.

Parameters:

  | str | the new value of the string or NULL if the window was cancelled.

Reimplemented from Window.

Definition at line 382 of file ai_gui.cpp.

References Window::SetDirty(), and StrEmpty().

virtual void AISettingsWindow::OnResize | ( |  | ) | `[inline, virtual]`

Called after the window got resized.

For nested windows with a viewport, call NWidgetViewport::UpdateViewportCoordinates.

Reimplemented from Window.

Definition at line 392 of file ai_gui.cpp.

References AIS_WIDGET_BACKGROUND, NWidgetBase::current_y, Scrollbar::GetCapacity(), MAT_COL_START, MAT_ROW_START, Scrollbar::SetCapacity(), Window::vscroll, and NWidgetCore::widget_data.

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

- src/ai/ai_gui.cpp