OpenTTD Source 20260421-master-gc2fbc6fdeb
ButtonCommon Class Referenceabstract

Button shown for either a company or client in the client-list. More...

Inheritance diagram for ButtonCommon:
Button< CompanyID > Button< ClientID > Button< T >

Public Member Functions

 ButtonCommon (SpriteID sprite, StringID tooltip, Colours colour, bool disabled=false)
 Create the button.
virtual ~ButtonCommon ()=default
 Ensure the destructor of the sub classes are called as well.
virtual void OnClick (struct NetworkClientListWindow *w, Point pt)=0
 OnClick handler for when the button is pressed.

Data Fields

SpriteID sprite
 The sprite to use on the button.
StringID tooltip
 The tooltip of the button.
Colours colour
 The colour of the button.
bool disabled
 Is the button disabled?
uint height
 Calculated height of the button.
uint width
 Calculated width of the button.

Detailed Description

Button shown for either a company or client in the client-list.

These buttons are dynamic and strongly depends on which company/client what buttons are available. This class allows dynamically creating them as the current Widget system does not.

Definition at line 1352 of file network_gui.cpp.

Constructor & Destructor Documentation

◆ ButtonCommon()

ButtonCommon::ButtonCommon ( SpriteID sprite,
StringID tooltip,
Colours colour,
bool disabled = false )
inline

Create the button.

Parameters
spriteThe sprite to draw on the button.
tooltipThe tooltip of the button.
colourThe colour of the button.
disabledWhether the button is disabled or not.

Definition at line 1368 of file network_gui.cpp.

References colour, disabled, GetScaledSpriteSize(), WidgetDimensions::scaled, sprite, and tooltip.

Referenced by Button< CompanyID >::Button().

Member Function Documentation

◆ OnClick()

virtual void ButtonCommon::OnClick ( struct NetworkClientListWindow * w,
Point pt )
pure virtual

OnClick handler for when the button is pressed.

Parameters
wThe window the click was in.
ptThe location the click was at.

Implemented in Button< T >, Button< ClientID >, and Button< CompanyID >.

References Point.

Referenced by NetworkClientListWindow::OnClick().

Field Documentation

◆ colour

Colours ButtonCommon::colour

The colour of the button.

Definition at line 1356 of file network_gui.cpp.

Referenced by Button< CompanyID >::Button(), and ButtonCommon().

◆ disabled

bool ButtonCommon::disabled

◆ height

uint ButtonCommon::height

Calculated height of the button.

Definition at line 1358 of file network_gui.cpp.

◆ sprite

SpriteID ButtonCommon::sprite

The sprite to use on the button.

Definition at line 1354 of file network_gui.cpp.

Referenced by Button< CompanyID >::Button(), and ButtonCommon().

◆ tooltip

StringID ButtonCommon::tooltip

The tooltip of the button.

Definition at line 1355 of file network_gui.cpp.

Referenced by Button< CompanyID >::Button(), ButtonCommon(), and ButtonLine::GetTooltip().

◆ width

uint ButtonCommon::width

Calculated width of the button.

Definition at line 1359 of file network_gui.cpp.


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