OpenTTD Source 20260206-master-g4d4e37dbf1
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 ClientButtonLine, and CompanyButtonLine.

◆ DrawButtons()

Rect ButtonLine::DrawButtons ( Rect r) const
inlineprotected

Draw the buttons for this line.

Parameters
rRect to draw within.
Returns
Rect of remaining space.

Definition at line 1441 of file network_gui.cpp.

References _current_text_dir, buttons, Rect::CentreToHeight(), DrawFrameRect(), FILLRECT_CHECKER, GetColourGradient(), GfxFillRect(), Rect::Indent(), SA_CENTER, WidgetDimensions::scaled, Rect::Shrink(), TD_RTL, and Rect::WithWidth().

Referenced by ClientButtonLine::Draw(), and CompanyButtonLine::Draw().

◆ 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, Rect::Contains(), Rect::Indent(), Point, 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(), Point, 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 DrawButtons().


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