The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Public Types | Public Member Functions | List of all members
gui2::iterator::twalker_ Class Referenceabstract

The walker abstract base class. More...

#include <walker.hpp>

Inheritance diagram for gui2::iterator::twalker_:
Inheritance graph

Public Types

enum  tlevel { widget, grid, child }
 The level to walk at. More...
 
enum  tstate { valid, invalid, fail }
 The state of the walker. More...
 

Public Member Functions

virtual ~twalker_ ()
 
virtual tstate next (const tlevel level)=0
 Make the next widget the current one. More...
 
virtual bool at_end (const tlevel level) const =0
 Returns whether the current widget is valid. More...
 
virtual gui2::twidgetget (const tlevel 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

The level to walk at.

Enumerator
widget 

Visit the widget itself.

Visit its nested grid.

grid 

Visit the children of its nested grid.

child 

Definition at line 35 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 51 of file walker.hpp.

Constructor & Destructor Documentation

virtual gui2::iterator::twalker_::~twalker_ ( )
inlinevirtual

Definition at line 30 of file walker.hpp.

Member Function Documentation

virtual bool gui2::iterator::twalker_::at_end ( const tlevel  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::iterator::walker::twidget, and gui2::iterator::tgrid.

Referenced by gui2::iterator::policy::visit::tvisit< level >::at_end().

virtual gui2::twidget* gui2::iterator::twalker_::get ( const tlevel  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::iterator::walker::twidget, and gui2::iterator::tgrid.

virtual tstate gui2::iterator::twalker_::next ( const tlevel  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::iterator::walker::twidget, and gui2::iterator::tgrid.

Referenced by gui2::iterator::policy::visit::tvisit< level >::next().


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