- Timestamp:
- Jun 19, 2006, 2:32:23 PM (18 years ago)
- Location:
- branches/gui/src/lib/gui/gl
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl/glgui_box.cc
r8450 r8584 110 110 if (orientation() == OrxGui::Vertical) 111 111 { 112 float height = this->borderTop();112 float height = style().borderTop(); 113 113 float width = 0.0f; 114 114 std::vector<GLGuiWidget*>::iterator widget; … … 117 117 for (widget = this->children.begin(); widget != this->children.end(); ++widget) 118 118 { 119 (*widget)->setRelCoor2D( this->borderLeft(), height);119 (*widget)->setRelCoor2D(style().borderLeft(), height); 120 120 height += (*widget)->getSizeY2D(); 121 121 width = fmax(width, (*widget)->getSizeX2D()); 122 122 } 123 123 124 width += this->borderLeft() + this->borderRight();125 height += this->borderBottom(); /* *2 done further up */124 width += style().borderLeft() + style().borderRight(); 125 height += style().borderBottom(); /* *2 done further up */ 126 126 127 127 printf("%f %f\n", width, height); … … 130 130 else 131 131 { 132 float height = this->borderTop();133 float width = this->borderLeft();132 float height = style().borderTop(); 133 float width = style().borderLeft(); 134 134 std::vector<GLGuiWidget*>::iterator widget; 135 135 … … 137 137 for (widget = this->children.begin(); widget != this->children.end(); ++widget) 138 138 { 139 (*widget)->setRelCoor2D(width, this->borderTop());139 (*widget)->setRelCoor2D(width, style().borderTop()); 140 140 height = fmax(height, (*widget)->getSizeY2D()); 141 141 width += (*widget)->getSizeX2D(); 142 142 } 143 143 144 width += this->borderRight() ;145 height += this->borderBottom(); /* *2 done further up */144 width += style().borderRight() ; 145 height += style().borderBottom(); /* *2 done further up */ 146 146 147 147 printf("%f %f\n", width, height); -
branches/gui/src/lib/gui/gl/glgui_button.cc
r8583 r8584 55 55 56 56 this->_label.setFont("fonts/final_frontier.ttf", 20); 57 this->_label.setColor(this-> foregroundColor() );57 this->_label.setColor(this->style().foregroundColor() ); 58 58 59 59 this->_label.setParent2D(this); … … 71 71 void GLGuiButton::updateFrontColor() 72 72 { 73 this->_label.setColor(this-> foregroundColor());73 this->_label.setColor(this->style().foregroundColor()); 74 74 } 75 75 -
branches/gui/src/lib/gui/gl/glgui_checkbutton.cc
r8583 r8584 66 66 { 67 67 68 this->labelText().setRelCoor2D( borderLeft() + 15.0,borderTop() + 5);69 this->setSize2D(this->labelText().getSizeX2D() + 15.0 + borderLeft() + borderRight(), this->labelText().getSizeY2D() + 10 + borderTop()+borderBottom());68 this->labelText().setRelCoor2D( style().borderLeft() + 15.0, style().borderTop() + 5); 69 this->setSize2D(this->labelText().getSizeX2D() + 15.0 + style().borderLeft() + style().borderRight(), this->labelText().getSizeY2D() + 10 + style().borderTop()+style().borderBottom()); 70 70 GLGuiWidget::resize(); 71 71 72 72 this->_checkBox.setSize(10.0, 10.0); 73 this->_checkBox.setCenter( borderLeft() + _checkBox.height()/2.0, borderTop() + (this->getSizeY2D() - borderTop() -borderBottom()) / 2.0);73 this->_checkBox.setCenter( style().borderLeft() + _checkBox.height()/2.0, style().borderTop() + (this->getSizeY2D() - style().borderTop() - style().borderBottom()) / 2.0); 74 74 75 75 /* this->frontRect().setTopLeft(borderLeft(), borderTop()); … … 99 99 if (this->bActive) 100 100 { 101 glColor3fv( &this-> foregroundColor()[0]);101 glColor3fv( &this->style().foregroundColor()[0]); 102 102 this->drawRect(this->_checkBox); 103 103 … … 124 124 else 125 125 { 126 glColor3fv( &this-> foregroundColor()[0]);126 glColor3fv( &this->style().foregroundColor()[0]); 127 127 this->drawRect(this->_checkBox); 128 128 } -
branches/gui/src/lib/gui/gl/glgui_cursor.cc
r8583 r8584 126 126 this->beginDraw(); 127 127 128 this-> background().select();128 this->style().background().select(); 129 129 if (!this->seq.empty()) 130 130 glBindTexture(GL_TEXTURE_2D, this->seq.getFrameTexture((int)frameNumber)); -
branches/gui/src/lib/gui/gl/glgui_image.cc
r8583 r8584 76 76 void GLGuiImage::updateFrontColor() 77 77 { 78 this->_imageMaterial.setDiffuseColor( this->foregroundColor());78 this->_imageMaterial.setDiffuseColor(style().foregroundColor()); 79 79 } 80 80 81 81 void GLGuiImage::resize() 82 82 { 83 this->_imagePlane.setTopLeft( this->borderLeft(), this->borderTop());84 this->_imagePlane.setSize(this->getSizeX2D() - ( borderLeft() + borderRight()), this->getSizeY2D() - (borderTop() +borderBottom()) );83 this->_imagePlane.setTopLeft(style().borderLeft(), style().borderTop()); 84 this->_imagePlane.setSize(this->getSizeX2D() - (style().borderLeft() + style().borderRight()), this->getSizeY2D() - (style().borderTop() + style().borderBottom()) ); 85 85 GLGuiWidget::resize(); 86 86 } -
branches/gui/src/lib/gui/gl/glgui_inputline.cc
r8583 r8584 54 54 this->_text.setLineWidth(400); 55 55 this->_text.setDotsPosition(LimitedWidthText::Begin); 56 this->_text.setColor( this->foregroundColor());56 this->_text.setColor(style().foregroundColor()); 57 57 this->_text.setVisibility(false); 58 58 this->resize(); … … 203 203 void GLGuiInputLine::resize() 204 204 { 205 this->_text.setRelCoor2D( this->borderLeft(), this->borderTop());206 this->setSize2D( this->_text.getSize2D() + Vector2D( borderLeft() + borderRight(), borderTop() +borderBottom()));205 this->_text.setRelCoor2D(style().borderLeft(), style().borderTop()); 206 this->setSize2D( this->_text.getSize2D() + Vector2D(style().borderLeft() + style().borderRight(), style().borderTop() + style().borderBottom())); 207 207 GLGuiWidget::resize(); 208 208 /* this->frontRect().setTopLeft(borderLeft(), borderTop()); … … 212 212 void GLGuiInputLine::updateFrontColor() 213 213 { 214 this->_text.setColor( this->foregroundColor());214 this->_text.setColor(style().foregroundColor()); 215 215 } 216 216 -
branches/gui/src/lib/gui/gl/glgui_pushbutton.cc
r8448 r8584 45 45 void GLGuiPushButton::resize() 46 46 { 47 this->labelText().setRelCoor2D( borderLeft(),borderTop());48 this->setSize2D(this->labelText().getSizeX2D() + borderLeft() + borderRight(), this->labelText().getSizeY2D() + borderTop() +borderBottom() );47 this->labelText().setRelCoor2D(style().borderLeft(), style().borderTop()); 48 this->setSize2D(this->labelText().getSizeX2D() + style().borderLeft() + style().borderRight(), this->labelText().getSizeY2D() + style().borderTop() + style().borderBottom() ); 49 49 50 50 GLGuiWidget::resize(); -
branches/gui/src/lib/gui/gl/glgui_slider.cc
r8583 r8584 74 74 else 75 75 this->_value = value; 76 this->_handle.setCenter(this->sliderPosition(), this->borderTop() + (this->getSizeY2D() - this->borderTop() -borderBottom()) / 2.0);76 this->_handle.setCenter(this->sliderPosition(), style().borderTop() + (this->getSizeY2D() - style().borderTop() - style().borderBottom()) / 2.0); 77 77 78 78 emit(valueChanged(this->_value)); … … 165 165 // this->frontRect().setTopLeft(this->borderLeft(), this->getSizeY2D()/2.0 - 2.0); 166 166 // this->frontRect().setSize(this->getSizeX2D() - borderLeft() - borderRight(), 4.0); 167 this->_slider.setTopLeft( this->borderLeft(), this->getSizeY2D() / 2.0 -2.0);168 this->_slider.setSize(this->getSizeX2D() - borderLeft() -borderRight(), 4.0);169 this->_handle.setSize(this->_sliderWidth, this->getSizeY2D() - borderTop() -borderBottom());167 this->_slider.setTopLeft(style().borderLeft(), this->getSizeY2D() / 2.0 -2.0); 168 this->_slider.setSize(this->getSizeX2D() - style().borderLeft() - style().borderRight(), 4.0); 169 this->_handle.setSize(this->_sliderWidth, this->getSizeY2D() - style().borderTop() - style().borderBottom()); 170 170 } 171 171 … … 211 211 { 212 212 return (this->_value - this->_minValue)/( this->_maxValue - this->_minValue) * 213 (this->getSizeX2D() - (borderLeft() +borderRight() + 2.0*_sliderWidth)) +214 (borderLeft() +_sliderWidth);213 (this->getSizeX2D() - (style().borderLeft() + style().borderRight() + 2.0*_sliderWidth)) + 214 (style().borderLeft() +_sliderWidth); 215 215 } 216 216 … … 221 221 float GLGuiSlider::sliderValue(float position) const 222 222 { 223 return (position - ( borderLeft()+_sliderWidth)) / (this->getSizeX2D() - (borderLeft() +borderRight() + 2.0*_sliderWidth))223 return (position - (style().borderLeft()+_sliderWidth)) / (this->getSizeX2D() - (style().borderLeft() + style().borderRight() + 2.0*_sliderWidth)) 224 224 *( this->_maxValue - this->_minValue) + 225 225 this->_minValue ; … … 239 239 GLGuiWidget::draw(); 240 240 241 glColor4fv(&this-> foregroundColor()[0]);241 glColor4fv(&this->style().foregroundColor()[0]); 242 242 this->drawRect(this->_slider); 243 243 this->drawRect(this->_handle); -
branches/gui/src/lib/gui/gl/glgui_style.cc
r8582 r8584 31 31 { 32 32 _font = NULL; 33 this->_currentState = OrxGui::Normal; 34 this->_animationCycle = -1.0; 35 this->_animationDuration = 1.0; 36 37 /// current-style 38 this->_currentStyle._borderLeft = 1.0; 39 this->_currentStyle._borderRight = 1.0; 40 this->_currentStyle._borderTop = 1.0; 41 this->_currentStyle._borderBottom = 1.0; 42 this->_currentStyle._textSize = 20.0; 43 33 44 this->reset(); 34 45 -
branches/gui/src/lib/gui/gl/glgui_style.h
r8583 r8584 25 25 virtual ~GLGuiStyle(); 26 26 27 //////////////////////////////// 28 /// Retrieve Current Values. /// 29 //////////////////////////////// 30 /** @returns current left borderWidth */ 31 inline float borderLeft() const { return _currentStyle._borderLeft; } 32 /** @returns current right borderWidth */ 33 inline float borderRight() const { return _currentStyle._borderRight; } 34 /** @returns current top borderWidth */ 35 inline float borderTop() const { return _currentStyle._borderTop; } 36 /** @returns burrent bottom borderWidth */ 37 inline float borderBottom() const { return _currentStyle._borderBottom; } 27 38 28 /// Retrieve (ALL THESE FUNCTIONS ARE AGAIN IN THE GLGUI-WIDGET FOR EASY RETRIEVAL)29 /** @returns left borderWidth @param state the State to retrieve from */30 inline float borderLeft(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._borderLeft; }31 /** @returns right borderWidth @param state the State to retrieve from */32 inline float borderRight(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._borderRight; }33 /** @returns top borderWidth @param state the State to retrieve from */34 inline float borderTop(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._borderTop; }35 /** @returns bottom borderWidth @param state the State to retrieve from */36 inline float borderBottom(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._borderBottom; }37 39 38 /** @returns textSize @param state the State to retrieve from */ 39 inline float textSize(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._textSize; } 40 /** @returns the Background Color @param state the State to retrieve from */ 41 inline const Color& backgroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._background.diffuseColor(); } 42 /** @returns the Background Material. @param state the state to retrieve from */ 43 inline const Material& background(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._background; } 44 /** @returns background Texture. @param state the State to retrieve from */ 45 inline const Texture& backgroundTexture(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._background.diffuseTexture(); } 46 /** @returns the foreground Color @param state the State to retrieve from */ 47 inline const Color& foregroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._foreground.diffuseColor(); } 48 /** @returns the ForeGroung Material. @param state the state to retrieve from */ 49 inline const Material& foreground(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._foreground; } 40 /** @returns current textSize */ 41 inline float textSize() const { return _currentStyle._textSize; } 42 /** @returns the Background Color */ 43 inline const Color& backgroundColor() const { return _currentStyle._background.diffuseColor(); } 44 /** @returns the current Background Material. */ 45 inline const Material& background() const { return _currentStyle._background; } 46 /** @returns the current background Texture. */ 47 inline const Texture& backgroundTexture() const { return _currentStyle._background.diffuseTexture(); } 48 /** @returns the current foreground Color */ 49 inline const Color& foregroundColor() const { return _currentStyle._foreground.diffuseColor(); } 50 /** @returns the current ForeGroung Material. */ 51 inline const Material& foreground() const { return _currentStyle._foreground; } 52 50 53 51 54 /** @returns FeaturePosition */ … … 58 61 inline bool animatedStateChanges() const { return _animatedStateChanges; } 59 62 63 64 /////////////////////////////////////////////////////////////// 65 /// Retrieve Values for the Saved Values inside the States. /// 66 /////////////////////////////////////////////////////////////// 67 /** @returns left borderWidth @param state the State to retrieve from */ 68 inline float borderLeft(OrxGui::State state) const { return _style[state]._borderLeft; } 69 /** @returns right borderWidth @param state the State to retrieve from */ 70 inline float borderRight(OrxGui::State state) const { return _style[state]._borderRight; } 71 /** @returns top borderWidth @param state the State to retrieve from */ 72 inline float borderTop(OrxGui::State state) const { return _style[state]._borderTop; } 73 /** @returns bottom borderWidth @param state the State to retrieve from */ 74 inline float borderBottom(OrxGui::State state) const { return _style[state]._borderBottom; } 75 76 /** @returns textSize @param state the State to retrieve from */ 77 inline float textSize(OrxGui::State state) const { return _style[state]._textSize; } 78 /** @returns the Background Color @param state the State to retrieve from */ 79 inline const Color& backgroundColor(OrxGui::State state) const { return _style[state]._background.diffuseColor(); } 80 /** @returns the Background Material. @param state the state to retrieve from */ 81 inline const Material& background(OrxGui::State state) const { return _style[state]._background; } 82 /** @returns background Texture. @param state the State to retrieve from */ 83 inline const Texture& backgroundTexture(OrxGui::State state) const { return _style[state]._background.diffuseTexture(); } 84 /** @returns the foreground Color @param state the State to retrieve from */ 85 inline const Color& foregroundColor(OrxGui::State state) const { return _style[state]._foreground.diffuseColor(); } 86 /** @returns the ForeGroung Material. @param state the state to retrieve from */ 87 inline const Material& foreground(OrxGui::State state) const { return _style[state]._foreground; } 60 88 61 89 … … 121 149 void setAnimatedStateChanges(bool animated); 122 150 151 152 void tick(float dt); 153 void switchState(OrxGui::State state); 154 155 123 156 private: 124 157 bool getState(const std::string& stateName, OrxGui::State* state); … … 147 180 148 181 182 /// ANIMATION STUFF: 149 183 bool _animated; //!< If the Widget is animated (Texture might be an AnimatedTexture.) 150 184 bool _animatedStateChanges; //!< If the Transitions between States are Animated automatically. 185 186 float _animationCycle; 187 float _animationDuration; 188 StatedStyle _currentStyle; 189 OrxGui::State _currentState; 151 190 }; 152 191 } -
branches/gui/src/lib/gui/gl/glgui_widget.cc
r8583 r8584 250 250 void GLGuiWidget::draw() const 251 251 { 252 this-> background().select();252 this->style().background().select(); 253 253 this->drawRect(this->backRect()); 254 this-> background().unselect();254 this->style().background().unselect(); 255 255 } 256 256 -
branches/gui/src/lib/gui/gl/glgui_widget.h
r8583 r8584 70 70 GLGuiStyle& style() { return this->_style; }; 71 71 const GLGuiStyle style() const { return this->_style; }; 72 73 74 /// STYLE-CONNECTION75 /** @returns left borderWidth */76 inline float borderLeft() const { return _style.borderLeft(_state); }77 /** @returns right borderWidth */78 inline float borderRight() const { return _style.borderRight(_state); }79 /** @returns top borderWidth */80 inline float borderTop() const { return _style.borderTop(_state); }81 /** @returns bottom borderWidth */82 inline float borderBottom() const { return _style.borderBottom(_state); }83 84 /** @returns textSize */85 inline float textSize() const { return _style.textSize(_state); }86 /** @returns the Background Color */87 inline const Color& backgroundColor() const { return _style.backgroundColor(_state); }88 /** @returns background Texture. */89 inline const Texture& backgroundTexture() const { return _style.backgroundTexture(_state); };90 /** @returns the Background Material. */91 inline const Material& background() const { return _style.background(_state); }92 /** @returns the foreground Color */93 inline const Color& foregroundColor() const { return _style.foregroundColor(_state); }94 /** @returns the ForeGroung Material. */95 inline const Material& foreground() const { return _style.foreground(_state); }96 97 /** @returns FeaturePosition */98 inline FeaturePosition featurePosition() const { return _style.featurePosition(); }99 /** @returns the font */100 inline const Font* const font() const { return _style.font(); }101 /** @returns true if the Element is Animated */102 inline bool animated() const { return _style.animated(); }103 /** @returns true if State-Changes are animated */104 inline bool animatedStateChanges() const { return _style.animatedStateChanges(); }105 106 107 72 108 73 Rect2D& backRect() { return this->_backRect; }; -
branches/gui/src/lib/gui/gl/specials/glgui_notifier.cc
r8583 r8584 200 200 this->beginDraw(); 201 201 202 this-> background().select();202 this->style().background().select(); 203 203 this->drawRect(this->backRect()); 204 204 this->endDraw(); … … 216 216 Vector2D GLGuiNotifier::calculateLinePosition(unsigned int lineNumber) 217 217 { 218 return Vector2D(0.0f, (float)( this->style().textSize() + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1));218 return Vector2D(0.0f, (float)(style().textSize() + this->lineSpacing)*(float)((int)this->bufferDisplaySize - (int)lineNumber - (int)1)); 219 219 } 220 220
Note: See TracChangeset
for help on using the changeset viewer.