# ErrmsgWindow Struct Reference

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

Inheritance diagram for ErrmsgWindow:

## Public Member Functions

| ErrmsgWindow (Point pt, 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 | OnInvalidateData (int data)
| Some data on this window has become invalid.
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.
CompanyID | face
| Company belonging to the face being shown. INVALID_COMPANY if no face present.

## 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::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 625 of file misc_gui.cpp.

References CopyInDParam(), decode_params, detailed_msg, DrawCompanyManagerFace(), DrawStringMultiLine(), face, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), height_detailed, height_summary, INVALID_STRING_ID, lengthof, SA_CENTER, Window::top, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_FRAMETEXT_LEFT, WD_FRAMETEXT_RIGHT, and WD_PAR_VSEP_WIDE.

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 578 of file misc_gui.cpp.

References Clamp(), face, FindWindowById(), GetMainViewBottom(), GetMainViewTop(), INVALID_COMPANY, ViewPort::left, position, RemapCoords2(), ViewPort::top, UnScaleByZoom(), Window::viewport, ViewPort::virtual_left, and ViewPort::virtual_top.

virtual void ErrmsgWindow::OnInvalidateData | ( | int | data | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 614 of file misc_gui.cpp.

References face, INVALID_COMPANY, and Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID().

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 684 of file misc_gui.cpp.

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

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 609 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 620 of file misc_gui.cpp.

References CopyInDParam(), decode_params, and lengthof.

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 555 of file misc_gui.cpp.

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

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

- src/misc_gui.cpp