Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

orxonox/trunk: container-packing

File size: 1.9 KB
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: Benjamin Grauer
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
17
18#include "glgui_box.h"
19
20#include "list.h"
21
22using namespace std;
23
24/**
25 * standard constructor
26*/
27GLGuiBox::GLGuiBox (GLGuiBoxType type)
28{
29  this->init();
30
31  this->setType (type);
32}
33
34
35/**
36 * standard deconstructor
37*/
38GLGuiBox::~GLGuiBox()
39{
40  delete this->children;
41}
42
43/**
44 * initializes the GUI-element
45 */
46void GLGuiBox::init()
47{
48  this->setClassID(CL_GLGUI_BOX, "GLGuiBox");
49  this->children = new tList<GLGuiWidget>;
50}
51
52void GLGuiBox::pack(GLGuiWidget* widget)
53{
54  if (widget == NULL)
55    return;
56
57  this->children->add(widget);
58}
59
60
61void 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
74void 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
92void 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
110/**
111 * draws the GLGuiBox
112 */
113void GLGuiBox::draw()
114{
115
116}
Note: See TracBrowser for help on using the repository browser.