[gui] fix incorrect parsing of relative <width> and <height> tags
[vuplus_xbmc] / xbmc / guilib / GUIMultiSelectText.h
1 #pragma once
2
3 /*
4  *      Copyright (C) 2005-2013 Team XBMC
5  *      http://xbmc.org
6  *
7  *  This Program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2, or (at your option)
10  *  any later version.
11  *
12  *  This Program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with XBMC; see the file COPYING.  If not, see
19  *  <http://www.gnu.org/licenses/>.
20  *
21  */
22
23 #include "GUIButtonControl.h"
24
25 /*!
26  \ingroup controls
27  \brief
28  */
29 class CGUIMultiSelectTextControl : public CGUIControl
30 {
31 public:
32   CGUIMultiSelectTextControl(int parentID, int controlID,
33                     float posX, float posY, float width, float height,
34                     const CTextureInfo& textureFocus, const CTextureInfo& textureNoFocus, const CLabelInfo &label, const CGUIInfoLabel &content);
35
36   virtual ~CGUIMultiSelectTextControl(void);
37   virtual CGUIMultiSelectTextControl *Clone() const { return new CGUIMultiSelectTextControl(*this); };
38
39   virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
40   virtual void Render();
41
42   virtual bool OnAction(const CAction &action);
43   virtual void OnLeft();
44   virtual void OnRight();
45   virtual bool HitTest(const CPoint &point) const;
46   virtual bool OnMouseOver(const CPoint &point);
47   virtual void UpdateInfo(const CGUIListItem *item = NULL);
48
49   virtual CStdString GetDescription() const;
50   virtual bool CanFocus() const;
51
52   void UpdateText(const CStdString &text);
53   bool MoveLeft();
54   bool MoveRight();
55   void SelectItemFromPoint(const CPoint &point);
56   unsigned int GetFocusedItem() const;
57   void SetFocusedItem(unsigned int item);
58
59   // overrides to allow all focus anims to translate down to the focus image
60   virtual void SetAnimations(const std::vector<CAnimation> &animations);
61   virtual void SetFocus(bool focus);
62 protected:
63   virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
64   virtual bool UpdateColors();
65   void AddString(const CStdString &text, bool selectable, const CStdString &clickAction = "");
66   void PositionButtons();
67   unsigned int GetNumSelectable() const;
68   int GetItemFromPoint(const CPoint &point) const;
69   void ScrollToItem(unsigned int item);
70
71   // the static strings and buttons strings
72   class CSelectableString
73   {
74   public:
75     CSelectableString(CGUIFont *font, const CStdString &text, bool selectable, const CStdString &clickAction);
76     CGUITextLayout m_text;
77     float m_length;
78     bool m_selectable;
79     CStdString m_clickAction;
80   };
81   std::vector<CSelectableString> m_items;
82
83   CLabelInfo m_label;
84   CGUIInfoLabel  m_info;
85   CStdString m_oldText;
86   unsigned int m_renderTime;
87
88   // scrolling
89   float        m_totalWidth;
90   float        m_offset;
91   float        m_scrollOffset;
92   float        m_scrollSpeed;
93   unsigned int m_scrollLastTime;
94
95   // buttons
96   CGUIButtonControl m_button;
97   unsigned int m_selectedItem;
98   std::vector<CGUIButtonControl> m_buttons;
99 };
100