The Battle for Wesnoth  1.13.11+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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:
Inheritance graph

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 26 of file walker.hpp.

Member Enumeration Documentation

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 34 of file walker.hpp.

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 48 of file walker.hpp.

Constructor & Destructor Documentation

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

Definition at line 29 of file walker.hpp.

Member Function Documentation

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::tree_node, gui2::iteration::walker::widget, and gui2::iteration::grid.

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

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
Parameters
levelDetermines from which level should the current widget be returned.
Returns
Pointer to the current widget.

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

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::tree_node, gui2::iteration::walker::widget, and gui2::iteration::grid.

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


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