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 |
|
---|
16 | #include <nv/object.hh>
|
---|
17 | #include <nv/position.hh>
|
---|
18 |
|
---|
19 | namespace nv
|
---|
20 | {
|
---|
21 | namespace gui
|
---|
22 | {
|
---|
23 |
|
---|
24 | class element : public object
|
---|
25 | {
|
---|
26 | public:
|
---|
27 | element() : object() {}
|
---|
28 | element( root* aroot, const rectangle r );
|
---|
29 | element* get_element( const position& p );
|
---|
30 | virtual void on_update( uint32 elapsed );
|
---|
31 | virtual void on_draw();
|
---|
32 | // bool on_event( event );
|
---|
33 | bool contains( const position& p ) const;
|
---|
34 | virtual void set_relative( const rectangle& r );
|
---|
35 | virtual void set_relative( const position& p );
|
---|
36 | virtual const rectangle& get_relative() const { return m_relative; }
|
---|
37 | virtual const rectangle& get_absolute() const { return m_absolute; }
|
---|
38 | virtual element* get_parent() const { return (element*)m_parent; }
|
---|
39 | virtual bool is_enabled() const { return m_enabled; }
|
---|
40 | virtual bool is_visible() const { return m_visible; }
|
---|
41 | virtual void set_enabled( bool value ) { m_enabled = value; }
|
---|
42 | virtual void set_visible( bool value ) { m_visible = value; }
|
---|
43 | virtual void recalculate_absolute();
|
---|
44 | protected:
|
---|
45 | rectangle m_relative;
|
---|
46 | rectangle m_absolute;
|
---|
47 | bool m_enabled;
|
---|
48 | bool m_visible;
|
---|
49 | };
|
---|
50 |
|
---|
51 | } // namespace gui
|
---|
52 |
|
---|
53 | } // namespace nv
|
---|
54 |
|
---|
55 | #endif // NV_GUI_ELEMENT_HH
|
---|