OpenTTD Source 20261112-master-gbcbec5e63f
ChainRow Class Reference

A single row of ChainField. More...

Public Member Functions

int Height () const
 Get the height of this row of fields.
void Draw (Rect r) const
 Draw this row of fields.
ChainField::ClickedAtResult ClickedAt (Rect r, Point pt) const
 Get the ClickedAt result for a field in this row.
void ConnectProducedCargo (int column)
 Connect produced cargoes to the connection column after it.
void MakeCargoLabel (int column, bool accepting)
 Construct a Cargo chain field.
void ConnectAcceptedCargo (int column)
 Connect accepted cargoes to the connection column before it.

Static Public Member Functions

static bool IsValidColumn (int column)
 Test if a given column index is valid.

Data Fields

std::array< std::unique_ptr< ChainField >, MAX_COLUMNS > columns {}
 One row of fields.

Static Public Attributes

static const int MAX_COLUMNS = 5
 Maximum number of columns in a row.

Detailed Description

A single row of ChainField.

Definition at line 2484 of file industry_gui.cpp.

Member Function Documentation

◆ ClickedAt()

ChainField::ClickedAtResult ChainRow::ClickedAt ( Rect r,
Point pt ) const
inline

Get the ClickedAt result for a field in this row.

Parameters
rThe rect of the row.
ptThe click position.
Returns
ChainField::ClickedAtResult

Definition at line 2533 of file industry_gui.cpp.

References _current_text_dir, ChainField::connection_field_width, Rect::Indent(), ChainField::industry_width, IsValidColumn(), MAX_COLUMNS, Point, TD_RTL, and Rect::WithWidth().

◆ ConnectAcceptedCargo()

void ChainRow::ConnectAcceptedCargo ( int column)
inline

◆ ConnectProducedCargo()

void ChainRow::ConnectProducedCargo ( int column)
inline

◆ Draw()

void ChainRow::Draw ( Rect r) const
inline

Draw this row of fields.

Parameters
rRect to draw within.

Definition at line 2517 of file industry_gui.cpp.

References _current_text_dir, ChainField::connection_field_width, Rect::Indent(), ChainField::industry_width, MAX_COLUMNS, TD_RTL, and Rect::WithWidth().

◆ Height()

int ChainRow::Height ( ) const
inline

Get the height of this row of fields.

Returns
The height of this row.

Definition at line 2503 of file industry_gui.cpp.

◆ IsValidColumn()

bool ChainRow::IsValidColumn ( int column)
inlinestatic

Test if a given column index is valid.

Parameters
columnThe column index.
Returns
true iff the column index is valid.

Definition at line 2494 of file industry_gui.cpp.

References columns.

Referenced by ClickedAt(), ConnectAcceptedCargo(), ConnectProducedCargo(), and MakeCargoLabel().

◆ MakeCargoLabel()

void ChainRow::MakeCargoLabel ( int column,
bool accepting )
inline

Construct a Cargo chain field.

Parameters
columnColumn for the new field.
acceptingDisplay accepted cargo (if false, display produced cargo).

Definition at line 2589 of file industry_gui.cpp.

References ConnectionChainField::ConnectCargo(), End, INVALID_CARGO, IsValidColumn(), ConnectionChainField::num_cargoes, Start, and ConnectionChainField::vertical_cargoes.

Field Documentation

◆ columns

std::array<std::unique_ptr<ChainField>, MAX_COLUMNS> ChainRow::columns {}

◆ MAX_COLUMNS

const int ChainRow::MAX_COLUMNS = 5
static

Maximum number of columns in a row.

Definition at line 2486 of file industry_gui.cpp.

Referenced by ClickedAt(), and Draw().


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