source:
orxonox.OLD/trunk/src/lib/gui/gl_gui/glgui_box.cc
@
5393
Last change on this file since 5393 was 5393, checked in by bensch, 19 years ago | |
---|---|
File size: 1.9 KB |
Rev | Line | |
---|---|---|
[4744] | 1 | /* |
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
3 | ||
4 | Copyright (C) 2004 orx | |
5 | ||
6 | This program is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
[1855] | 10 | |
11 | ### File Specific: | |
[5360] | 12 | main-programmer: Benjamin Grauer |
[1855] | 13 | co-programmer: ... |
[1853] | 14 | */ |
15 | ||
[5360] | 16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI |
[1853] | 17 | |
[5364] | 18 | #include "glgui_box.h" |
[1853] | 19 | |
[5393] | 20 | #include "list.h" |
21 | ||
[1856] | 22 | using namespace std; |
[1853] | 23 | |
[3245] | 24 | /** |
[4838] | 25 | * standard constructor |
[3245] | 26 | */ |
[5391] | 27 | GLGuiBox::GLGuiBox (GLGuiBoxType type) |
[3365] | 28 | { |
[5360] | 29 | this->init(); |
[4320] | 30 | |
[5391] | 31 | this->setType (type); |
[3365] | 32 | } |
[1853] | 33 | |
34 | ||
[3245] | 35 | /** |
[4838] | 36 | * standard deconstructor |
[3245] | 37 | */ |
[5364] | 38 | GLGuiBox::~GLGuiBox() |
[3543] | 39 | { |
[5393] | 40 | delete this->children; |
[3543] | 41 | } |
[5360] | 42 | |
43 | /** | |
44 | * initializes the GUI-element | |
45 | */ | |
[5364] | 46 | void GLGuiBox::init() |
[5360] | 47 | { |
[5364] | 48 | this->setClassID(CL_GLGUI_BOX, "GLGuiBox"); |
[5393] | 49 | this->children = new tList<GLGuiWidget>; |
50 | } | |
[5360] | 51 | |
[5393] | 52 | void GLGuiBox::pack(GLGuiWidget* widget) |
53 | { | |
54 | if (widget == NULL) | |
55 | return; | |
56 | ||
57 | this->children->add(widget); | |
[5360] | 58 | } |
59 | ||
[5393] | 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(); | |
89 | ||
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 | ||
109 | ||
[5360] | 110 | /** |
[5364] | 111 | * draws the GLGuiBox |
[5360] | 112 | */ |
[5364] | 113 | void GLGuiBox::draw() |
[5360] | 114 | { |
115 | ||
116 | } |
Note: See TracBrowser
for help on using the repository browser.