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 | 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=0, bool gui_scope=true) |
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'. |
Definition at line 1091 of file news_gui.cpp.
virtual void MessageOptionsWindow::DrawWidget | ( | const Rect & | r, | |
int | widget | |||
) | const [inline, virtual] |
Draw the contents of a nested widget.
r | Rectangle occupied by the widget. | |
widget | Number of the widget to draw. |
Reimplemented from Window.
Definition at line 1127 of file news_gui.cpp.
References NewsTypeData::display, DrawString(), MOS_WIDG_PER_SETTING, SA_HOR_CENTER, WID_MO_END_OPTION, and WID_MO_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.
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 1185 of file news_gui.cpp.
References _news_ticker_sound, NewsTypeData::display, Window::InvalidateData(), message_opt, Window::SetDirty(), SetMessageButtonStates(), ShowDropDownMenu(), state, WID_MO_DROP_SUMMARY, WID_MO_END_OPTION, WID_MO_SOUNDTICKER, and WID_MO_START_OPTION.
virtual void MessageOptionsWindow::OnDropdownSelect | ( | int | widget, | |
int | index | |||
) | [inline, virtual] |
A dropdown option associated to this window has been selected.
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 1212 of file news_gui.cpp.
References NewsTypeData::display, Window::InvalidateData(), 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.
Reimplemented from Window.
Definition at line 1136 of file news_gui.cpp.
References dim_message_opt, GetStringBoundingBox(), INVALID_STRING_ID, maxdim(), and message_opt.
virtual void MessageOptionsWindow::OnInvalidateData | ( | int | data = 0 , |
|
bool | gui_scope = true | |||
) | [inline, virtual] |
Some data on this window has become invalid.
data | Information about the changed data. | |
gui_scope | Whether the call is done from GUI scope. You may not do everything when not in GUI scope. See InvalidateWindowData() for details. |
Reimplemented from Window.
Definition at line 1175 of file news_gui.cpp.
References _news_ticker_sound, message_opt, Window::SetWidgetLoweredState(), state, and WID_MO_SOUNDTICKER.
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.
value | to set in the widget | |
element | index of the group of widget to set |
Definition at line 1119 of file news_gui.cpp.
References Window::SetWidgetDisabledState(), and WID_MO_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.
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 1143 of file news_gui.cpp.
References dim_message_opt, FONT_HEIGHT_NORMAL, max(), MOS_WIDG_PER_SETTING, WD_DROPDOWNTEXT_BOTTOM, WD_DROPDOWNTEXT_TOP, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_TOP, WD_IMGBTN_BOTTOM, WD_IMGBTN_TOP, WID_MO_DROP_SUMMARY, WID_MO_END_OPTION, WID_MO_LABEL_SUMMARY, WID_MO_SOUNDTICKER, WID_MO_SOUNDTICKER_LABEL, and WID_MO_START_OPTION.