# ErrmsgWindow Struct Reference

Window class for displaying an error message window. More...

Inheritance diagram for ErrmsgWindow:

## Public Member Functions
| ErrmsgWindow (Point pt, const WindowDesc *desc, StringID summary_msg, StringID detailed_msg, bool no_timeout)
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 Point | OnInitialPosition (const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number)
| Compute the initial position of 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.
virtual void | OnMouseLoop ()
| Called for every mouse loop run, which is at least once per (game) tick.
virtual void | OnHundredthTick ()
| Called once every 100 (game) ticks.
virtual EventState | OnKeyPress (uint16 key, uint16 keycode)
| A key has been pressed.
## Private Attributes
uint | duration
| Length of display of the message. 0 means forever,.
uint64 | decode_params [20]
| Parameters of the message strings.
StringID | summary_msg
| General error message showed in first line. Must be valid.
StringID | detailed_msg
| Detailed error message showed in second line. Can be INVALID_STRING_ID.
uint | height_summary
| Height of the summary_msg string in pixels in the EMW_MESSAGE widget.
uint | height_detailed
| Height of the detailed_msg string in pixels in the EMW_MESSAGE widget.
Point | position
| Position of the error message window.

## Detailed Description

Window class for displaying an error message window.

Definition at line 526 of file misc_gui.cpp.

## Member Function Documentation

virtual void ErrmsgWindow::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 550 of file misc_gui.cpp.

References CopyInDParam(), decode_params, detailed_msg, GetStringHeight(), Dimension::height, height_detailed, height_summary, INVALID_STRING_ID, lengthof, max(), summary_msg, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_FRAMETEXT_LEFT, WD_PAR_VSEP_WIDE, and Dimension::width.

virtual Point ErrmsgWindow::OnInitialPosition | ( | const WindowDesc * | desc,
|  | int16 | sm_width,
|  | int16 | sm_height,
|  | int | window_number |
| ) |  |  | `[inline, virtual]`

Compute the initial position of the window.

Parameters:

  | *desc | The pointer to the WindowDesc of the window to create.
  | sm_width | Smallest width of the window.
  | sm_height | Smallest height of the window.
  | window_number | The window number of the new window.

Returns:
  Initial position of the top-left corner of the window.

Reimplemented from Window.

Definition at line 573 of file misc_gui.cpp.

References Clamp(), decode_params, detailed_msg, FindWindowById(), GetDParamX(), GetMainViewBottom(), GetMainViewTop(), DrawPixelInfo::height, ViewPort::left, MAX_COMPANIES, position, ViewPort::top, UnScaleByZoom(), Window::viewport, ViewPort::virtual_left, ViewPort::virtual_top, DrawPixelInfo::width, Point::x, Point::y, and ViewPort::zoom.

virtual void ErrmsgWindow::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 604 of file misc_gui.cpp.

References Window::DrawWidgets().

virtual void ErrmsgWindow::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 609 of file misc_gui.cpp.

References CopyInDParam(), decode_params, and lengthof.

virtual void ErrmsgWindow::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 614 of file misc_gui.cpp.

References Rect::bottom, CopyInDParam(), decode_params, detailed_msg, DrawCompanyManagerFace(), DrawStringMultiLine(), GetDParamX(), height_detailed, height_summary, INVALID_STRING_ID, Rect::left, lengthof, Rect::right, SA_CENTER, Window::top, Rect::top, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_FRAMETEXT_LEFT, and WD_PAR_VSEP_WIDE.

virtual EventState ErrmsgWindow::OnKeyPress | ( | uint16 | key,
|  | uint16 | keycode |
| ) |  |  | `[inline, virtual]`

A key has been pressed.

Parameters:

  | key | the Unicode value of the key.
  | keycode | the untranslated key code including shift state.

Returns:
  ES_HANDLED if the key press has been handled and no other window should receive the event.

Reimplemented from Window.

Definition at line 673 of file misc_gui.cpp.

References Window::ES_HANDLED, and Window::ES_NOT_HANDLED.

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

- src/misc_gui.cpp