Changeset 7901 in orxonox.OLD for branches/gui/src
- Timestamp:
- May 27, 2006, 1:43:23 PM (19 years ago)
- Location:
- branches/gui/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl_gui/Makefile.am
r7892 r7901 17 17 glgui_button.cc \ 18 18 glgui_pushbutton.cc \ 19 glgui_checkbutton.cc \ 19 20 glgui_container.cc \ 20 21 glgui_bar.cc \ … … 36 37 glgui_button.h \ 37 38 glgui_pushbutton.h \ 39 glgui_checkbutton.h \ 38 40 glgui_container.h \ 39 41 glgui_bar.h \ -
branches/gui/src/lib/gui/gl_gui/glgui.h
r7892 r7901 15 15 #include "glgui_button.h" 16 16 #include "glgui_checkbutton.h" 17 #include "glgui_colorselector.h"17 //#include "glgui_colorselector.h" 18 18 #include "glgui_pushbutton.h" 19 19 #include "glgui_cursor.h" -
branches/gui/src/lib/gui/gl_gui/glgui_button.cc
r7883 r7901 30 30 this->init(); 31 31 32 this-> setLabel(label);32 this->label.setText( label ); 33 33 } 34 34 … … 64 64 { 65 65 this->label.setText(label); 66 this->label.setRelCoor2D(5, 5); 67 this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10); 68 66 this->resize(); 69 67 } 70 68 71 72 69 /** 73 * draws the GLGuiButton70 * @brief draws the GLGuiButton 74 71 */ 75 72 void GLGuiButton::draw() const -
branches/gui/src/lib/gui/gl_gui/glgui_button.h
r7883 r7901 39 39 void setLabel(const std::string& label); 40 40 41 virtual void resize() = 0; 42 41 43 virtual void draw() const; 42 44 -
branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.cc
r7779 r7901 27 27 * standard constructor 28 28 */ 29 GLGuiCheckButton::GLGuiCheckButton () 29 GLGuiCheckButton::GLGuiCheckButton (const std::string& label, bool active) 30 : GLGuiButton(label) 30 31 { 31 32 this->init(); 33 this->bActive = active; 32 34 35 this->resize(); 33 36 } 34 37 … … 44 47 * initializes the GUI-element 45 48 */ 46 GLGuiCheckButton::init()49 void GLGuiCheckButton::init() 47 50 { 48 51 this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton"); 52 } 49 53 54 55 void GLGuiCheckButton::toggleActiveState() 56 { 57 this->bActive = !this->bActive; 58 } 59 60 void GLGuiCheckButton::resize() 61 { 62 this->label.setRelCoor2D(25, 5); 63 this->setSize2D(this->label.getSizeX2D() + 30, this->label.getSizeY2D() + 10); 64 } 65 66 67 void GLGuiCheckButton::released() 68 { 69 printf("%s released\n", this->getLabel().c_str()); 70 GLGuiWidget::released(); 71 this->toggleActiveState(); 50 72 } 51 73 52 74 /** 53 * draws the GLGuiCheckButton75 * @brief draws the GLGuiPushButton 54 76 */ 55 77 void GLGuiCheckButton::draw() const 56 78 { 79 this->startDraw(); 80 GLGuiButton::draw(); 81 82 this->frontMaterial().select(); 83 glBegin(GL_QUADS); 84 85 glTexCoord2i(0,0); glVertex2d(1, 1); 86 glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1); 87 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1); 88 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1); 89 90 if (this->bActive) 91 glColor3f( 1, 1 ,1); 92 else 93 glColor3f(0, 0, 0); 94 glTexCoord2i(0,0); glVertex2d(8, 8); 95 glTexCoord2i(0,1); glVertex2d(8, this->getSizeY2D()-8); 96 glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8, this->getSizeY2D()-8); 97 glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8, 8); 98 99 glEnd(); 100 101 102 this->endDraw(); 103 // this->label->draw(); 104 // printf("test"); 57 105 } 58 106 } -
branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.h
r7779 r7901 6 6 7 7 #ifndef _GLGUI_CHECKBUTTON_H 8 #define _GLGUI_ _H8 #define _GLGUI_CHECKBUTTON_H 9 9 10 10 #include "glgui_button.h" … … 23 23 24 24 public: 25 GLGuiCheckButton( );25 GLGuiCheckButton(const std::string& label = "", bool active = false); 26 26 virtual ~GLGuiCheckButton(); 27 27 28 void init(); 28 virtual void resize(); 29 virtual void released(); 29 30 30 31 bool isActive() { return this->bActive; }; 31 32 void setActivity(bool bActive); 33 void toggleActiveState(); 32 34 33 35 virtual void draw() const; 34 36 virtual void update() {}; 37 38 private: 39 void init(); 40 35 41 36 42 private: -
branches/gui/src/lib/gui/gl_gui/glgui_colorselector.h
r7779 r7901 5 5 */ 6 6 7 #ifndef _GLGUI_ _H8 #define _GLGUI_ _H7 #ifndef _GLGUI_COLORSELECTOR_H 8 #define _GLGUI_COLORSELECTOR_H 9 9 10 #include " base_object.h"10 #include "glgui_widget.h" 11 11 12 12 namespace OrxGui -
branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc
r7896 r7901 28 28 */ 29 29 GLGuiPushButton::GLGuiPushButton (const std::string& label) 30 : GLGuiButton(label)30 : GLGuiButton(label) 31 31 { 32 32 this->init(); 33 34 this->resize(); 33 35 } 34 36 … … 39 41 GLGuiPushButton::~GLGuiPushButton() 40 42 { 43 } 44 45 void GLGuiPushButton::resize() 46 { 47 this->label.setRelCoor2D(5, 5); 48 this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10); 41 49 } 42 50 … … 78 86 79 87 /** 80 * draws the GLGuiPushButton88 * @brief draws the GLGuiPushButton 81 89 */ 82 90 void GLGuiPushButton::draw() const -
branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.h
r7883 r7901 23 23 24 24 public: 25 GLGuiPushButton(const std::string& label );25 GLGuiPushButton(const std::string& label = ""); 26 26 virtual ~GLGuiPushButton(); 27 27 28 29 virtual void resize(); 28 30 29 31 virtual void receivedFocus(); -
branches/gui/src/story_entities/simple_game_menu.cc
r7895 r7901 70 70 pb->setAbsCoor2D(50, 50); 71 71 72 OrxGui::GLGui PushButton* dnpb = new OrxGui::GLGuiPushButton("DO NOT PUSH ME");72 OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("DO NOT PUSH ME"); 73 73 dnpb->show(); 74 74 dnpb->setAbsCoor2D(350, 50);
Note: See TracChangeset
for help on using the changeset viewer.