Changeset 9546 in orxonox.OLD for branches/proxy
- Timestamp:
- Jul 28, 2006, 11:13:00 AM (18 years ago)
- Location:
- branches/proxy/src
- Files:
-
- 9 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/proxy/src/lib/gui/gl/Makefile.am
r9406 r9546 22 22 glgui_bar.cc \ 23 23 glgui_box.cc \ 24 glgui_fixedposition_box.cc \ 24 25 glgui_frame.cc \ 25 26 glgui_text.cc \ … … 49 50 glgui_bar.h \ 50 51 glgui_box.h \ 52 glgui_fixedposition_box.h \ 51 53 glgui_frame.h \ 52 54 glgui_text.h \ -
branches/proxy/src/lib/gui/gl/glgui_box.h
r8145 r9546 1 1 /*! 2 * @file glgui_ .h2 * @file glgui_box.h 3 3 * The gl_box widget of th openglGUI 4 4 * -
branches/proxy/src/lib/gui/gl/glgui_defs.h
r8619 r9546 23 23 24 24 //! Names of Orientations 25 const std::string OrientationString[] = { 26 "Horizontal", 27 "Vertical" 28 }; 25 const std::string OrientationString[] = 26 { 27 "Horizontal", 28 "Vertical" 29 }; 30 31 //! An enumeration for the Positions of some Elements (FixedPositionBox as an example). 32 typedef enum { 33 Left, //!< Left 34 Right, //!< Right 35 Top, //!< Top 36 Bottom, //!< Bottom 37 TopLeft, //!< TopLeft 38 TopRight, //!< TopRight 39 BottomLeft, //!< BottomLeft 40 BottomRight, //!< BottomRight 41 Center, //!< Centered 42 } Position; 43 44 //! Names of Positions 45 const std::string PositionString[] = 46 { 47 "Left", 48 "Right", 49 "Top", 50 "Bottom", 51 "TopLeft", 52 "TopRight", 53 "BottomLeft", 54 "BottomRight", 55 "Center" 56 }; 57 29 58 30 59 //! An enumerator that defines the different states Widgets may be in. … … 39 68 #define GLGUI_DEFAULT_STYLE OrxGui::Normal 40 69 41 //! names of the States.70 //! names of the States. 42 71 const std::string StateString[] = 43 72 { … … 48 77 }; 49 78 50 51 52 53 54 55 56 79 //! Where a Certain feature will be positioned at. 80 typedef enum { 81 FeatureLeft, //!< On the Left side. 82 FeatureRight, //!< On the Right side. 83 FeatureTop, //!< On Top of the rest of the Widget. 84 FeatureBottom, //!< At the Bottom of the rest of the Widget. 85 } FeaturePosition; 57 86 58 59 87 //! Names of Feature-Positions 88 const std::string FeaturePositionString[] = 60 89 { 61 90 "Left", -
branches/proxy/src/lib/gui/gl/glgui_fixedposition_box.cc
r9541 r9546 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI 17 17 18 #include "glgui_box.h" 18 #include "glgui_fixedposition_box.h" 19 #include "glgui_handler.h" 19 20 #include <cassert> 20 21 … … 24 25 * standard constructor 25 26 */ 26 GLGuiBox::GLGuiBox (OrxGui::Orientation orientation) 27 GLGuiFixedpositionBox::GLGuiFixedpositionBox (OrxGui::Position position, OrxGui::Orientation orientation) 28 GLGuiBox(orientation) 27 29 { 28 this->init();29 30 this->setOrientation(orientation);31 30 } 32 31 … … 35 34 * standard deconstructor 36 35 */ 37 GLGui Box::~GLGuiBox()36 GLGuiFixedpositionBox::~GLGuiFixedpositionBox() 38 37 {} 39 38 40 /** 41 * initializes the GUI-element 42 */ 43 void GLGuiBox::init() 39 40 void GLGuiFixedpositionBox::setPosition(OrxGui::Position position) 44 41 { 45 this->setClassID(CL_GLGUI_BOX, "GLGuiBox"); 46 } 47 48 void GLGuiBox::pack(GLGuiWidget* widget) 49 { 50 assert (widget != NULL); 51 52 this->children.push_back(widget); 53 widget->setParentWidget(this); 54 55 this->resize(); 42 this->_position = position; 43 this->resize; 56 44 } 57 45 58 46 59 void GLGui Box::unpack(GLGuiWidget* widget)47 void GLGuiFixedpositionBox::resize() 60 48 { 61 assert(widget != NULL);49 GLGuiBox::resize(); 62 50 63 std::vector<GLGuiWidget*>::iterator delWidget = std::find(this->children.begin(), this->children.end(), widget); 64 if (delWidget != this->children.end()) 51 switch (this->position) 65 52 { 66 (*delWidget)->setParentWidget(NULL); 67 this->children.erase(delWidget); 53 case OrxGui::Center: 54 this->setAbsCoor2D(GuiHandler::getInstance()->resolution() - this->getSize2D() / 2.0); 55 break; 56 68 57 } 69 this->resize();70 }71 72 void GLGuiBox::clear()73 {74 this->children.clear();75 this->resize();76 }77 78 void GLGuiBox::showAll()79 {80 std::vector<GLGuiWidget*>::iterator itC = this->children.begin();81 while (itC != this->children.end())82 {83 if ((*itC)->isA(CL_GLGUI_CONTAINER))84 static_cast<GLGuiContainer*>(*itC)->showAll();85 else86 (*itC)->show();87 itC++;88 }89 90 this->show();91 }92 93 void GLGuiBox::hideAll()94 {95 std::vector<GLGuiWidget*>::iterator itC = this->children.begin();96 while (itC != this->children.end())97 {98 if ((*itC)->isA(CL_GLGUI_CONTAINER))99 static_cast<GLGuiContainer*>(*itC)->hideAll();100 else101 (*itC)->hide();102 itC++;103 }104 105 this->hide();106 }107 108 void GLGuiBox::resize()109 {110 if (orientation() == OrxGui::Vertical)111 {112 float height = borderTop();113 float width = 0.0f;114 std::vector<GLGuiWidget*>::iterator widget;115 116 // find out how big the Widgets are.117 for (widget = this->children.begin(); widget != this->children.end(); ++widget)118 {119 (*widget)->setRelCoor2D(borderLeft(), height);120 height += (*widget)->getSizeY2D();121 width = fmax(width, (*widget)->getSizeX2D());122 }123 124 width += borderLeft() + borderRight();125 height += borderBottom(); /* *2 done further up */126 127 this->setSize2D(width, height);128 }129 else130 {131 float height = borderTop();132 float width = borderLeft();133 std::vector<GLGuiWidget*>::iterator widget;134 135 // find out how big the Widgets are.136 for (widget = this->children.begin(); widget != this->children.end(); ++widget)137 {138 (*widget)->setRelCoor2D(width, borderTop());139 height = fmax(height, (*widget)->getSizeY2D());140 width += (*widget)->getSizeX2D();141 }142 143 width += borderRight() ;144 height += borderBottom(); /* *2 done further up */145 146 this->setSize2D(width, height);147 }148 GLGuiWidget::resize();149 150 58 // resize everything. 151 59 //for (widget = this->children.begin(); widget != this->children.end(); ++widget) … … 153 61 } 154 62 155 /**156 * @brief draws the GLGuiBox157 */158 void GLGuiBox::draw() const159 {160 this->beginDraw();161 GLGuiWidget::draw();162 this->endDraw();163 }164 63 } -
branches/proxy/src/lib/gui/gl/glgui_fixedposition_box.h
r9541 r9546 1 1 /*! 2 * @file glgui_.h 3 * The gl_box widget of th openglGUI 4 * 2 * @file glgui_fixedposition_box.h 3 * The gl_fixedposition_box widget of th openglGUi 5 4 */ 6 5 7 #ifndef _GLGUI_ BOX_H8 #define _GLGUI_ BOX_H6 #ifndef _GLGUI_FIXEDPOSITION_BOX_H 7 #define _GLGUI_FIXEDPOSITION_BOX_H 9 8 10 9 #include "glgui_container.h" … … 17 16 * 18 17 */ 19 class GLGui Box : public GLGuiContainer18 class GLGuiFixedpositionBox : public GLGuiBox 20 19 { 21 20 22 21 public: 23 GLGui Box(OrxGui::Orientation orientation = OrxGui::Vertical);24 virtual ~GLGui Box();22 GLGuiFixedpositionBox(OrxGui::Position position = OrxGui::Center, OrxGui::Orientation orientation = OrxGui::Vertical); 23 virtual ~GLGuiFixedpositionBox(); 25 24 26 /** @returns the Orientation of the Box */ 27 OrxGui::Orientation orientation() const { return this->_orientation; }; 28 /** @param orientation the Orientation of the Box */ 29 void setOrientation(OrxGui::Orientation orientation) { this->_orientation = orientation; }; 25 inline OrxGui::Position position() const { return _position; }; 26 void setPosition(OrxGui::Position); 30 27 31 virtual void pack(GLGuiWidget* widget);32 virtual void unpack(GLGuiWidget* widget);33 virtual void clear();34 35 virtual void showAll();36 virtual void hideAll();37 38 virtual void draw() const;39 28 40 29 protected: 41 30 virtual void resize(); 42 31 32 43 33 private: 44 void init(); 45 46 Orientation _orientation; 47 std::vector<GLGuiWidget*> children; 34 OrxGui::Position _position; //!< The Fixed position of the Widget. 48 35 }; 49 36 } 50 #endif /* _GLGUI_ _H */37 #endif /* _GLGUI_FIXEDPOSITION_BOX_H */ -
branches/proxy/src/lib/gui/gl/glgui_handler.cc
r9240 r9546 28 28 #include "debug.h" 29 29 30 #include <cassert>31 32 30 33 31 /// TAKE THIS OUT OF HERE. … … 93 91 void GLGuiHandler::activate() 94 92 { 93 this->_resolution = Vector2D(GraphicsEngine::getInstance()->getResolutionX(), GraphicsEngine::getInstance()->getResolutionY()); 95 94 //EventHandler::getInstance()->pushState(ES_MENU); 96 95 … … 244 243 if (this->_cursor != NULL) 245 244 this->_cursor->setMaxBorders(Vector2D(event.resize.w, event.resize.h)); 246 break; 245 this->_resolution = Vector2D(event.resize.w, event.resize.h); 246 break; 247 247 248 case SDLK_TAB: 248 249 if (event.bPressed) -
branches/proxy/src/lib/gui/gl/glgui_handler.h
r9240 r9546 12 12 namespace OrxGui 13 13 { 14 14 // FORWARD DECLARATION 15 15 class GLGuiCursor; 16 16 17 // FORWARD DECLARATION18 17 19 18 //! A singleton class for the GLGui-Handler … … 22 21 23 22 public: 24 virtual ~GLGuiHandler(void);25 23 /** @returns a Pointer to the only object of this Class */ 26 24 inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler(); return GLGuiHandler::singletonRef; }; 25 /** @brief deletes the instance if it exists */ 26 inline static void deleteInstance() { if (GLGuiHandler::singletonRef) delete GLGuiHandler::singletonRef; }; 27 27 28 28 void activateCursor(); … … 33 33 const Vector2D& cursorPositionAbs() const; 34 34 Vector2D cursorPositionRel(const GLGuiWidget* const widget) const; 35 36 const Vector2D& resolution() const { return this->_resolution; }; 35 37 36 38 void selectNext(); … … 48 50 private: 49 51 GLGuiHandler(void); 52 virtual ~GLGuiHandler(void); 50 53 static GLGuiHandler* singletonRef; 51 54 … … 53 56 bool isActive; 54 57 GLGuiCursor* _cursor; 58 Vector2D _resolution; 55 59 56 60 }; -
branches/proxy/src/lib/network/monitor/network_stats_widget.cc
r9494 r9546 169 169 this->_bar.setChangedValueColor(Color::black); 170 170 */ 171 this->pack(&this->_thisHost); 171 this->_thisHostIs.setText(std::string("I am ") + _monitor->getLocalNode()->getPeerInfo()->getNodeTypeString()); 172 173 this->pack(&this->_thisHostIs); 174 175 this->pack(&this->_thisHost); 172 176 173 177 this->pack(&this->_upstreamText); -
branches/proxy/src/lib/network/monitor/network_stats_widget.h
r9494 r9546 2 2 * @file network_stats_widget.h 3 3 * @brief Definition of an EnergyWidget, that displays a bar and a Text 4 */4 */ 5 5 6 6 #ifndef _NETWORK_STATS_WIDGET_H … … 101 101 const NetworkMonitor* _monitor; 102 102 103 OrxGui::GLGuiText _thisHostIs; 103 104 HostWidget _thisHost; 104 105 -
branches/proxy/src/story_entities/menu/game_menu.cc
r9406 r9546 76 76 if( this->dataTank) 77 77 delete this->dataTank; 78 delete OrxGui::GLGuiHandler::getInstance( );78 OrxGui::GLGuiHandler::deleteInstance( ); 79 79 } 80 80 -
branches/proxy/src/story_entities/multi_player_world.cc
r9406 r9546 63 63 if( this->dataTank) 64 64 delete this->dataTank; 65 delete OrxGui::GLGuiHandler::getInstance( );65 OrxGui::GLGuiHandler::deleteInstance( ); 66 66 } 67 67
Note: See TracChangeset
for help on using the changeset viewer.