The Battle for Wesnoth  1.19.0-dev
Public Types | Public Member Functions | List of all members
gui2::iteration::walker_base Class Referenceabstract

The walker abstract base class. More...

#include <walker.hpp>

Inheritance diagram for gui2::iteration::walker_base:

Public Types

enum  level { self , internal , child }
 The level to walk at. More...
 
enum  state_t { valid , invalid , fail }
 The state of the walker. More...
 

Public Member Functions

virtual ~walker_base ()
 
virtual state_t next (const level level)=0
 Make the next widget the current one. More...
 
virtual bool at_end (const level level) const =0
 Returns whether the current widget is valid. More...
 
virtual gui2::widgetget (const level level)=0
 Returns a pointer to the current widget. More...
 

Detailed Description

The walker abstract base class.

Definition at line 27 of file walker.hpp.

Member Enumeration Documentation

◆ level

The level to walk at.

Enumerator
self 

Visit the widget itself.

internal 

Visit its nested grid.

child 

Visit the children of its nested grid.

Definition at line 35 of file walker.hpp.

◆ state_t

The state of the walker.

The enum is used to return the state of next.

Enumerator
valid 

When calling next the following it has the following results.

Precondition
at_end == false
Postcondition
the next widget became the current one.
at_end == false When calling next the following it has the following results.
Precondition
at_end == false
Postcondition
there is no longer a current widget.
at_end == true
invalid 

When calling next the following it has the following results.

Precondition
at_end == true
Postcondition
at_end == true
fail 

Definition at line 49 of file walker.hpp.

Constructor & Destructor Documentation

◆ ~walker_base()

virtual gui2::iteration::walker_base::~walker_base ( )
inlinevirtual

Definition at line 30 of file walker.hpp.

Member Function Documentation

◆ at_end()

virtual bool gui2::iteration::walker_base::at_end ( const level  level) const
pure virtual

Returns whether the current widget is valid.

Parameters
levelDetermines on which level the test should be executed.
Returns
Whether the current widget is valid.

Implemented in gui2::iteration::walker::widget, gui2::iteration::tree_node, gui2::iteration::scrollbar_container, gui2::iteration::grid, and gui2::iteration::container.

Referenced by gui2::iteration::policy::visit::visit_level< level >::at_end().

◆ get()

virtual gui2::widget* gui2::iteration::walker_base::get ( const level  level)
pure virtual

Returns a pointer to the current widget.

Precondition
The following assertion holds:
at_end(level) == false
level
The level to walk at.
Definition: walker.hpp:35
virtual bool at_end(const level level) const =0
Returns whether the current widget is valid.
Parameters
levelDetermines from which level should the current widget be returned.
Returns
Pointer to the current widget.

Implemented in gui2::iteration::walker::widget, gui2::iteration::tree_node, gui2::iteration::scrollbar_container, gui2::iteration::grid, and gui2::iteration::container.

Referenced by gui2::iteration::policy::visit::visit_level< level >::get().

◆ next()

virtual state_t gui2::iteration::walker_base::next ( const level  level)
pure virtual

Make the next widget the current one.

Parameters
levelDetermines on which level the next one should be selected.
Returns
The status of the operation.

Implemented in gui2::iteration::walker::widget, gui2::iteration::tree_node, gui2::iteration::scrollbar_container, gui2::iteration::grid, and gui2::iteration::container.

Referenced by gui2::iteration::policy::visit::visit_level< level >::next().


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