Changeset 440 for trunk/src/gui/gui_environment.cc
- Timestamp:
- 07/23/15 21:16:01 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/gui_environment.cc
r433 r440 9 9 #include "nv/gui/gui_renderer.hh" 10 10 11 #include <algorithm> // std::find on std::list12 13 11 /* 14 12 … … 27 25 : m_renderer( r ) 28 26 { 27 r->set_environment( this ); 29 28 m_screen = create_element( handle(), m_renderer->get_area() ); 30 29 } … … 161 160 while ( !parent->m_children.empty() ) 162 161 { 163 destroy_element( parent->m_children. front() );162 destroy_element( parent->m_children.back() ); 164 163 } 165 164 } … … 196 195 } 197 196 197 nv::string_view nv::gui::environment::get_string( shash64 h ) 198 { 199 return m_strings[h]; 200 } 201 198 202 bool nv::gui::environment::set_selected( handle e ) 199 203 { … … 235 239 236 240 handle result; 237 element::list::reverse_iteratorit = el->m_children.rbegin();241 auto it = el->m_children.rbegin(); 238 242 239 243 while ( it != el->m_children.rend() ) … … 254 258 if ( e && parent ) 255 259 { 256 auto it = std::find( parent->m_children.begin(), parent->m_children.end(), child );260 auto it = find( parent->m_children.begin(), parent->m_children.end(), child ); 257 261 if ( it != parent->m_children.end() ) 258 262 { … … 264 268 } 265 269 266 void nv::gui::environment::move_to_bottom( handle child )267 {268 element* e = m_elements.get( child );269 element* parent = m_elements.get( e->m_parent );270 if ( e && parent )271 {272 auto it = std::find( parent->m_children.begin(), parent->m_children.end(), child );273 if ( it != parent->m_children.end() )274 {275 parent->m_children.erase( it );276 parent->m_children.push_front( child );277 parent->m_flags[DIRTY] = true;278 }279 }280 }281 282 270 void nv::gui::environment::set_relative( handle e, const rectangle& r ) 283 271 { … … 312 300 } 313 301 314 void nv::gui::environment::set_class( handle e, const st d::string& text )302 void nv::gui::environment::set_class( handle e, const string_view& text ) 315 303 { 316 304 element* ep = m_elements.get(e); 317 305 if ( ep != nullptr ) 318 306 { 319 ep->m_class = text;307 ep->m_class = m_strings.insert( text ); 320 308 ep->m_flags[DIRTY] = true; 321 309 } 322 310 } 323 311 324 void nv::gui::environment::set_text( handle e, const st d::string& text )312 void nv::gui::environment::set_text( handle e, const string_twine& text ) 325 313 { 326 314 element* ep = m_elements.get(e); 327 315 if ( ep != nullptr ) 328 316 { 329 ep->m_text = text;317 ep->m_text.assign( text ); 330 318 ep->m_flags[DIRTY] = true; 331 319 } … … 337 325 if ( p ) 338 326 { 339 auto it = std::find( p->m_children.begin(), p->m_children.end(), child );327 auto it = find( p->m_children.begin(), p->m_children.end(), child ); 340 328 if ( it != p->m_children.end() ) 341 329 { 342 330 element* e = m_elements.get( *it ); 343 331 e->m_parent = handle(); 344 p->m_children.erase( it);345 } 346 } 347 } 348 332 p->m_children.erase( it ); 333 } 334 } 335 } 336
Note: See TracChangeset
for help on using the changeset viewer.