# AIDebugWindow Struct Reference

Window with everything an AI prints via AILog. More...

Inheritance diagram for AIDebugWindow:

## Public Member Functions
| AIDebugWindow (const WindowDesc *desc, WindowNumber number)
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 | SetStringParameters (int widget) const
| Initialize string parameters for a widget.
virtual void | DrawWidget (const Rect &r, int widget) const
| Draw the contents of a nested widget.
void | ChangeToAI (CompanyID show_ai)
virtual void | OnClick (Point pt, int widget)
| 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 | OnInvalidateData (int data=0)
| Some data on this window has become invalid.
virtual void | OnResize ()
| Called after the window got resized.
## Data Fields
int | redraw_timer
int | last_vscroll_pos
bool | autoscroll
## Static Public Attributes
static const int | top_offset = WD_FRAMERECT_TOP + 2
| Offset of the text at the top of the AID_WIDGET_LOG_PANEL.
static const int | bottom_offset = WD_FRAMERECT_BOTTOM
| Offset of the text at the bottom of the AID_WIDGET_LOG_PANEL.
static CompanyID | ai_debug_company = INVALID_COMPANY

## Detailed Description

Window with everything an AI prints via AILog.

Definition at line 690 of file ai_gui.cpp.

## Member Function Documentation

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

References bottom_offset, FONT_HEIGHT_NORMAL, Dimension::height, top_offset, and WD_PAR_VSEP_NORMAL.

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

References NWidgetCore::colour, COMPANY_FIRST, Window::DisableWidget(), Window::DrawWidgets(), Scrollbar::GetCapacity(), Scrollbar::GetCount(), AIObject::GetLogPointer(), Scrollbar::GetPosition(), INVALID_COMPANY, NWidgetCore::IsDisabled(), Window::IsShaded(), Window::LowerWidget(), max(), MAX_COMPANIES, Window::RaiseWidget(), Scrollbar::SetCount(), Window::SetDirty(), NWidgetCore::SetDisabled(), Scrollbar::SetPosition(), Window::SetWidgetDirty(), Window::SetWidgetDisabledState(), AILog::LogData::used, and Window::vscroll.

virtual void AIDebugWindow::SetStringParameters | ( | int | widget | ) | const`[inline, virtual]`

Initialize string parameters for a widget.

Calls to this function are made during initialization to measure the size (that is as part of InitNested()), during drawing, and while re-initializing the window. Only for widgets that render text initializing is requested.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 820 of file ai_gui.cpp.

References INVALID_COMPANY, SetDParam(), and SetDParamStr().

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

References AILog::LogData::count, DrawString(), AIObject::GetLogPointer(), Scrollbar::GetPosition(), INVALID_COMPANY, Scrollbar::IsVisible(), Rect::left, AILog::LogData::lines, AILog::LOG_ERROR, AILog::LOG_INFO, AILog::LOG_SQ_ERROR, AILog::LOG_SQ_INFO, AILog::LOG_WARNING, AILog::LogData::pos, Window::resize, Rect::right, SA_FORCE, SA_LEFT, ResizeInfo::step_height, Rect::top, top_offset, AILog::LogData::type, AILog::LogData::used, and Window::vscroll.

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

References CMD_COMPANY_CTRL, DoCommandP(), IsInsideMM(), and Window::IsWidgetDisabled().

virtual void AIDebugWindow::OnInvalidateData | ( | int | data = `0` | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 911 of file ai_gui.cpp.

References Window::SetDirty().

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

Called after the window got resized.

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

Reimplemented from Window.

Definition at line 916 of file ai_gui.cpp.

References Scrollbar::SetCapacityFromWidget(), and Window::vscroll.

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

- src/ai/ai_gui.cpp