[66] | 1 | // Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
|
---|
| 2 | // http://chaosforge.org/
|
---|
| 3 | //
|
---|
| 4 | // This file is part of NV Libraries.
|
---|
| 5 | // For conditions of distribution and use, see copyright notice in nv.hh
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | * @file gui_element.hh
|
---|
| 9 | * @author Kornel Kisielewicz
|
---|
| 10 | * @brief GUI Element
|
---|
| 11 | */
|
---|
| 12 |
|
---|
| 13 | #ifndef NV_GUI_ELEMENT_HH
|
---|
| 14 | #define NV_GUI_ELEMENT_HH
|
---|
| 15 |
|
---|
[268] | 16 | #include <nv/common.hh>
|
---|
[66] | 17 | #include <nv/position.hh>
|
---|
[69] | 18 | #include <nv/io_event.hh>
|
---|
| 19 | #include <nv/gui/gui_common.hh>
|
---|
[66] | 20 |
|
---|
| 21 | namespace nv
|
---|
| 22 | {
|
---|
| 23 | namespace gui
|
---|
| 24 | {
|
---|
[268] | 25 | class element
|
---|
[66] | 26 | {
|
---|
[257] | 27 | protected:
|
---|
[268] | 28 | /// List type
|
---|
| 29 | typedef std::list<element*> list;
|
---|
[110] | 30 |
|
---|
[268] | 31 |
|
---|
[267] | 32 | explicit element( const rectangle& r )
|
---|
[268] | 33 | : m_id( "" )
|
---|
| 34 | , m_parent( nullptr )
|
---|
| 35 | , m_children()
|
---|
| 36 | , m_child_count(0)
|
---|
| 37 | , m_class("")
|
---|
| 38 | , m_relative( r )
|
---|
| 39 | , m_absolute( r )
|
---|
| 40 | , m_enabled( true )
|
---|
| 41 | , m_visible( true )
|
---|
| 42 | , m_dirty( true )
|
---|
| 43 | , m_render_data( nullptr ) {}
|
---|
[110] | 44 |
|
---|
[257] | 45 | protected:
|
---|
[267] | 46 | virtual ~element() { delete m_render_data; }
|
---|
[66] | 47 | protected:
|
---|
[99] | 48 | friend class environment;
|
---|
[126] | 49 | friend class renderer;
|
---|
[268] | 50 | friend class style;
|
---|
[99] | 51 |
|
---|
[268] | 52 | string m_id; ///< id type of the object
|
---|
| 53 | element* m_parent; ///< pointer to parent
|
---|
| 54 | list m_children; ///< children objects
|
---|
| 55 | size_t m_child_count; ///< number of children
|
---|
[110] | 56 | string m_class; ///< Class name.
|
---|
| 57 | string m_text; ///< Displayed label or text.
|
---|
| 58 | rectangle m_relative; ///< Position relative to parent.
|
---|
| 59 | rectangle m_absolute; ///< Position relative to window/screen.
|
---|
| 60 | bool m_enabled; ///< Whether the element accepts events.
|
---|
| 61 | bool m_visible; ///< Whether the element is drawn.
|
---|
| 62 | bool m_dirty; ///< Whether the element needs updating.
|
---|
| 63 | render_data* m_render_data; ///< -?-
|
---|
[66] | 64 | };
|
---|
| 65 |
|
---|
| 66 | } // namespace gui
|
---|
| 67 |
|
---|
| 68 | } // namespace nv
|
---|
| 69 |
|
---|
| 70 | #endif // NV_GUI_ELEMENT_HH
|
---|