Changeset 9621 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 30, 2006, 10:06:46 PM (18 years ago)
- Location:
- branches/proxy/src/lib/gui/gl
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/gui/gl/glgui_box.cc
r9620 r9621 18 18 #include "glgui_box.h" 19 19 #include <cassert> 20 #include "debug.h" 20 21 21 22 namespace OrxGui … … 57 58 { 58 59 assert (widget != NULL); 59 60 60 this->_children.push_back(widget); 61 62 this->packing(widget); 63 } 64 65 66 void GLGuiBox::pack(GLGuiWidget* widget, std::list<GLGuiWidget*>::iterator pos) 67 { 68 this->_children.insert(pos, widget); 69 this->packing(widget); 70 } 71 72 void GLGuiBox::pack(GLGuiWidget* widget, unsigned int position) 73 { 74 if (this->_children.empty()) 75 this->pack(widget); 76 77 unsigned int pos = 0; 78 std::list<GLGuiWidget*>::iterator it = this->_children.begin(); 79 80 for (; pos < position; ++pos) 81 { 82 if (this->_children.end() == ++it) 83 { 84 PRINTF(2)("Reached end of packing list, without getting to the designated position %d (i am at %d)\n", position, pos); 85 this->pack(widget); 86 } 87 } 88 this->_children.insert(it, widget); 89 this->packing(widget); 90 } 91 92 void GLGuiBox::pack(GLGuiWidget* widget, GLGuiWidget* widgetPointer) 93 { 94 assert (widget != NULL && widgetPointer != NULL); 95 96 std::list<GLGuiWidget*>::iterator it = this->_children.begin(); 97 for (; it != this->_children.end(); ++it) 98 { 99 if (widgetPointer == *it) 100 { 101 this->_children.insert(it, widget); 102 return; 103 } 104 } 105 PRINTF(2)("WidgetPointer %p not found, inserting at the end\n", widgetPointer); 106 this->pack(widget); 107 this->packing(widget); 108 } 109 110 void GLGuiBox::packFront(GLGuiWidget* widget) 111 { 112 this->_children.push_front(widget); 113 this->packing(widget); 114 } 115 116 void GLGuiBox::packBack(GLGuiWidget* widget) 117 { 118 this->pack(widget); 119 } 120 121 void GLGuiBox::packing(GLGuiWidget* widget) 122 { 61 123 widget->setParentWidget(this); 62 63 124 this->resize(); 64 125 } 65 66 126 67 127 void GLGuiBox::unpack(GLGuiWidget* widget) -
branches/proxy/src/lib/gui/gl/glgui_box.h
r9620 r9621 30 30 31 31 virtual void pack(GLGuiWidget* widget); 32 void pack(GLGuiWidget* widget, std::list<GLGuiWidget*>::iterator pos);33 32 void pack(GLGuiWidget* widget, unsigned int position); 34 //void 33 void pack(GLGuiWidget* widget, GLGuiWidget* widgetPointer); 34 void packFront(GLGuiWidget* widget); 35 void packBack(GLGuiWidget* widget); 35 36 virtual void unpack(GLGuiWidget* widget); 37 36 38 virtual void clear(); 37 39 … … 46 48 private: 47 49 void init(); 50 void packing(GLGuiWidget* widget); // the action executing when packing a widget. 51 void pack(GLGuiWidget* widget, std::list<GLGuiWidget*>::iterator pos); 52 53 private: 54 48 55 49 56 Orientation _orientation;
Note: See TracChangeset
for help on using the changeset viewer.