4 * Copyright (C) 2005-2013 Team XBMC
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)
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.
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/>.
23 #include "GUIButtonControl.h"
29 class CGUIMultiSelectTextControl : public CGUIControl
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);
36 virtual ~CGUIMultiSelectTextControl(void);
37 virtual CGUIMultiSelectTextControl *Clone() const { return new CGUIMultiSelectTextControl(*this); };
39 virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
40 virtual void Render();
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);
49 virtual CStdString GetDescription() const;
50 virtual bool CanFocus() const;
52 void UpdateText(const CStdString &text);
55 void SelectItemFromPoint(const CPoint &point);
56 unsigned int GetFocusedItem() const;
57 void SetFocusedItem(unsigned int item);
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);
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);
71 // the static strings and buttons strings
72 class CSelectableString
75 CSelectableString(CGUIFont *font, const CStdString &text, bool selectable, const CStdString &clickAction);
76 CGUITextLayout m_text;
79 CStdString m_clickAction;
81 std::vector<CSelectableString> m_items;
86 unsigned int m_renderTime;
93 unsigned int m_scrollLastTime;
96 CGUIButtonControl m_button;
97 unsigned int m_selectedItem;
98 std::vector<CGUIButtonControl> m_buttons;