The Battle for Wesnoth  1.19.5+dev
Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
gui2::grid::child Class Reference

Child item of the grid. More...

Public Member Functions

 child ()
 
 child (child &&) noexcept=default
 Move constructor. More...
 
point get_best_size () const
 Returns the best size for the cell. More...
 
void place (point origin, point size)
 Places the widget in the cell. More...
 
void layout_initialize (const bool full_initialization)
 Forwards grid::layout_initialize to the cell. More...
 
bool can_wrap () const
 Returns the can_wrap for the cell. More...
 
const std::string & id () const
 Returns the id of the widget/. More...
 
unsigned get_flags () const
 
void set_flags (const unsigned flags)
 
unsigned get_border_size () const
 
void set_border_size (const unsigned border_size)
 
const widgetget_widget () const
 
widgetget_widget ()
 
void set_widget (std::unique_ptr< widget > widget)
 Acquires an owning reference to the given widget. More...
 
std::unique_ptr< widgetfree_widget ()
 Releases widget from ownership by this child and returns it in the form of a new shared_ptr. More...
 

Private Member Functions

point border_space () const
 Returns the space needed for the border. More...
 

Private Attributes

unsigned flags_
 The flags for the border and cell setup. More...
 
unsigned border_size_
 The size of the border, the actual configuration of the border is determined by the flags. More...
 
std::unique_ptr< widgetwidget_
 Pointer to the widget. More...
 

Friends

struct grid_implementation
 

Detailed Description

Child item of the grid.

Definition at line 324 of file grid.hpp.

Constructor & Destructor Documentation

◆ child() [1/2]

gui2::grid::child::child ( )
inline

Definition at line 331 of file grid.hpp.

◆ child() [2/2]

gui2::grid::child::child ( child &&  )
defaultnoexcept

Move constructor.

This is necessary in order that the child objects be moved instead of copied when the grid's child vector is resized. std::vector will utilize a move constructor as long as a non-throwing one is provided.

Member Function Documentation

◆ border_space()

point gui2::grid::child::border_space ( ) const
private

Returns the space needed for the border.

Definition at line 897 of file grid.cpp.

References gui2::grid::BORDER_BOTTOM, gui2::grid::BORDER_LEFT, gui2::grid::BORDER_RIGHT, and gui2::grid::BORDER_TOP.

Referenced by get_best_size().

◆ can_wrap()

bool gui2::grid::child::can_wrap ( ) const
inline

Returns the can_wrap for the cell.

Definition at line 359 of file grid.hpp.

References widget_.

Referenced by gui2::grid::can_wrap().

◆ free_widget()

std::unique_ptr<widget> gui2::grid::child::free_widget ( )
inline

Releases widget from ownership by this child and returns it in the form of a new shared_ptr.

widget_ will be null after this is called.

Definition at line 407 of file grid.hpp.

References widget_.

Referenced by gui2::grid::swap_child().

◆ get_best_size()

point gui2::grid::child::get_best_size ( ) const

◆ get_border_size()

unsigned gui2::grid::child::get_border_size ( ) const
inline

Definition at line 377 of file grid.hpp.

References border_size_.

◆ get_flags()

unsigned gui2::grid::child::get_flags ( ) const
inline

Definition at line 367 of file grid.hpp.

References flags_.

Referenced by gui2::grid::set_child_alignment().

◆ get_widget() [1/2]

widget* gui2::grid::child::get_widget ( )
inline

Definition at line 392 of file grid.hpp.

References widget_.

◆ get_widget() [2/2]

const widget* gui2::grid::child::get_widget ( ) const
inline

◆ id()

const std::string & gui2::grid::child::id ( ) const

Returns the id of the widget/.

Definition at line 891 of file grid.cpp.

Referenced by gui2::grid::remove_child(), gui2::grid::set_child(), and gui2::grid::swap_child().

◆ layout_initialize()

void gui2::grid::child::layout_initialize ( const bool  full_initialization)

Forwards grid::layout_initialize to the cell.

Definition at line 882 of file grid.cpp.

References gui2::widget::invisible.

Referenced by gui2::grid::layout_initialize().

◆ place()

void gui2::grid::child::place ( point  origin,
point  size 
)

◆ set_border_size()

void gui2::grid::child::set_border_size ( const unsigned  border_size)
inline

Definition at line 382 of file grid.hpp.

References border_size_.

Referenced by gui2::grid::set_child().

◆ set_flags()

void gui2::grid::child::set_flags ( const unsigned  flags)
inline

Definition at line 372 of file grid.hpp.

References flags_.

Referenced by gui2::grid::set_child(), and gui2::grid::set_child_alignment().

◆ set_widget()

void gui2::grid::child::set_widget ( std::unique_ptr< widget widget)
inline

Acquires an owning reference to the given widget.

Definition at line 398 of file grid.hpp.

References widget_.

Referenced by gui2::grid::remove_child(), gui2::grid::set_child(), and gui2::grid::swap_child().

Friends And Related Function Documentation

◆ grid_implementation

friend struct grid_implementation
friend

Definition at line 326 of file grid.hpp.

Member Data Documentation

◆ border_size_

unsigned gui2::grid::child::border_size_
private

The size of the border, the actual configuration of the border is determined by the flags.

Definition at line 420 of file grid.hpp.

Referenced by get_border_size(), and set_border_size().

◆ flags_

unsigned gui2::grid::child::flags_
private

The flags for the border and cell setup.

Definition at line 414 of file grid.hpp.

Referenced by get_flags(), and set_flags().

◆ widget_

std::unique_ptr<widget> gui2::grid::child::widget_
private

Pointer to the widget.

Once the widget is assigned to the grid we own the widget and it will be destroyed with the grid or free_widget is called.

Definition at line 428 of file grid.hpp.

Referenced by can_wrap(), free_widget(), get_best_size(), get_widget(), and set_widget().


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