- Timestamp:
- 05/31/13 19:33:59 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gui/gui_common.hh
r66 r69 30 30 }; 31 31 32 class render_data 33 { 34 public: 35 ~render_data(){} 36 }; 37 38 class element; 39 class environment; 40 32 41 } // namespace gui 33 42 -
trunk/nv/gui/gui_element.hh
r66 r69 16 16 #include <nv/object.hh> 17 17 #include <nv/position.hh> 18 #include <nv/io_event.hh> 19 #include <nv/gui/gui_common.hh> 18 20 19 21 namespace nv … … 21 23 namespace gui 22 24 { 23 24 25 class element : public object 25 26 { … … 30 31 virtual void on_update( uint32 elapsed ); 31 32 virtual void on_draw(); 32 // bool on_event(event );33 bool contains( const position& p ) const;33 virtual bool on_event( const io_event& event ); 34 virtual bool contains( const position& p ) const; 34 35 virtual void set_relative( const rectangle& r ); 35 36 virtual void set_relative( const position& p ); … … 39 40 virtual bool is_enabled() const { return m_enabled; } 40 41 virtual bool is_visible() const { return m_visible; } 42 virtual bool is_dirty() const { return m_dirty; } 41 43 virtual void set_enabled( bool value ) { m_enabled = value; } 42 44 virtual void set_visible( bool value ) { m_visible = value; } 45 virtual void set_dirty( bool value ) { m_dirty = value; } 46 virtual const string& get_text() const { return m_text; } 47 virtual void set_text( const string& text ) { m_text = text; m_dirty = true; } 48 virtual const string& get_class() const { return m_class; } 49 virtual void set_class( const string& class_ ) { m_class = class_; m_dirty = true; } 43 50 virtual void recalculate_absolute(); 44 51 protected: 52 string m_class; 53 string m_text; 45 54 rectangle m_relative; 46 55 rectangle m_absolute; 47 56 bool m_enabled; 48 57 bool m_visible; 58 bool m_dirty; 59 render_data* m_render_data; 49 60 }; 50 61 -
trunk/src/gui/gui_element.cc
r66 r69 7 7 #include "nv/gui/gui_element.hh" 8 8 9 #include "nv/gui/gui_environment.hh" 10 9 11 using namespace nv; 10 12 using namespace nv::gui; 11 13 12 14 element::element( root* aroot, const rectangle r ) 13 : object( aroot, "", 0 ), m_ relative( r ), m_absolute( r ), m_enabled( true ), m_visible( true )15 : object( aroot, "", 0 ), m_class(""), m_relative( r ), m_absolute( r ), m_enabled( true ), m_visible( true ), m_dirty( true ) 14 16 { 15 17 … … 31 33 if ( is_visible() ) 32 34 { 35 ((environment*)m_root)->draw( this ); 33 36 for ( object* i : *this ) 34 37 { … … 36 39 } 37 40 } 41 } 42 43 bool element::on_event( const io_event& event ) 44 { 45 return m_parent ? ((element*)m_parent)->on_event( event ) : false; 38 46 } 39 47 … … 63 71 void element::set_relative( const rectangle& r ) 64 72 { 73 m_dirty = true; 65 74 m_relative = r; 66 75 recalculate_absolute(); -
trunk/tests/lualib_test/lualib_test.cc
r62 r69 8 8 #include <iostream> 9 9 #include <functional> 10 #include <nv/gui/gui_element.hh> 10 11 11 12 struct test_struct
Note: See TracChangeset
for help on using the changeset viewer.