# MessageOptionsWindow Struct Reference

Inheritance diagram for MessageOptionsWindow:

## Public Member Functions

| MessageOptionsWindow (const WindowDesc *desc)
void | SetMessageButtonStates (byte value, int element)
| Setup the disabled/enabled buttons in the message window If the value is 'off' disable the [<] widget, and enable the [>] one Same-wise for all the others.
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 | OnInit ()
| Notification that the nested widget tree gets initialized.
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 | OnInvalidateData (int data)
| Some data on this window has become invalid.
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 | OnDropdownSelect (int widget, int index)
| A dropdown option associated to this window has been selected.

## Data Fields

int | state
| Option value for setting all categories at once.
Dimension | dim_message_opt
| Amount of space needed for a label such that all labels will fit.

## Static Public Attributes

static const StringID | message_opt [] = {STR_NEWS_MESSAGES_OFF, STR_NEWS_MESSAGES_SUMMARY, STR_NEWS_MESSAGES_FULL, INVALID_STRING_ID}
| Message report options, 'off', 'summary', or 'full'.

## Detailed Description

Definition at line 1071 of file news_gui.cpp.

## Member Function Documentation

virtual void MessageOptionsWindow::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 1112 of file news_gui.cpp.

References NewsTypeData::display, DrawString(), MOS_WIDG_PER_SETTING, SA_CENTER, WIDGET_NEWSOPT_END_OPTION, and WIDGET_NEWSOPT_START_OPTION.

virtual void MessageOptionsWindow::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 1164 of file news_gui.cpp.

References _news_ticker_sound, NewsTypeData::display, Window::InvalidateData(), message_opt, MOS_WIDG_PER_SETTING, Window::SetDirty(), SetMessageButtonStates(), ShowDropDownMenu(), state, WIDGET_NEWSOPT_DROP_SUMMARY, WIDGET_NEWSOPT_END_OPTION, WIDGET_NEWSOPT_SOUNDTICKER, and WIDGET_NEWSOPT_START_OPTION.

virtual void MessageOptionsWindow::OnDropdownSelect | ( | int | widget,
|  | int | index |
| ) |  |  | `[inline, virtual]`

A dropdown option associated to this window has been selected.

Parameters:

  | widget | the widget (button) that the dropdown is associated with.
  | index | the element in the dropdown that is selected.

Reimplemented from Window.

Definition at line 1191 of file news_gui.cpp.

References NewsTypeData::display, Window::InvalidateData(), NT_END, SetMessageButtonStates(), and state.

virtual void MessageOptionsWindow::OnInit | ( |  | ) | `[inline, virtual]`

Notification that the nested widget tree gets initialized.

The event can be used to perform general computations.

Note:
  nested_root and/or nested_array (normally accessed via GetWidget()) may not exist during this call.

Reimplemented from Window.

Definition at line 1121 of file news_gui.cpp.

References dim_message_opt, GetStringBoundingBox(), INVALID_STRING_ID, maxdim(), and message_opt.

virtual void MessageOptionsWindow::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 1155 of file news_gui.cpp.

References _news_ticker_sound, message_opt, Window::SetWidgetLoweredState(), state, WIDGET_NEWSOPT_DROP_SUMMARY, and WIDGET_NEWSOPT_SOUNDTICKER.

virtual void MessageOptionsWindow::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 1107 of file news_gui.cpp.

References Window::DrawWidgets().

void MessageOptionsWindow::SetMessageButtonStates | ( | byte | value,
|  | int | element |
| ) |  |  | `[inline]`

Setup the disabled/enabled buttons in the message window If the value is 'off' disable the [<] widget, and enable the [>] one Same-wise for all the others.

Starting value of 4 is the first widget group. These are grouped as [<][>] .. [<][>], etc.

Parameters:

  | value | to set in the widget
  | element | index of the group of widget to set

Definition at line 1099 of file news_gui.cpp.

References MOS_WIDG_PER_SETTING, Window::SetWidgetDisabledState(), and WIDGET_NEWSOPT_START_OPTION.

Referenced by OnClick(), and OnDropdownSelect().

virtual void MessageOptionsWindow::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 1128 of file news_gui.cpp.

References dim_message_opt, FONT_HEIGHT_NORMAL, max(), MOS_BUTTON_SPACE, MOS_WIDG_PER_SETTING, WD_DROPDOWNTEXT_BOTTOM, WD_DROPDOWNTEXT_TOP, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_IMGBTN_BOTTOM, WD_IMGBTN_TOP, WIDGET_NEWSOPT_DROP_SUMMARY, WIDGET_NEWSOPT_END_OPTION, WIDGET_NEWSOPT_LABEL_SUMMARY, WIDGET_NEWSOPT_SOUNDTICKER, WIDGET_NEWSOPT_SOUNDTICKER_LABEL, and WIDGET_NEWSOPT_START_OPTION.

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

- src/news_gui.cpp