# SelectCompanyLiveryWindow Struct Reference

Company livery colour scheme window. More...

Inheritance diagram for SelectCompanyLiveryWindow:

## 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)
| 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.

## Detailed Description

Company livery colour scheme window.

Definition at line 568 of file company_gui.cpp.

## Member Function Documentation

virtual void SelectCompanyLiveryWindow::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 683 of file company_gui.cpp.

References _dynlang, 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, DynamicLanguages::text_dir, TEXT_INDENT, 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.

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 732 of file company_gui.cpp.

References _ctrl_pressed, _dynlang, CMD_SET_COMPANY_COLOUR, NWidgetBase::current_x, DoCommandP(), FONT_HEIGHT_NORMAL, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Window::LowerWidget(), NWidgetBase::pos_x, NWidgetBase::pos_y, Window::RaiseWidget(), Window::ReInit(), Window::SetDirty(), TD_RTL, DynamicLanguages::text_dir, TEXT_INDENT, ToggleBit(), and Window::window_number.

virtual void SelectCompanyLiveryWindow::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 791 of file company_gui.cpp.

References CMD_SET_COMPANY_COLOUR, DoCommandP(), and HasBit().

virtual void SelectCompanyLiveryWindow::OnInvalidateData | ( | int | data = `0` | ) | `[inline, virtual]`

Some data on this window has become invalid.

Parameters:

  | data | information about the changed data.

Reimplemented from Window.

Definition at line 800 of file company_gui.cpp.

References Window::ReInit().

virtual void SelectCompanyLiveryWindow::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 654 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.

Parameters:

  | widget | Widget number.

Reimplemented from Window.

Definition at line 663 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.

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 613 of file company_gui.cpp.

References endof, FONT_HEIGHT_NORMAL, GetStringBoundingBox(), GRFLoadedFeatures::has_2CC, MAT_COL_START, MAT_ROW_START, max(), maxdim(), TEXT_INDENT, and WD_FRAMERECT_RIGHT.

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

- src/company_gui.cpp