OpenTTD Source 20251005-master-ga617d009cc
ButtonLine Class Referenceabstract

Base interface for a network client list line. More...

Inheritance diagram for ButtonLine:
ClientButtonLine CompanyButtonLine

Public Member Functions

virtual void Draw (Rect r) const =0
 Draw the button line.
 
template<typename T , typename... TArgs>
T & AddButton (TArgs &&... args)
 
ButtonCommonGetButton (Rect r, const Point &pt) const
 Get the button at a given point on the line.
 
virtual std::optional< EncodedStringGetTooltip (Rect r, const Point &pt) const
 Get tooptip for a given point on the line.
 

Data Fields

std::vector< std::unique_ptr< ButtonCommon > > buttons {}
 Buttons for this line.
 

Protected Member Functions

Rect DrawButtons (Rect r) const
 Draw the buttons for this line.
 

Detailed Description

Base interface for a network client list line.

Definition at line 1387 of file network_gui.cpp.

Member Function Documentation

◆ AddButton()

template<typename T , typename... TArgs>
T & ButtonLine::AddButton ( TArgs &&...  args)
inline

Definition at line 1400 of file network_gui.cpp.

◆ Draw()

virtual void ButtonLine::Draw ( Rect  r) const
pure virtual

Draw the button line.

Parameters
rRect to draw within.

Implemented in CompanyButtonLine, and ClientButtonLine.

References buttons.

◆ DrawButtons()

Rect ButtonLine::DrawButtons ( Rect  r) const
inlineprotected

◆ GetButton()

ButtonCommon * ButtonLine::GetButton ( Rect  r,
const Point pt 
) const
inline

Get the button at a given point on the line.

Parameters
rRect of line.
ptPoint of interest.
Returns
Button at point, or nullptr if button isn't pressed.

Definition at line 1412 of file network_gui.cpp.

References _current_text_dir, buttons, Rect::Contains(), WidgetDimensions::hsep_normal, Rect::Indent(), WidgetDimensions::scaled, TD_RTL, and Rect::WithWidth().

Referenced by GetTooltip().

◆ GetTooltip()

virtual std::optional< EncodedString > ButtonLine::GetTooltip ( Rect  r,
const Point pt 
) const
inlinevirtual

Get tooptip for a given point on the line.

Parameters
rRect of line.
ptPoint of interest.
Returns
EncodedString of tooltip, or std::nullopt if none.

Reimplemented in ClientButtonLine.

Definition at line 1428 of file network_gui.cpp.

References GetButton(), GetEncodedString(), and ButtonCommon::tooltip.

Referenced by ClientButtonLine::GetTooltip().

Field Documentation

◆ buttons

std::vector<std::unique_ptr<ButtonCommon> > ButtonLine::buttons {}

Buttons for this line.

Definition at line 1389 of file network_gui.cpp.

Referenced by Draw(), DrawButtons(), and GetButton().


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