Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/gui_element.cc
r257 r266 81 81 } 82 82 83 84 bool element::move_to_top( element* child ) 85 { 86 list::iterator it = std::find( m_children.begin(), m_children.end(), (object*)child ); 87 if ( it != m_children.end() ) 88 { 89 m_children.erase( it ); 90 m_children.push_back( child ); 91 return true; 92 } 93 return false; 94 } 95 96 bool element::move_to_bottom( element* child ) 97 { 98 list::iterator it = std::find( m_children.begin(), m_children.end(), (object*)child ); 99 if ( it != m_children.end() ) 100 { 101 m_children.erase( it ); 102 m_children.push_front( child ); 103 return true; 104 } 105 return false; 106 } 107 83 108 element::~element() 84 109 { -
trunk/src/object.cc
r265 r266 8 8 9 9 #include <algorithm> 10 #include "nv/types.hh"11 #include "nv/lua/lua_state.hh"12 #include "nv/uid.hh"13 10 14 11 using namespace nv; … … 18 15 , m_name() 19 16 , m_uid(0) 20 , m_lua_index(lua::ref::none)21 , m_lua_proto_index(lua::ref::none)22 17 , m_parent( nullptr ) 23 18 , m_children() … … 124 119 } 125 120 126 bool object::move_to_top( object* child )127 {128 list::iterator it = std::find( m_children.begin(), m_children.end(), child );129 if ( it != m_children.end() )130 {131 m_children.erase( it );132 m_children.push_back( child );133 return true;134 }135 return false;136 }137 138 bool object::move_to_bottom( object* child )139 {140 list::iterator it = std::find( m_children.begin(), m_children.end(), child );141 if ( it != m_children.end() )142 {143 m_children.erase( it );144 m_children.push_front( child );145 return true;146 }147 return false;148 }149 121 150 122 // void object::register_type( type_database* db ) -
trunk/src/root.cc
r265 r266 10 10 #include "nv/lua/lua_state.hh" 11 11 12 void nv::root::object_created( object* o )13 {14 if ( m_uid_store )15 {16 o->m_uid = m_uid_store->insert( o );17 }18 }19 20 12 void nv::root::destroy_object( object* o ) 21 13 { 22 14 destroy_children( o ); 23 15 o->detach(); 24 if ( m_lua_state && o->m_lua_index != lua::ref::none )25 {26 m_lua_state->unregister_object( lua::ref( o->m_lua_index ) );27 }28 if ( m_uid_store && o->m_uid != 0 )29 {30 m_uid_store->remove( o->m_uid );31 }32 16 delete o; 33 17 } … … 40 24 } 41 25 } 42 43 void nv::root::register_with_lua( object* o, const char* lua_name, const char* storage )44 {45 if ( m_lua_state )46 {47 if ( lua_name != nullptr )48 {49 o->m_lua_index = m_lua_state->register_object( o, lua_name ).get();50 }51 if ( storage != nullptr )52 {53 o->m_lua_proto_index = m_lua_state->register_proto( o->get_id().c_str(), storage ).get();54 }55 }56 57 }58 -
trunk/src/uid.cc
r59 r266 9 9 using namespace nv; 10 10 11 uid_store ::uid_store()11 uid_store_raw::uid_store_raw() 12 12 : m_map(), m_current(0) 13 13 { … … 15 15 } 16 16 17 object* uid_store::get( uid auid ) const17 void* uid_store_raw::get( uid auid ) const 18 18 { 19 19 map::const_iterator i = m_map.find( auid ); … … 25 25 } 26 26 27 bool uid_store ::remove( uid auid )27 bool uid_store_raw::remove( uid auid ) 28 28 { 29 29 return m_map.erase( auid ) != 0; 30 30 } 31 31 32 void uid_store ::insert( object* o, uid auid )32 void uid_store_raw::insert( void* o, uid auid ) 33 33 { 34 34 m_map[ auid ] = o; 35 35 } 36 36 37 uid uid_store ::insert( object* o )37 uid uid_store_raw::insert( void* o ) 38 38 { 39 39 uid u = request_uid(); … … 42 42 } 43 43 44 uid uid_store ::request_uid()44 uid uid_store_raw::request_uid() 45 45 { 46 46 return ++m_current; 47 47 } 48 48 49 uid_store ::~uid_store()49 uid_store_raw::~uid_store_raw() 50 50 { 51 51 // no-op
Note: See TracChangeset
for help on using the changeset viewer.