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 |
Static Private Attributes | |
static const uint | TEXT_INDENT = 15 |
Number of pixels to indent the text in each column in the SCLW_WIDGET_MATRIX to make room for the (coloured) rectangles. |
Company livery colour scheme window.
Definition at line 571 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 686 of file company_gui.cpp.
References _current_text_dir, Livery::colour1, Livery::colour2, NWidgetBase::current_x, DrawSprite(), DrawString(), FONT_HEIGHT_NORMAL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HasBit(), Livery::in_use, NWidgetBase::pos_x, TD_RTL, TEXT_INDENT, GRFLoadedFeatures::used_liveries, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, 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 735 of file company_gui.cpp.
References _ctrl_pressed, _current_text_dir, CMD_SET_COMPANY_COLOUR, NWidgetBase::current_x, DoCommandP(), FONT_HEIGHT_NORMAL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HasBit(), Window::LowerWidget(), NWidgetBase::pos_x, NWidgetBase::pos_y, Window::RaiseWidget(), Window::ReInit(), Window::SetDirty(), TD_RTL, TEXT_INDENT, ToggleBit(), GRFLoadedFeatures::used_liveries, 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 794 of file company_gui.cpp.
References CMD_SET_COMPANY_COLOUR, DoCommandP(), and HasBit().
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 808 of file company_gui.cpp.
References _local_company, _settings_client, ClrBit(), Window::EnableWidget(), ClientSettings::gui, HasBit(), LIT_ALL, LIT_COMPANY, GUISettings::liveries, OnClick(), Window::ReInit(), Window::SetWidgetsDisabledState(), GRFLoadedFeatures::used_liveries, and WIDGET_LIST_END.
virtual void SelectCompanyLiveryWindow::OnPaint | ( | ) | [inline, virtual] |
The window must be repainted.
Reimplemented from Window.
Definition at line 657 of file company_gui.cpp.
References Window::DrawWidgets(), and Window::SetWidgetDisabledState().
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 666 of file company_gui.cpp.
References Livery::colour1, Livery::colour2, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), HasBit(), SetDParam(), 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 617 of file company_gui.cpp.
References endof, FONT_HEIGHT_NORMAL, GetStringBoundingBox(), GRFLoadedFeatures::has_2CC, HasBit(), MAT_COL_START, MAT_ROW_START, max(), maxdim(), TEXT_INDENT, GRFLoadedFeatures::used_liveries, and WD_FRAMERECT_RIGHT.