Permalink
Browse files

fix hardcoded spincontrolex right label alignment

  • Loading branch information...
1 parent fa7e418 commit 9d1360fc66f77fff392cb445e89e28365ab0745b Jonathan Marshall committed Nov 1, 2012
@@ -461,19 +461,19 @@ void CGUISpinControl::Render()
bool arrowsOnRight(0 != (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X)));
if (arrowsOnRight)
- RenderText(m_posX - space - textWidth, textWidth);
+ RenderText(m_posX - space - textWidth, m_posY, textWidth, m_height);
else
- RenderText(m_posX + m_imgspinDown.GetWidth() + m_imgspinUp.GetWidth() + space, textWidth);
+ RenderText(m_posX + m_imgspinDown.GetWidth() + m_imgspinUp.GetWidth() + space, m_posY, textWidth, m_height);
// set our hit rectangle for MouseOver events
m_hitRect = m_label.GetRenderRect();
}
CGUIControl::Render();
}
-void CGUISpinControl::RenderText(float posX, float width)
+void CGUISpinControl::RenderText(float posX, float posY, float width, float height)
{
- m_label.SetMaxRect(posX, m_posY, width, m_height);
+ m_label.SetMaxRect(posX, posY, width, height);
m_label.SetColor(GetTextColor());
m_label.Render();
}
@@ -92,9 +92,11 @@ class CGUISpinControl : public CGUIControl
virtual bool UpdateColors();
/*! \brief Render the spinner text
\param posX position of the left edge of the text
+ \param posY positing of the top edge of the text
\param width width of the text
+ \param height height of the text
*/
- virtual void RenderText(float posX, float width);
+ virtual void RenderText(float posX, float posY, float width, float height);
CGUILabel::COLOR GetTextColor() const;
void PageUp();
void PageDown();
@@ -148,11 +148,11 @@ void CGUISpinControlEx::SetSpinPosition(float spinPosX)
SetPosition(m_buttonControl.GetXPosition(), m_buttonControl.GetYPosition());
}
-void CGUISpinControlEx::RenderText(float posX, float width)
+void CGUISpinControlEx::RenderText(float posX, float posY, float width, float height)
{
const float spaceWidth = 10;
// check our limits from the button control
float x = std::max(m_buttonControl.m_label.GetRenderRect().x2 + spaceWidth, posX);
m_label.SetScrolling(HasFocus());
- CGUISpinControl::RenderText(x, width + posX - x);
+ CGUISpinControl::RenderText(x, m_buttonControl.GetYPosition(), width + posX - x, m_buttonControl.GetHeight());
}
@@ -64,7 +64,7 @@ class CGUISpinControlEx : public CGUISpinControl
void SetItemInvalid(bool invalid);
protected:
- virtual void RenderText(float posX, float width);
+ virtual void RenderText(float posX, float posY, float width, float height);
virtual bool UpdateColors();
CGUIButtonControl m_buttonControl;
float m_spinPosX;

0 comments on commit 9d1360f

Please sign in to comment.