aboutsummaryrefslogtreecommitdiff
path: root/guilib/GUISettingsSliderControl.cpp
diff options
context:
space:
mode:
authorAlTheKiller <AlTheKiller@svn>2009-09-23 01:49:50 +0000
committerAlTheKiller <AlTheKiller@svn>2009-09-23 01:49:50 +0000
commit45285e8a9300cd754a760560640b75b09f98035e (patch)
treead9f093885ad5c98e9dd4156674e7691c22ed0a2 /guilib/GUISettingsSliderControl.cpp
step 3/4: Move linuxport to trunk. How'd I get roped into this?
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@23097 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUISettingsSliderControl.cpp')
-rw-r--r--guilib/GUISettingsSliderControl.cpp116
1 files changed, 116 insertions, 0 deletions
diff --git a/guilib/GUISettingsSliderControl.cpp b/guilib/GUISettingsSliderControl.cpp
new file mode 100644
index 0000000000..c6f0e3206a
--- /dev/null
+++ b/guilib/GUISettingsSliderControl.cpp
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2005-2008 Team XBMC
+ * http://www.xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, write to
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ */
+
+#include "GUISettingsSliderControl.h"
+
+CGUISettingsSliderControl::CGUISettingsSliderControl(int parentID, int controlID, float posX, float posY, float width, float height, float sliderWidth, float sliderHeight, const CTextureInfo &textureFocus, const CTextureInfo &textureNoFocus, const CTextureInfo& backGroundTexture, const CTextureInfo& nibTexture, const CTextureInfo& nibTextureFocus, const CLabelInfo &labelInfo, int iType)
+ : CGUISliderControl(parentID, controlID, posX, posY, sliderWidth, sliderHeight, backGroundTexture, nibTexture,nibTextureFocus, iType)
+ , m_buttonControl(parentID, controlID, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo)
+ , m_textLayout(labelInfo.font, false)
+{
+ ControlType = GUICONTROL_SETTINGS_SLIDER;
+}
+
+CGUISettingsSliderControl::~CGUISettingsSliderControl(void)
+{
+}
+
+
+void CGUISettingsSliderControl::Render()
+{
+ if (IsDisabled()) return ;
+
+ // make sure the button has focus if it should have...
+ m_buttonControl.SetFocus(HasFocus());
+ m_buttonControl.SetPulseOnSelect(m_pulseOnSelect);
+ m_buttonControl.Render();
+ CGUISliderControl::Render();
+
+ // now render our text
+ m_textLayout.Update(CGUISliderControl::GetDescription());
+
+ float posX = m_posX - m_buttonControl.GetLabelInfo().offsetX;
+ float posY = GetYPosition() + GetHeight() * 0.5f;
+ if (HasFocus() && m_buttonControl.GetLabelInfo().focusedColor)
+ m_textLayout.Render(posX, posY, 0, m_buttonControl.GetLabelInfo().focusedColor, m_buttonControl.GetLabelInfo().shadowColor, XBFONT_CENTER_Y | XBFONT_RIGHT, 0);
+ else
+ m_textLayout.Render(posX, posY, 0, m_buttonControl.GetLabelInfo().textColor, m_buttonControl.GetLabelInfo().shadowColor, XBFONT_CENTER_Y | XBFONT_RIGHT, 0);
+}
+
+bool CGUISettingsSliderControl::OnAction(const CAction &action)
+{
+ return CGUISliderControl::OnAction(action);
+}
+
+void CGUISettingsSliderControl::FreeResources()
+{
+ CGUISliderControl::FreeResources();
+ m_buttonControl.FreeResources();
+}
+
+void CGUISettingsSliderControl::DynamicResourceAlloc(bool bOnOff)
+{
+ CGUISliderControl::DynamicResourceAlloc(bOnOff);
+ m_buttonControl.DynamicResourceAlloc(bOnOff);
+}
+
+void CGUISettingsSliderControl::AllocResources()
+{
+ CGUISliderControl::AllocResources();
+ m_buttonControl.AllocResources();
+}
+
+void CGUISettingsSliderControl::SetPosition(float posX, float posY)
+{
+ m_buttonControl.SetPosition(posX, posY);
+ float sliderPosX = posX + m_buttonControl.GetWidth() - m_width - m_buttonControl.GetLabelInfo().offsetX;
+ float sliderPosY = posY + (m_buttonControl.GetHeight() - m_height) * 0.5f;
+ CGUISliderControl::SetPosition(sliderPosX, sliderPosY);
+}
+
+void CGUISettingsSliderControl::SetWidth(float width)
+{
+ m_buttonControl.SetWidth(width);
+ SetPosition(GetXPosition(), GetYPosition());
+}
+
+void CGUISettingsSliderControl::SetHeight(float height)
+{
+ m_buttonControl.SetHeight(height);
+ SetPosition(GetXPosition(), GetYPosition());
+}
+
+void CGUISettingsSliderControl::SetEnabled(bool bEnable)
+{
+ CGUISliderControl::SetEnabled(bEnable);
+ m_buttonControl.SetEnabled(bEnable);
+}
+
+CStdString CGUISettingsSliderControl::GetDescription() const
+{
+ return m_buttonControl.GetDescription() + " " + CGUISliderControl::GetDescription();
+}
+
+void CGUISettingsSliderControl::UpdateColors()
+{
+ m_buttonControl.UpdateColors();
+ CGUISliderControl::UpdateColors();
+}