SelectCompanyLiveryWindow Struct Reference

Company livery colour scheme window. More...

Inheritance diagram for SelectCompanyLiveryWindow:

Window ZeroedMemoryAllocator

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


Member Function Documentation

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

References endof, FONT_HEIGHT_NORMAL, GetStringBoundingBox(), Dimension::height, MAT_COL_START, MAT_ROW_START, max(), maxdim(), TEXT_INDENT, WD_FRAMERECT_RIGHT, and Dimension::width.

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

References HasBit(), SetDParam(), and Window::window_number.

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

References _dynlang, NWidgetBase::current_x, DrawSprite(), DrawString(), FONT_HEIGHT_NORMAL, HasBit(), NWidgetBase::pos_x, TD_RTL, DynamicLanguages::text_dir, TEXT_INDENT, Rect::top, WD_FRAMERECT_LEFT, WD_FRAMERECT_RIGHT, and Window::window_number.

virtual void SelectCompanyLiveryWindow::OnClick ( Point  pt,
int  widget 
) [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.

Reimplemented from Window.

Definition at line 730 of file company_gui.cpp.

References _ctrl_pressed, _dynlang, CMD_SET_COMPANY_COLOUR, NWidgetBase::current_x, DoCommandP(), FONT_HEIGHT_NORMAL, Window::LowerWidget(), NWidgetBase::pos_x, NWidgetBase::pos_y, Window::RaiseWidget(), Window::ReInit(), Window::SetDirty(), TD_RTL, DynamicLanguages::text_dir, TEXT_INDENT, ToggleBit(), Window::window_number, Point::x, and Point::y.

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

References Window::ReInit().


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

Generated on Tue Jan 5 21:03:27 2010 for OpenTTD by  doxygen 1.5.6