aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmarshallnz <jmarshallnz@svn>2009-11-08 08:44:48 +0000
committerjmarshallnz <jmarshallnz@svn>2009-11-08 08:44:48 +0000
commitae0990e3b7832242359169178b169464f939809d (patch)
tree59348516e6e9399ae8a726dfab1f25ca5d9b0a6c
parent0c075a92fb5e2a9b6855508eca3fb3e7a1dcd733 (diff)
added: <scrolltime> to the grouplist control.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@24414 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
-rw-r--r--guilib/GUIControlFactory.cpp2
-rw-r--r--guilib/GUIControlGroupList.cpp13
-rw-r--r--guilib/GUIControlGroupList.h3
3 files changed, 9 insertions, 9 deletions
diff --git a/guilib/GUIControlFactory.cpp b/guilib/GUIControlFactory.cpp
index 9eb3ef03e5..26ded2d04b 100644
--- a/guilib/GUIControlFactory.cpp
+++ b/guilib/GUIControlFactory.cpp
@@ -1031,7 +1031,7 @@ CGUIControl* CGUIControlFactory::Create(int parentID, const CRect &rect, TiXmlEl
else if (strType == "grouplist")
{
control = new CGUIControlGroupList(
- parentID, id, posX, posY, width, height, buttonGap, pageControl, orientation, useControlCoords, labelInfo.align);
+ parentID, id, posX, posY, width, height, buttonGap, pageControl, orientation, useControlCoords, labelInfo.align, scrollTime);
((CGUIControlGroup *)control)->SetRenderFocusedLast(renderFocusedLast);
}
else if (strType == "label")
diff --git a/guilib/GUIControlGroupList.cpp b/guilib/GUIControlGroupList.cpp
index bb37d56e34..f74b27eedc 100644
--- a/guilib/GUIControlGroupList.cpp
+++ b/guilib/GUIControlGroupList.cpp
@@ -23,9 +23,7 @@
#include "utils/GUIInfoManager.h"
#include "GUIControlProfiler.h"
-#define TIME_TO_SCROLL 200;
-
-CGUIControlGroupList::CGUIControlGroupList(int parentID, int controlID, float posX, float posY, float width, float height, float itemGap, int pageControl, ORIENTATION orientation, bool useControlPositions, uint32_t alignment)
+CGUIControlGroupList::CGUIControlGroupList(int parentID, int controlID, float posX, float posY, float width, float height, float itemGap, int pageControl, ORIENTATION orientation, bool useControlPositions, uint32_t alignment, unsigned int scrollTime)
: CGUIControlGroup(parentID, controlID, posX, posY, width, height)
{
m_itemGap = itemGap;
@@ -36,7 +34,8 @@ CGUIControlGroupList::CGUIControlGroupList(int parentID, int controlID, float po
m_alignment = alignment;
m_scrollOffset = 0;
m_scrollSpeed = 0;
- m_scrollTime = 0;
+ m_scrollLastTime = 0;
+ m_scrollTime = scrollTime ? scrollTime : 1;
m_renderTime = 0;
m_useControlPositions = useControlPositions;
ControlType = GUICONTROL_GROUPLIST;
@@ -50,7 +49,7 @@ void CGUIControlGroupList::Render()
{
if (m_scrollSpeed != 0)
{
- m_offset += m_scrollSpeed * (m_renderTime - m_scrollTime);
+ m_offset += m_scrollSpeed * (m_renderTime - m_scrollLastTime);
if ((m_scrollSpeed < 0 && m_offset < m_scrollOffset) ||
(m_scrollSpeed > 0 && m_offset > m_scrollOffset))
{
@@ -58,7 +57,7 @@ void CGUIControlGroupList::Render()
m_scrollSpeed = 0;
}
}
- m_scrollTime = m_renderTime;
+ m_scrollLastTime = m_renderTime;
// first we update visibility of all our items, to ensure our size and
// alignment computations are correct.
@@ -309,7 +308,7 @@ inline float CGUIControlGroupList::Size() const
void CGUIControlGroupList::ScrollTo(float offset)
{
m_scrollOffset = offset;
- m_scrollSpeed = (m_scrollOffset - m_offset) / TIME_TO_SCROLL;
+ m_scrollSpeed = (m_scrollOffset - m_offset) / m_scrollTime;
}
bool CGUIControlGroupList::CanFocusFromPoint(const CPoint &point, CGUIControl **control, CPoint &controlPoint) const
diff --git a/guilib/GUIControlGroupList.h b/guilib/GUIControlGroupList.h
index 78a8dbc645..90ccc45569 100644
--- a/guilib/GUIControlGroupList.h
+++ b/guilib/GUIControlGroupList.h
@@ -35,7 +35,7 @@
class CGUIControlGroupList : public CGUIControlGroup
{
public:
- CGUIControlGroupList(int parentID, int controlID, float posX, float posY, float width, float height, float itemGap, int pageControl, ORIENTATION orientation, bool useControlPositions, uint32_t alignment);
+ CGUIControlGroupList(int parentID, int controlID, float posX, float posY, float width, float height, float itemGap, int pageControl, ORIENTATION orientation, bool useControlPositions, uint32_t alignment, unsigned int scrollTime);
virtual ~CGUIControlGroupList(void);
virtual CGUIControlGroupList *Clone() const { return new CGUIControlGroupList(*this); };
@@ -65,6 +65,7 @@ protected:
float m_scrollSpeed;
float m_scrollOffset;
+ unsigned int m_scrollLastTime;
unsigned int m_scrollTime;
bool m_useControlPositions;