Classes | Namespaces | Defines | Typedefs | Functions

gui/widgets/widget.hpp File Reference

#include "gui/auxiliary/event/dispatcher.hpp"
#include "gui/widgets/event_executor.hpp"
#include "gui/widgets/helper.hpp"
#include "utils/const_clone.tpp"
#include "wml_exception.hpp"
#include <boost/noncopyable.hpp>
#include <string>
#include <cassert>
Include dependency graph for widget.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  gui2::twidget
 Base class for all widgets. More...

Namespaces

namespace  gui2
 

A class inherited from ttext_box that displays its input as stars.


namespace  gui2::iterator

Defines

#define REGISTER_WIDGET3(type, id, key)
 Registers a widget.
#define REGISTER_WIDGET(id)   REGISTER_WIDGET3(t##id##_definition, id, _4)
 Wrapper for REGISTER_WIDGET3.

Typedefs

typedef std::map< std::string,
t_string
gui2::string_map

Functions

template<class T >
T * gui2::get_parent (twidget *widget)
 Returns the first parent of a widget with a certain type.
template<class T >
T * gui2::find_widget (typename utils::tconst_clone< twidget, T >::pointer widget, const std::string &id, const bool must_be_active, const bool must_exist)
 Gets a widget with the wanted id.
template<class T >
T & gui2::find_widget (typename utils::tconst_clone< twidget, T >::pointer widget, const std::string &id, const bool must_be_active)
 Gets a widget with the wanted id.

Define Documentation

#define REGISTER_WIDGET (   id  )     REGISTER_WIDGET3(t##id##_definition, id, _4)

Wrapper for REGISTER_WIDGET3.

"Calls" REGISTER_WIDGET3(tid_definition, id, _4)

Definition at line 867 of file widget.hpp.

#define REGISTER_WIDGET3 (   type,
  id,
  key 
)
Value:
namespace {                                                                \
                                                                           \
    namespace ns_##type {                                                  \
                                                                           \
        struct tregister_helper {                                          \
            tregister_helper()                                             \
            {                                                              \
                register_widget(#id, boost::bind(                          \
                          load_widget_definitions<type>                    \
                        , _1                                               \
                        , _2                                               \
                        , _3                                               \
                        , key));                                           \
                                                                           \
                register_builder_widget(#id, boost::bind(                  \
                              build_widget<implementation::tbuilder_##id>  \
                            , _1));                                        \
            }                                                              \
        };                                                                 \
                                                                           \
        static tregister_helper register_helper;                           \
    }                                                                      \
}

Registers a widget.

Call this function to register a widget. Use this macro in the implementation, inside the gui2 namespace.

See also:
gui2::load_widget_definitions for more information.
Note:
When the type is tfoo_definition, the id "foo" and no special key best use RESISTER_WIDGET(foo) instead.
Parameters:
type Class type of the window to register.
id Id of the widget
key The id to load if differs from id.

Definition at line 837 of file widget.hpp.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated by doxygen 1.7.1 on Fri May 25 2012 01:05:21 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs