- Timestamp:
- Jun 2, 2006, 10:56:41 AM (18 years ago)
- Location:
- branches/gui/src/lib
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/event/event_handler.cc
r8061 r8115 337 337 else 338 338 { 339 SDL_WM_GrabInput(SDL_GRAB_ON);339 // SDL_WM_GrabInput(SDL_GRAB_ON); 340 340 SDL_ShowCursor(SDL_DISABLE); 341 341 } -
branches/gui/src/lib/gui/gl_gui/glgui_box.cc
r8035 r8115 109 109 if (orientation() == OrxGui::Vertical) 110 110 { 111 float height = this->border Size();111 float height = this->borderTop(); 112 112 float width = 0.0f; 113 113 std::vector<GLGuiWidget*>::iterator widget; … … 116 116 for (widget = this->children.begin(); widget != this->children.end(); ++widget) 117 117 { 118 (*widget)->setRelCoor2D(this->border Size(), height);118 (*widget)->setRelCoor2D(this->borderLeft(), height); 119 119 height += (*widget)->getSizeY2D(); 120 120 width = fmax(width, (*widget)->getSizeX2D()); 121 121 } 122 122 123 width += this->border Size() * 2.0;124 height += this->border Size(); /* *2 done further up */123 width += this->borderLeft() + this->borderRight(); 124 height += this->borderBottom(); /* *2 done further up */ 125 125 126 126 printf("%f %f\n", width, height); … … 129 129 else 130 130 { 131 float height = this->border Size();132 float width = this->border Size();131 float height = this->borderTop(); 132 float width = this->borderLeft(); 133 133 std::vector<GLGuiWidget*>::iterator widget; 134 134 … … 136 136 for (widget = this->children.begin(); widget != this->children.end(); ++widget) 137 137 { 138 (*widget)->setRelCoor2D(width, this->border Size());138 (*widget)->setRelCoor2D(width, this->borderTop()); 139 139 height = fmax(height, (*widget)->getSizeY2D()); 140 140 width += (*widget)->getSizeX2D(); 141 141 } 142 142 143 width += this->border Size() ;144 height += this->border Size(); /* *2 done further up */143 width += this->borderRight() ; 144 height += this->borderBottom(); /* *2 done further up */ 145 145 146 146 printf("%f %f\n", width, height); -
branches/gui/src/lib/gui/gl_gui/glgui_button.cc
r8035 r8115 30 30 this->init(); 31 31 32 this-> label.setText( label );32 this->_label.setText( label ); 33 33 } 34 34 … … 54 54 this->setClickable(true); 55 55 56 this-> label.setFont("fonts/final_frontier.ttf", 20);56 this->_label.setFont("fonts/final_frontier.ttf", 20); 57 57 this->frontMaterial().setDiffuse(1, 0, 0); 58 58 59 this->label.setParent2D(this); 59 this->_label.setParent2D(this); 60 this->_label.setVisibility(false); 60 61 } 61 62 … … 63 64 void GLGuiButton::setLabel(const std::string& label) 64 65 { 65 this-> label.setText(label);66 this->_label.setText(label); 66 67 this->resize(); 67 68 } … … 78 79 } 79 80 81 void GLGuiButton::hiding() 82 { 83 this->_label.setVisibility(false); 84 } 85 86 void GLGuiButton::showing() 87 { 88 this->_label.setVisibility(true); 89 } 90 91 80 92 /** 81 93 * @brief draws the GLGuiButton -
branches/gui/src/lib/gui/gl_gui/glgui_button.h
r8035 r8115 36 36 virtual ~GLGuiButton(); 37 37 38 const std::string& getLabel() const { return this->label.getText(); };38 const std::string& label() const { return this->_label.getText(); }; 39 39 void setLabel(const std::string& label); 40 40 … … 47 47 virtual void clicking(const Vector2D& pos); 48 48 virtual void releasing(const Vector2D& pos); 49 virtual void hiding(); 50 virtual void showing(); 51 52 /** @returns the Text. (the physical Text) */ 53 Text& labelText() { return this->_label; } 54 /** @returns the constant Text. (the physical Text) */ 55 const Text& labelText() const { return this->_label; } 49 56 50 57 private: … … 52 59 53 60 54 55 protected:56 57 Text label;58 59 61 private: 62 Text _label; 60 63 ButtonState state; 61 64 }; -
branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.cc
r8035 r8115 65 65 void GLGuiCheckButton::resize() 66 66 { 67 this->label .setRelCoor2D(25, 5);68 this->setSize2D(this->label .getSizeX2D() + 30, this->label.getSizeY2D() + 10);67 this->labelText().setRelCoor2D(25, 5); 68 this->setSize2D(this->labelText().getSizeX2D() + 30, this->labelText().getSizeY2D() + 10); 69 69 GLGuiWidget::resize(); 70 this->frontRect().setTopLeft(border Size(), borderSize());71 this->frontRect().setSize(this->getSizeX2D() - 2.0*borderSize(), this->getSizeY2D() -2.0*borderSize());70 this->frontRect().setTopLeft(borderLeft(), borderTop()); 71 this->frontRect().setSize(this->getSizeX2D() - (borderLeft() + borderRight()) , this->getSizeY2D() - (borderTop() + borderBottom())); 72 72 } 73 73 -
branches/gui/src/lib/gui/gl_gui/glgui_image.cc
r8035 r8115 75 75 void GLGuiImage::resize() 76 76 { 77 this->frontRect().setTopLeft(this->border Size(), this->borderSize());78 this->frontRect().setSize(this->getSizeX2D() - 2.0*this->borderSize(), this->getSizeY2D() - 2.0* this->borderSize() );77 this->frontRect().setTopLeft(this->borderLeft(), this->borderRight()); 78 this->frontRect().setSize(this->getSizeX2D() - (borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() + borderBottom()) ); 79 79 GLGuiWidget::resize(); 80 80 } -
branches/gui/src/lib/gui/gl_gui/glgui_inputline.cc
r8035 r8115 164 164 this->setSize2D( this->text.getSize2D() + Vector2D(8, 8)); 165 165 GLGuiWidget::resize(); 166 this->frontRect().setTopLeft(border Size(), borderSize());167 this->frontRect().setSize(this->getSize2D() - Vector2D(border Size(), borderSize()));166 this->frontRect().setTopLeft(borderLeft(), borderTop()); 167 this->frontRect().setSize(this->getSize2D() - Vector2D(borderRight(), borderBottom())); 168 168 } 169 169 -
branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc
r8035 r8115 45 45 void GLGuiPushButton::resize() 46 46 { 47 this->label .setRelCoor2D(5, 5);48 this->setSize2D(this->label .getSizeX2D() + 10, this->label.getSizeY2D() + 10);47 this->labelText().setRelCoor2D(5, 5); 48 this->setSize2D(this->labelText().getSizeX2D() + 10, this->labelText().getSizeY2D() + 10); 49 49 50 50 GLGuiWidget::resize(); … … 63 63 void GLGuiPushButton::receivedFocus() 64 64 { 65 printf("%s received focus\n", this-> getLabel().c_str());65 printf("%s received focus\n", this->label().c_str()); 66 66 GLGuiWidget::receivedFocus(); 67 67 } … … 69 69 void GLGuiPushButton::removedFocus() 70 70 { 71 printf("%s removed focus\n", this-> getLabel().c_str());71 printf("%s removed focus\n", this->label().c_str()); 72 72 GLGuiWidget::removedFocus(); 73 73 … … 76 76 void GLGuiPushButton::clicking(const Vector2D& pos) 77 77 { 78 printf("%s clicked\n", this-> getLabel().c_str());78 printf("%s clicked\n", this->label().c_str()); 79 79 GLGuiButton::clicking(pos); 80 80 } … … 83 83 void GLGuiPushButton::releasing(const Vector2D& pos) 84 84 { 85 printf("%s released\n", this-> getLabel().c_str());85 printf("%s released\n", this->label().c_str()); 86 86 GLGuiButton::releasing(pos); 87 87 } -
branches/gui/src/lib/gui/gl_gui/glgui_slider.cc
r8035 r8115 201 201 { 202 202 return (this->_value - this->_minValue)/( this->_maxValue - this->_minValue) * 203 (this->getSizeX2D() - 2.0*(borderSize() +_sliderWidth)) +204 (border Size() +_sliderWidth);203 (this->getSizeX2D() - (borderLeft() + borderRight() + 2.0*_sliderWidth)) + 204 (borderLeft() +_sliderWidth); 205 205 } 206 206 … … 211 211 float GLGuiSlider::sliderValue(float position) const 212 212 { 213 return (position - (border Size()+_sliderWidth)) / (this->getSizeX2D() - 2.0*(borderSize() +_sliderWidth))213 return (position - (borderLeft()+_sliderWidth)) / (this->getSizeX2D() - (borderLeft() + borderRight() + 2.0*_sliderWidth)) 214 214 *( this->_maxValue - this->_minValue) + 215 215 this->_minValue ; … … 231 231 this->drawRect(this->frontRect()); 232 232 233 this->drawRect(Rect2D(this->sliderPosition()-_sliderWidth/2.0, border Size(), _sliderWidth, this->getSizeY2D() - 2 * borderSize()));233 this->drawRect(Rect2D(this->sliderPosition()-_sliderWidth/2.0, borderLeft(), _sliderWidth, this->getSizeY2D() - (borderLeft() + borderRight()))); 234 234 235 235 this->endDraw(); -
branches/gui/src/lib/gui/gl_gui/glgui_widget.cc
r8035 r8115 68 68 this->_backMat.setDiffuse(1.0, 1.0, 1.0); 69 69 this->_frontMat.setDiffuse(1.0, 0.0, 0.0); 70 this->_borderSize = 1.0; 70 71 this->_borderLeft = 1.0; 72 this->_borderRight = 1.0; 73 this->_borderTop = 1.0; 74 this->_borderBottom = 1.0; 71 75 } 72 76 … … 114 118 void GLGuiWidget::setBorderSize(float borderSize) 115 119 { 116 this->_borderSize = borderSize; 117 this->resize(); 118 } 120 this->_borderLeft = borderSize; 121 this->_borderRight = borderSize; 122 this->_borderTop = borderSize; 123 this->_borderBottom = borderSize; 124 this->resize(); 125 } 126 127 void GLGuiWidget::setBorderLeft(float borderLeft) 128 { 129 this->_borderLeft = borderLeft; 130 this->resize(); 131 } 132 void GLGuiWidget::setBorderRight(float borderRight) 133 { 134 this->_borderRight = borderRight; 135 this->resize(); 136 } 137 void GLGuiWidget::setBorderTop(float borderTop) 138 { 139 this->_borderTop = borderTop; 140 this->resize(); 141 } 142 void GLGuiWidget::setBorderBottom(float borderBottom) 143 { 144 this->_borderBottom = borderBottom; 145 this->resize(); 146 } 147 119 148 120 149 … … 201 230 { 202 231 this->setVisibility(true); 232 this->showing(); 203 233 } 204 234 … … 207 237 { 208 238 this->setVisibility(false); 239 this->hiding(); 209 240 } 210 241 -
branches/gui/src/lib/gui/gl_gui/glgui_widget.h
r8035 r8115 87 87 const Rect2D& frontRect() const { return this->_frontRect; }; 88 88 89 float borderSize() const { return this->_borderSize; };89 /** @brief sets all borders to the same value. */ 90 90 void setBorderSize(float borderSize); 91 void setBorderLeft(float borderLeft); 92 void setBorderRight(float borderRight); 93 void setBorderTop(float borderTop); 94 void setBorderBottom(float borderBottom); 95 96 float borderLeft() const { return this->_borderLeft; }; 97 float borderRight() const { return this->_borderRight; }; 98 float borderTop() const { return this->_borderTop; }; 99 float borderBottom() const { return this->_borderBottom; }; 100 91 101 92 102 void setWidgetSize(const Vector2D& size); … … 117 127 virtual void resize(); 118 128 129 virtual void hiding() {}; 130 virtual void showing() {}; 119 131 // if something was clickt on the GUI-widget. 120 132 virtual void clicking(const Vector2D& pos); … … 143 155 Rect2D _frontRect; 144 156 145 float _borderSize; 157 float _borderLeft; 158 float _borderRight; 159 float _borderTop; 160 float _borderBottom; 146 161 147 162 /// EVENTS
Note: See TracChangeset
for help on using the changeset viewer.