The Battle for Wesnoth  1.15.0-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 (widget *widget)
 
std::unique_ptr< widgetfree_widget ()
 Releases widget from ownership by this child and returns it in the form of a new unique_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 321 of file grid.hpp.

Constructor & Destructor Documentation

◆ child() [1/2]

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

Definition at line 328 of file grid.hpp.

References get_best_size(), layout_initialize(), and place().

◆ 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

◆ can_wrap()

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

Returns the can_wrap for the cell.

Definition at line 356 of file grid.hpp.

References id(), and 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 unique_ptr.

widget_ will be null after this is called.

Definition at line 403 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 374 of file grid.hpp.

References border_size_.

◆ get_flags()

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

Definition at line 364 of file grid.hpp.

References flags_.

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

◆ get_widget() [1/2]

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

◆ get_widget() [2/2]

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

Definition at line 389 of file grid.hpp.

References widget_.

◆ id()

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

Returns the id of the widget/.

Definition at line 887 of file grid.cpp.

Referenced by can_wrap(), 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 878 of file grid.cpp.

References gui2::widget::invisible.

Referenced by child(), and 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 379 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 369 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 ( widget widget)
inline

Definition at line 394 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 323 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 416 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 410 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 424 of file grid.hpp.

Referenced by can_wrap(), gui2::grid_implementation::cell_request_reduce_height(), gui2::grid_implementation::cell_request_reduce_width(), free_widget(), get_widget(), and set_widget().


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