Changeset 5393 in orxonox.OLD for trunk/src/lib/gui/gl_gui
- Timestamp:
- Oct 16, 2005, 2:28:55 PM (19 years ago)
- Location:
- trunk/src/lib/gui/gl_gui
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl_gui/glgui_box.cc
r5391 r5393 18 18 #include "glgui_box.h" 19 19 20 #include "list.h" 21 20 22 using namespace std; 21 23 … … 36 38 GLGuiBox::~GLGuiBox() 37 39 { 38 40 delete this->children; 39 41 } 40 42 … … 45 47 { 46 48 this->setClassID(CL_GLGUI_BOX, "GLGuiBox"); 49 this->children = new tList<GLGuiWidget>; 50 } 51 52 void GLGuiBox::pack(GLGuiWidget* widget) 53 { 54 if (widget == NULL) 55 return; 56 57 this->children->add(widget); 58 } 59 60 61 void GLGuiBox::unpack(GLGuiWidget* widget) 62 { 63 if (widget == NULL) 64 { 65 delete this->children; 66 this->children = new tList<GLGuiWidget>; 67 } 68 else 69 { 70 this->children->remove(widget); 71 } 72 } 73 74 void GLGuiBox::showAll() 75 { 76 tIterator<GLGuiWidget>* itC = this->children->getIterator(); 77 GLGuiWidget* enumC = itC->firstElement(); 78 while (enumC != NULL) 79 { 80 if (enumC->isA(CL_GLGUI_CONTAINER)) 81 static_cast<GLGuiContainer*>(enumC)->showAll(); 82 else 83 enumC->show(); 84 enumC = itC->nextElement(); 85 } 86 delete itC; 87 88 this->show(); 47 89 48 90 } 91 92 void GLGuiBox::hideAll() 93 { 94 tIterator<GLGuiWidget>* itC = this->children->getIterator(); 95 GLGuiWidget* enumC = itC->firstElement(); 96 while (enumC != NULL) 97 { 98 if (enumC->isA(CL_GLGUI_CONTAINER)) 99 static_cast<GLGuiContainer*>(enumC)->showAll(); 100 else 101 enumC->hide(); 102 enumC = itC->nextElement(); 103 } 104 delete itC; 105 106 this->hide(); 107 } 108 49 109 50 110 /** -
trunk/src/lib/gui/gl_gui/glgui_box.h
r5391 r5393 11 11 12 12 // FORWARD DECLARATION 13 template<class T> class tList; 13 14 14 15 typedef enum … … 31 32 void setType(GLGuiBoxType type) { this->type = type; }; 32 33 34 virtual void pack(GLGuiWidget* widget); 35 virtual void unpack(GLGuiWidget* widget); 36 virtual void showAll(); 37 virtual void hideAll(); 38 33 39 virtual void draw(); 34 40 35 41 private: 36 GLGuiBoxType type; 42 GLGuiBoxType type; 43 tList<GLGuiWidget>* children; 37 44 38 45 }; -
trunk/src/lib/gui/gl_gui/glgui_container.cc
r5387 r5393 18 18 #include "glgui_container.h" 19 19 20 #include "list.h"21 22 23 20 using namespace std; 24 21 … … 29 26 { 30 27 this->init(); 31 this->children = new tList<GLGuiWidget>;32 28 } 33 29 … … 38 34 GLGuiContainer::~GLGuiContainer() 39 35 { 40 delete this->children;41 36 } 42 37 … … 50 45 } 51 46 52 void GLGuiContainer::showAll()53 {54 tIterator<GLGuiWidget>* itC = this->children->getIterator();55 GLGuiWidget* enumC = itC->firstElement();56 while (enumC != NULL)57 {58 if (enumC->isA(CL_GLGUI_CONTAINER))59 static_cast<GLGuiContainer*>(enumC)->showAll();60 else61 enumC->show();62 enumC = itC->nextElement();63 }64 delete itC;65 66 this->show();67 68 }69 70 void GLGuiContainer::hideAll()71 {72 tIterator<GLGuiWidget>* itC = this->children->getIterator();73 GLGuiWidget* enumC = itC->firstElement();74 while (enumC != NULL)75 {76 if (enumC->isA(CL_GLGUI_CONTAINER))77 static_cast<GLGuiContainer*>(enumC)->showAll();78 else79 enumC->hide();80 enumC = itC->nextElement();81 }82 delete itC;83 84 this->hide();85 }86 87 47 88 48 /** -
trunk/src/lib/gui/gl_gui/glgui_container.h
r5391 r5393 11 11 12 12 // FORWARD DECLARATION 13 template<class T> class tList;14 13 15 14 //! This is part of the openglGUI class … … 25 24 void init(); 26 25 27 void add(GLGuiWidget* widget);28 26 29 27 void setBorderWidth(float borderwidth); 30 28 31 void hideAll(); 32 void showAll(); 29 30 virtual void pack(GLGuiWidget* widget) = 0; 31 /** unpacks a Widget from this container. @param widget the GLGuiWidget to unpack, if NULL all subwidgets will be unpackt. */ 32 virtual void unpack(GLGuiWidget* widget) = 0; 33 virtual void hideAll() = 0; 34 virtual void showAll() = 0; 33 35 34 36 … … 36 38 37 39 private: 38 tList<GLGuiWidget>* children;39 40 40 41 }; -
trunk/src/lib/gui/gl_gui/glgui_frame.cc
r5364 r5393 17 17 18 18 #include "glgui_frame.h" 19 20 #include "debug.h" 19 21 20 22 using namespace std; … … 44 46 { 45 47 this->setClassID(CL_GLGUI_FRAME, "GLGuiFrame"); 48 this->child = NULL; 49 } 46 50 51 void GLGuiFrame::pack(GLGuiWidget* widget) 52 { 53 if (widget == NULL) 54 return; 55 56 if (this->child == NULL) 57 this->child = widget; 58 else 59 { 60 PRINTF(2)("Frame %s is already filled, not filling with %s\n", this->getName(), widget->getName()); 61 } 47 62 } 63 64 void GLGuiFrame::unpack(GLGuiWidget* widget) 65 { 66 if (widget == NULL || widget == this->child) 67 this->child = NULL; 68 } 69 70 void GLGuiFrame::showAll() 71 { 72 if (this->child != NULL) 73 { 74 if (this->child->isA(CL_GLGUI_CONTAINER)) 75 static_cast<GLGuiContainer*>(this->child)->showAll(); 76 else 77 this->child->show(); 78 } 79 this->show(); 80 } 81 82 void GLGuiFrame::hideAll() 83 { 84 if (this->child != NULL) 85 { 86 if (this->child->isA(CL_GLGUI_CONTAINER)) 87 static_cast<GLGuiContainer*>(this->child)->hideAll(); 88 else 89 this->child->hide(); 90 } 91 this->hide(); 92 } 93 48 94 49 95 /** -
trunk/src/lib/gui/gl_gui/glgui_frame.h
r5364 r5393 24 24 void init(); 25 25 26 virtual void pack(GLGuiWidget* widget); 27 virtual void unpack(GLGuiWidget* widget); 28 virtual void showAll(); 29 virtual void hideAll(); 30 26 31 virtual void draw(); 27 32 28 33 private: 34 GLGuiWidget* child; 29 35 30 36 };
Note: See TracChangeset
for help on using the changeset viewer.