aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCastagnaIT <gottardo.stefano.83@gmail.com>2022-04-09 10:00:48 +0200
committerCastagnaIT <gottardo.stefano.83@gmail.com>2022-04-09 10:00:48 +0200
commit4648c628e7fd75ead994e6f13914a3ea28ab5cac (patch)
treea046cd5f844149e871f5ed5c3264ae7e89ff7f6a
parentaef2f06df4f5f0c7bc093ca8ba80e7b06ec2c1ca (diff)
[cleanup] Grouped space vars to unnamed namespace
-rw-r--r--xbmc/guilib/GUISpinControl.cpp28
1 files changed, 16 insertions, 12 deletions
diff --git a/xbmc/guilib/GUISpinControl.cpp b/xbmc/guilib/GUISpinControl.cpp
index 80d93d4634..f0a0f3980b 100644
--- a/xbmc/guilib/GUISpinControl.cpp
+++ b/xbmc/guilib/GUISpinControl.cpp
@@ -17,6 +17,12 @@
#define SPIN_BUTTON_DOWN 1
#define SPIN_BUTTON_UP 2
+namespace
+{
+// Additional space between text and spin buttons
+constexpr float TEXT_SPACE = 5.0f;
+} // unnamed namespace
+
CGUISpinControl::CGUISpinControl(int parentID,
int controlID,
float posX,
@@ -474,16 +480,15 @@ void CGUISpinControl::Process(unsigned int currentTime, CDirtyRegionList &dirtyr
bool arrowsOnRight(0 != (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X)));
if (!arrowsOnRight)
{
- const float space = 5;
- changed |= m_imgspinDownFocus->SetPosition(m_posX + textWidth + space, m_posY);
- changed |= m_imgspinDown->SetPosition(m_posX + textWidth + space, m_posY);
- changed |= m_imgspinDownDisabled->SetPosition(m_posX + textWidth + space, m_posY);
- changed |= m_imgspinUpFocus->SetPosition(m_posX + textWidth + space + m_imgspinDown->GetWidth(),
- m_posY);
- changed |=
- m_imgspinUp->SetPosition(m_posX + textWidth + space + m_imgspinDown->GetWidth(), m_posY);
+ changed |= m_imgspinDownFocus->SetPosition(m_posX + textWidth + TEXT_SPACE, m_posY);
+ changed |= m_imgspinDown->SetPosition(m_posX + textWidth + TEXT_SPACE, m_posY);
+ changed |= m_imgspinDownDisabled->SetPosition(m_posX + textWidth + TEXT_SPACE, m_posY);
+ changed |= m_imgspinUpFocus->SetPosition(
+ m_posX + textWidth + TEXT_SPACE + m_imgspinDown->GetWidth(), m_posY);
+ changed |= m_imgspinUp->SetPosition(m_posX + textWidth + TEXT_SPACE + m_imgspinDown->GetWidth(),
+ m_posY);
changed |= m_imgspinUpDisabled->SetPosition(
- m_posX + textWidth + space + m_imgspinDownDisabled->GetWidth(), m_posY);
+ m_posX + textWidth + TEXT_SPACE + m_imgspinDownDisabled->GetWidth(), m_posY);
}
changed |= m_imgspinDownFocus->Process(currentTime);
@@ -504,15 +509,14 @@ void CGUISpinControl::Render()
{
if (m_label.GetLabelInfo().font)
{
- const float space = 5;
float textWidth = m_label.GetTextWidth() + 2 * m_label.GetLabelInfo().offsetX;
// Position the arrows
bool arrowsOnRight(0 != (m_label.GetLabelInfo().align & (XBFONT_RIGHT | XBFONT_CENTER_X)));
if (arrowsOnRight)
- RenderText(m_posX - space - textWidth, m_posY, textWidth, m_height);
+ RenderText(m_posX - TEXT_SPACE - textWidth, m_posY, textWidth, m_height);
else
- RenderText(m_posX + m_imgspinDown->GetWidth() + m_imgspinUp->GetWidth() + space, m_posY,
+ RenderText(m_posX + m_imgspinDown->GetWidth() + m_imgspinUp->GetWidth() + TEXT_SPACE, m_posY,
textWidth, m_height);
// set our hit rectangle for MouseOver events