Skip to content

Commit

Permalink
changed: Support <textureradioon> and <textureradiooff> rather than <…
Browse files Browse the repository at this point in the history
…textureradiofocus> and <textureradionofocus> as it better suggests what the textures represent.

git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/branches/linuxport/XBMC@23004 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
  • Loading branch information
jmarshallnz committed Sep 20, 2009
1 parent e630363 commit 3c3d584
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 30 deletions.
10 changes: 6 additions & 4 deletions guilib/GUIControlFactory.cpp
Expand Up @@ -591,7 +591,7 @@ CGUIControl* CGUIControlFactory::Create(DWORD dwParentId, const FRECT &rect, TiX
CTextureInfo textureCheckMark, textureCheckMarkNF;
CTextureInfo textureFocus, textureNoFocus;
CTextureInfo textureAltFocus, textureAltNoFocus;
CTextureInfo textureRadioFocus, textureRadioNoFocus;
CTextureInfo textureRadioOn, textureRadioOff;
CTextureInfo imageNoFocus, imageFocus;
CGUIInfoLabel texturePath;
FRECT borderSize = { 0, 0, 0, 0};
Expand Down Expand Up @@ -823,8 +823,10 @@ CGUIControl* CGUIControlFactory::Create(DWORD dwParentId, const FRECT &rect, TiX
GetFloat(pControlNode, "sliderheight", sliderHeight);
GetTexture(pControlNode, "texturecheckmark", textureCheckMark);
GetTexture(pControlNode, "texturecheckmarknofocus", textureCheckMarkNF);
GetTexture(pControlNode, "textureradiofocus", textureRadioFocus);
GetTexture(pControlNode, "textureradionofocus", textureRadioNoFocus);
GetTexture(pControlNode, "textureradiofocus", textureRadioOn); // backward compatibility
GetTexture(pControlNode, "textureradionofocus", textureRadioOff);
GetTexture(pControlNode, "textureradioon", textureRadioOn);
GetTexture(pControlNode, "textureradiooff", textureRadioOff);

GetTexture(pControlNode, "texturesliderbackground", textureBackground);
GetTexture(pControlNode, "texturesliderbar", textureBar);
Expand Down Expand Up @@ -1134,7 +1136,7 @@ CGUIControl* CGUIControlFactory::Create(DWORD dwParentId, const FRECT &rect, TiX
dwParentId, id, posX, posY, width, height,
textureFocus, textureNoFocus,
labelInfo,
textureRadioFocus, textureRadioNoFocus);
textureRadioOn, textureRadioOff);

((CGUIRadioButtonControl *)control)->SetLabel(strLabel);
((CGUIRadioButtonControl *)control)->SetRadioDimensions(radioPosX, radioPosY, radioWidth, radioHeight);
Expand Down
46 changes: 23 additions & 23 deletions guilib/GUIRadioButtonControl.cpp
Expand Up @@ -27,16 +27,16 @@
CGUIRadioButtonControl::CGUIRadioButtonControl(DWORD dwParentID, DWORD dwControlId, float posX, float posY, float width, float height,
const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus,
const CLabelInfo& labelInfo,
const CTextureInfo& radioFocus, const CTextureInfo& radioNoFocus)
const CTextureInfo& radioOn, const CTextureInfo& radioOff)
: CGUIButtonControl(dwParentID, dwControlId, posX, posY, width, height, textureFocus, textureNoFocus, labelInfo)
, m_imgRadioFocus(posX, posY, 16, 16, radioFocus)
, m_imgRadioNoFocus(posX, posY, 16, 16, radioNoFocus)
, m_imgRadioOn(posX, posY, 16, 16, radioOn)
, m_imgRadioOff(posX, posY, 16, 16, radioOff)
{
m_radioPosX = 0;
m_radioPosY = 0;
m_toggleSelect = 0;
m_imgRadioFocus.SetAspectRatio(CAspectRatio::AR_KEEP);\
m_imgRadioNoFocus.SetAspectRatio(CAspectRatio::AR_KEEP);
m_imgRadioOn.SetAspectRatio(CAspectRatio::AR_KEEP);\
m_imgRadioOff.SetAspectRatio(CAspectRatio::AR_KEEP);
ControlType = GUICONTROL_RADIO;
}

Expand All @@ -53,9 +53,9 @@ void CGUIRadioButtonControl::Render()
m_bSelected = g_infoManager.GetBool(m_toggleSelect, m_dwParentID);

if ( IsSelected() && !IsDisabled() )
m_imgRadioFocus.Render();
m_imgRadioOn.Render();
else
m_imgRadioNoFocus.Render();
m_imgRadioOff.Render();
}

bool CGUIRadioButtonControl::OnAction(const CAction &action)
Expand All @@ -75,33 +75,33 @@ bool CGUIRadioButtonControl::OnMessage(CGUIMessage& message)
void CGUIRadioButtonControl::AllocResources()
{
CGUIButtonControl::AllocResources();
m_imgRadioFocus.AllocResources();
m_imgRadioNoFocus.AllocResources();
m_imgRadioOn.AllocResources();
m_imgRadioOff.AllocResources();

SetPosition(m_posX, m_posY);
}

void CGUIRadioButtonControl::FreeResources()
{
CGUIButtonControl::FreeResources();
m_imgRadioFocus.FreeResources();
m_imgRadioNoFocus.FreeResources();
m_imgRadioOn.FreeResources();
m_imgRadioOff.FreeResources();
}

void CGUIRadioButtonControl::DynamicResourceAlloc(bool bOnOff)
{
CGUIControl::DynamicResourceAlloc(bOnOff);
m_imgRadioFocus.DynamicResourceAlloc(bOnOff);
m_imgRadioNoFocus.DynamicResourceAlloc(bOnOff);
m_imgRadioOn.DynamicResourceAlloc(bOnOff);
m_imgRadioOff.DynamicResourceAlloc(bOnOff);
}

void CGUIRadioButtonControl::SetPosition(float posX, float posY)
{
CGUIButtonControl::SetPosition(posX, posY);
float radioPosX = m_radioPosX ? m_posX + m_radioPosX : (m_posX + m_width - 8) - m_imgRadioFocus.GetWidth();
float radioPosY = m_radioPosY ? m_posY + m_radioPosY : m_posY + (m_height - m_imgRadioFocus.GetHeight()) / 2;
m_imgRadioFocus.SetPosition(radioPosX, radioPosY);
m_imgRadioNoFocus.SetPosition(radioPosX, radioPosY);
float radioPosX = m_radioPosX ? m_posX + m_radioPosX : (m_posX + m_width - 8) - m_imgRadioOn.GetWidth();
float radioPosY = m_radioPosY ? m_posY + m_radioPosY : m_posY + (m_height - m_imgRadioOn.GetHeight()) / 2;
m_imgRadioOn.SetPosition(radioPosX, radioPosY);
m_imgRadioOff.SetPosition(radioPosX, radioPosY);
}

void CGUIRadioButtonControl::SetRadioDimensions(float posX, float posY, float width, float height)
Expand All @@ -110,13 +110,13 @@ void CGUIRadioButtonControl::SetRadioDimensions(float posX, float posY, float wi
m_radioPosY = posY;
if (width)
{
m_imgRadioFocus.SetWidth(width);
m_imgRadioNoFocus.SetWidth(width);
m_imgRadioOn.SetWidth(width);
m_imgRadioOff.SetWidth(width);
}
if (height)
{
m_imgRadioFocus.SetHeight(height);
m_imgRadioNoFocus.SetHeight(height);
m_imgRadioOn.SetHeight(height);
m_imgRadioOff.SetHeight(height);
}
SetPosition(GetXPosition(), GetYPosition());
}
Expand Down Expand Up @@ -146,7 +146,7 @@ CStdString CGUIRadioButtonControl::GetDescription() const
void CGUIRadioButtonControl::UpdateColors()
{
CGUIButtonControl::UpdateColors();
m_imgRadioFocus.SetDiffuseColor(m_diffuseColor);
m_imgRadioNoFocus.SetDiffuseColor(m_diffuseColor);
m_imgRadioOn.SetDiffuseColor(m_diffuseColor);
m_imgRadioOff.SetDiffuseColor(m_diffuseColor);
}

6 changes: 3 additions & 3 deletions guilib/GUIRadioButtonControl.h
Expand Up @@ -40,7 +40,7 @@ class CGUIRadioButtonControl :
float posX, float posY, float width, float height,
const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus,
const CLabelInfo& labelInfo,
const CTextureInfo& radioFocus, const CTextureInfo& radioNoFocus);
const CTextureInfo& radioOn, const CTextureInfo& radioOff);

virtual ~CGUIRadioButtonControl(void);
virtual CGUIRadioButtonControl *Clone() const { return new CGUIRadioButtonControl(*this); };
Expand All @@ -60,8 +60,8 @@ class CGUIRadioButtonControl :
bool IsSelected() const { return m_bSelected; };
protected:
virtual void UpdateColors();
CGUITexture m_imgRadioFocus;
CGUITexture m_imgRadioNoFocus;
CGUITexture m_imgRadioOn;
CGUITexture m_imgRadioOff;
float m_radioPosX;
float m_radioPosY;
int m_toggleSelect;
Expand Down

0 comments on commit 3c3d584

Please sign in to comment.