00001 /* $Id: walker.hpp 52869 2012-02-03 20:18:33Z shadowmaster $ */ 00002 /* 00003 Copyright (C) 2011 - 2012 by Mark de Wever <koraq@xs4all.nl> 00004 Part of the Battle for Wesnoth Project http://www.wesnoth.org/ 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY. 00012 00013 See the COPYING file for more details. 00014 */ 00015 00016 #ifndef GUI_WIDGETS_AUXILIARY_ITERATOR_WALKER_HPP_INCLUDED 00017 #define GUI_WIDGETS_AUXILIARY_ITERATOR_WALKER_HPP_INCLUDED 00018 00019 namespace gui2 { 00020 00021 class twidget; 00022 00023 namespace iterator { 00024 00025 /** The walker abstract base class. */ 00026 class twalker_ 00027 { 00028 public: 00029 00030 virtual ~twalker_() {} 00031 00032 /** The level to walk at. */ 00033 enum tlevel 00034 { 00035 /** Visit the widget itself. */ 00036 widget 00037 /** Visit its nested grid. */ 00038 , grid 00039 /** Visit the children of its nested grid. */ 00040 , child 00041 }; 00042 00043 /** 00044 * The state of the walker. 00045 * 00046 * The enum is used to return the state of @ref next. 00047 */ 00048 enum tstate 00049 { 00050 /** 00051 * When calling next the following it has the following results. 00052 * 00053 * @pre at_end == false 00054 * 00055 * @post the next widget became the current one. 00056 * @post at_end == false 00057 */ 00058 valid 00059 00060 /** 00061 * When calling next the following it has the following results. 00062 * 00063 * @pre at_end == false 00064 * 00065 * @post there is no longer a current widget. 00066 * @post at_end == true 00067 */ 00068 , invalid 00069 00070 /** 00071 * When calling next the following it has the following results. 00072 * 00073 * @pre at_end == true 00074 * 00075 * @post at_end == true 00076 */ 00077 , fail 00078 00079 }; 00080 00081 /** 00082 * Make the next widget the current one. 00083 * 00084 * @param level Determines on which level the next one should 00085 * be selected. 00086 * 00087 * @returns The status of the operation. 00088 */ 00089 virtual tstate next(const tlevel level) = 0; 00090 00091 /** 00092 * Returns whether the current widget is valid. 00093 * 00094 * @param level Determines on which level the test should be 00095 * executed. 00096 * 00097 * 00098 * @returns Whether the current widget is valid. 00099 */ 00100 virtual bool at_end(const tlevel level) const = 0; 00101 00102 /** 00103 * Returns a pointer to the current widget. 00104 * 00105 * @pre @ref at_end(level) == false 00106 * 00107 * @param level Determines from which level should the 00108 * current widget be returned. 00109 * 00110 * @returns Pointer to the current widget. 00111 */ 00112 virtual gui2::twidget* get(const tlevel level) = 0; 00113 }; 00114 00115 } // namespace iterator 00116 00117 } // namespace gui2 00118 00119 #endif 00120 00121
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:02:54 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |