Base class for a 'real' widget. More...
#include <widget_type.h>
Public Member Functions | |
NWidgetCore (WidgetType tp, Colours colour, uint fill_x, uint fill_y, uint16 widget_data, StringID tool_tip) | |
Initialization of a 'real' widget. | |
void | SetIndex (int index) |
Set index of the nested widget in the widget array. | |
void | SetDataTip (uint16 widget_data, StringID tool_tip) |
Set data and tool tip of the nested widget. | |
void | SetLowered (bool lowered) |
Lower or raise the widget. | |
bool | IsLowered () const |
Return whether the widget is lowered. | |
void | SetDisabled (bool disabled) |
Disable (grey-out) or enable the widget. | |
bool | IsDisabled () const |
Return whether the widget is disabled. | |
void | FillNestedArray (NWidgetBase **array, uint length) |
NWidgetCore * | GetWidgetFromPos (int x, int y) |
Retrieve a widget by its position. | |
bool | IsHighlighted () const |
Return whether the widget is highlighted. | |
TextColour | GetHighlightColour () const |
Return the colour of the highlight. | |
void | SetHighlighted (TextColour highlight_colour) |
Highlight the widget or not. | |
Data Fields | |
NWidgetDisplay | disp_flags |
Flags that affect display and interaction with the widget. | |
Colours | colour |
Colour of this widget. | |
int | index |
Index of the nested widget in the widget array of the window (-1 means 'not used'). | |
uint16 | widget_data |
Data of the widget. | |
StringID | tool_tip |
Tooltip of the widget. | |
int | scrollbar_index |
Index of an attached scrollbar. | |
TextColour | highlight_colour |
Colour of highlight. |
Base class for a 'real' widget.
Definition at line 282 of file widget_type.h.
NWidgetCore::NWidgetCore | ( | WidgetType | tp, | |
Colours | colour, | |||
uint | fill_x, | |||
uint | fill_y, | |||
uint16 | widget_data, | |||
StringID | tool_tip | |||
) |
Initialization of a 'real' widget.
tp | Type of the widget. | |
colour | Colour of the widget. | |
fill_x | Default horizontal filling. | |
fill_y | Default vertical filling. | |
widget_data | Data component of the widget. |
tool_tip | Tool tip of the widget. |
Definition at line 822 of file widget.cpp.
References index, and scrollbar_index.
TextColour NWidgetCore::GetHighlightColour | ( | ) | const [inline, virtual] |
Return the colour of the highlight.
Reimplemented from NWidgetBase.
Definition at line 326 of file widget_type.h.
References highlight_colour.
NWidgetCore * NWidgetCore::GetWidgetFromPos | ( | int | x, | |
int | y | |||
) | [virtual] |
Retrieve a widget by its position.
x | Horizontal position relative to the left edge of the window. | |
y | Vertical position relative to the top edge of the window. |
NULL
if no widget can be found. Implements NWidgetBase.
Reimplemented in NWidgetBackground.
Definition at line 857 of file widget.cpp.
References NWidgetBase::current_x, NWidgetBase::current_y, IsInsideBS(), NWidgetBase::pos_x, and NWidgetBase::pos_y.
Referenced by NWidgetMatrix::GetWidgetFromPos(), NWidgetPIPContainer::GetWidgetFromPos(), NWidgetStacked::GetWidgetFromPos(), NWidgetToolbarContainer::GetWidgetFromPos(), NWidgetSmallmapDisplay::GetWidgetFromPos(), and NWidgetServerListHeader::GetWidgetFromPos().
bool NWidgetCore::IsDisabled | ( | ) | const [inline] |
Return whether the widget is disabled.
Definition at line 356 of file widget_type.h.
References disp_flags, HasBit(), and NDB_DISABLED.
Referenced by DispatchLeftClickEvent(), NWidgetLeaf::Draw(), NWidgetBackground::Draw(), and SelectCompanyManagerFaceWindow::DrawFaceStringLabel().
bool NWidgetCore::IsHighlighted | ( | ) | const [inline, virtual] |
Return whether the widget is highlighted.
Reimplemented from NWidgetBase.
Definition at line 320 of file widget_type.h.
References disp_flags, HasBit(), and NDB_HIGHLIGHT.
bool NWidgetCore::IsLowered | ( | ) | const [inline] |
Return whether the widget is lowered.
Definition at line 341 of file widget_type.h.
References disp_flags, HasBit(), and NDB_LOWERED.
Referenced by NWidgetLeaf::Draw(), and SelectCompanyManagerFaceWindow::DrawFaceStringLabel().
void NWidgetCore::SetDataTip | ( | uint16 | widget_data, | |
StringID | tool_tip | |||
) |
Set data and tool tip of the nested widget.
widget_data | Data to use. | |
tool_tip | Tool tip string to use. |
Definition at line 846 of file widget.cpp.
Referenced by CargoWidgets(), MakeCompanyButtonRows(), MakeNWidgetCompanyLines(), MakePerformanceDetailPanels(), NWidgetLeaf::NWidgetLeaf(), NWidgetScrollbar::NWidgetScrollbar(), and StationViewWindow::OnClick().
void NWidgetCore::SetDisabled | ( | bool | disabled | ) | [inline] |
Disable (grey-out) or enable the widget.
disabled | Widget must be disabled. |
Definition at line 350 of file widget_type.h.
References CLRBITS, disp_flags, ND_DISABLED, and SETBITS.
void NWidgetCore::SetHighlighted | ( | TextColour | highlight_colour | ) | [inline, virtual] |
Highlight the widget or not.
higlighted | Widget must be highlighted (blink). |
Reimplemented from NWidgetBase.
Definition at line 313 of file widget_type.h.
References CLRBITS, disp_flags, ND_HIGHLIGHT, and SETBITS.
void NWidgetCore::SetIndex | ( | int | index | ) |
Set index of the nested widget in the widget array.
index | Index to use. |
Definition at line 835 of file widget.cpp.
Referenced by NWidgetBackground::NWidgetBackground(), NWidgetLeaf::NWidgetLeaf(), and NWidgetScrollbar::NWidgetScrollbar().
void NWidgetCore::SetLowered | ( | bool | lowered | ) | [inline] |
Lower or raise the widget.
lowered | Widget must be lowered (drawn pressed down). |
Definition at line 335 of file widget_type.h.
References CLRBITS, disp_flags, ND_LOWERED, and SETBITS.
Referenced by NWidgetMatrix::Draw(), and MakeCargoButtons().
Tooltip of the widget.
Definition at line 304 of file widget_type.h.
Referenced by DispatchHoverEvent(), DispatchRightClickEvent(), MakeCargoButtons(), and MakeNWidget().
uint16 NWidgetCore::widget_data |
Data of the widget.
Definition at line 303 of file widget_type.h.
Referenced by NWidgetLeaf::Draw(), NWidgetBackground::Draw(), MakeNWidget(), VehicleDetailsWindow::OnResize(), NewGRFParametersWindow::OnResize(), VehicleGroupWindow::OnResize(), DepotWindow::OnResize(), AISettingsWindow::OnResize(), AIListWindow::OnResize(), NWidgetLeaf::SetupSmallestSize(), and NWidgetBackground::SetupSmallestSize().