Company livery colour scheme window. More...
Public Member Functions | |
SelectCompanyLiveryWindow (const WindowDesc *desc, CompanyID company) | |
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. | |
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. | |
virtual void | OnInvalidateData (int data=0, bool gui_scope=true) |
Some data on this window has become invalid. | |
Private Member Functions | |
void | ShowColourDropDownMenu (uint32 widget) |
Private Attributes | |
uint32 | sel |
LiveryClass | livery_class |
Dimension | square |
Dimension | box |
uint | line_height |
Company livery colour scheme window.
Definition at line 546 of file company_gui.cpp.
virtual void SelectCompanyLiveryWindow::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 669 of file company_gui.cpp.
References _current_text_dir, _loaded_newgrf_features, Livery::colour1, Livery::colour2, NWidgetBase::current_x, DrawSprite(), DrawString(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HasBit(), Livery::in_use, NWidgetBase::pos_x, GRFLoadedFeatures::used_liveries, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, WID_SCL_MATRIX, and Window::window_number.
virtual void SelectCompanyLiveryWindow::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 722 of file company_gui.cpp.
References _ctrl_pressed, _current_text_dir, _loaded_newgrf_features, CMD_SET_COMPANY_COLOUR, NWidgetBase::current_x, DoCommandP(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HasBit(), Window::LowerWidget(), NWidgetBase::pos_x, NWidgetBase::pos_y, Window::RaiseWidget(), Window::ReInit(), Window::SetDirty(), TD_RTL, ToggleBit(), GRFLoadedFeatures::used_liveries, WID_SCL_CLASS_AIRCRAFT, WID_SCL_CLASS_GENERAL, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_MATRIX, WID_SCL_PRI_COL_DROPDOWN, WID_SCL_SEC_COL_DROPDOWN, and Window::window_number.
Referenced by OnInvalidateData().
virtual void SelectCompanyLiveryWindow::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 781 of file company_gui.cpp.
References CMD_SET_COMPANY_COLOUR, DoCommandP(), HasBit(), and WID_SCL_PRI_COL_DROPDOWN.
virtual void SelectCompanyLiveryWindow::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 795 of file company_gui.cpp.
References _loaded_newgrf_features, _local_company, _settings_client, ClrBit(), Window::EnableWidget(), ClientSettings::gui, HasBit(), LIT_ALL, LIT_COMPANY, GUISettings::liveries, OnClick(), Window::ReInit(), Window::SetWidgetsDisabledState(), GRFLoadedFeatures::used_liveries, WID_SCL_CLASS_AIRCRAFT, WID_SCL_CLASS_GENERAL, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, and WIDGET_LIST_END.
virtual void SelectCompanyLiveryWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 640 of file company_gui.cpp.
References Window::DrawWidgets(), Window::SetWidgetDisabledState(), WID_SCL_PRI_COL_DROPDOWN, and WID_SCL_SEC_COL_DROPDOWN.
virtual void SelectCompanyLiveryWindow::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.
widget | Widget number. |
Reimplemented from Window.
Definition at line 649 of file company_gui.cpp.
References Livery::colour1, Livery::colour2, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HasBit(), SetDParam(), WID_SCL_PRI_COL_DROPDOWN, WID_SCL_SEC_COL_DROPDOWN, and Window::window_number.
virtual void SelectCompanyLiveryWindow::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 599 of file company_gui.cpp.
References _loaded_newgrf_features, endof, GetStringBoundingBox(), GRFLoadedFeatures::has_2CC, HasBit(), MAT_ROW_START, max(), maxdim(), GRFLoadedFeatures::used_liveries, WD_FRAMERECT_RIGHT, WID_SCL_MATRIX, WID_SCL_PRI_COL_DROPDOWN, WID_SCL_SEC_COL_DROPDOWN, and WID_SCL_SPACER_DROPDOWN.