2 \file GUISelectButtonControl.h
6 #ifndef GUILIB_GUIWINDOWSELECTCONTROL_H
7 #define GUILIB_GUIWINDOWSELECTCONTROL_H
12 * Copyright (C) 2005-2013 Team XBMC
15 * This Program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2, or (at your option)
20 * This Program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with XBMC; see the file COPYING. If not, see
27 * <http://www.gnu.org/licenses/>.
31 #include "GUIButtonControl.h"
35 \brief Button with multi selection choice.
37 Behaves like a normal button control, but when pressing,
38 it can show multiple strings. The user can choose one by
39 moving left or right. \n
41 Messages the button reactes on: \n
43 - GUI_MSG_LABEL_ADD \n
44 Add a label to the control. Use CGUIMessage::SetLabel
45 to set the label text.
46 - GUI_MSG_LABEL_RESET \n
47 Remove all labels from the control.
48 - GUI_MSG_ITEM_SELECTED \n
49 After sending this message the CGUIMessage::GetParam1
50 contains the selected label as an integer.
51 \note The order of the items depends on the order they have been added to
52 the control using GUI_MSG_LABEL_ADD.
53 - GUI_MSG_ITEM_SELECT \n
54 Send this message with CGUIMessage::SetParam1() set to the label
57 Example entry to define a select button in a window or as reference control: \n
60 <description>default select button</description
61 <type>selectbutton</type>
69 <textureFocus>button-focus.png</textureFocus>
70 <textureNoFocus>button-nofocus.jpg</textureNoFocus>
71 <texturebg>button-focus.png</texturebg>
72 <textureLeft>scroll-left.png</textureLeft>
73 <textureRight>scroll-right.png</textureRight>
75 <textcolor>ffffffff</textcolor>
76 <colordiffuse>ffffffff</colordiffuse>
77 <disabledcolor>60ffffff</disabledcolor>
87 class CGUISelectButtonControl : public CGUIButtonControl
90 CGUISelectButtonControl(int parentID, int controlID,
91 float posX, float posY,
92 float width, float height,
93 const CTextureInfo& buttonFocus, const CTextureInfo& button,
94 const CLabelInfo& labelInfo,
95 const CTextureInfo& selectBackground,
96 const CTextureInfo& selectArrowLeft, const CTextureInfo& selectArrowLeftFocus,
97 const CTextureInfo& selectArrowRight, const CTextureInfo& selectArrowRightFocus);
98 virtual ~CGUISelectButtonControl(void);
99 virtual CGUISelectButtonControl *Clone() const { return new CGUISelectButtonControl(*this); };
101 virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
102 virtual void Render();
103 virtual bool OnAction(const CAction &action) ;
104 virtual void OnLeft();
105 virtual void OnRight();
106 virtual bool OnMessage(CGUIMessage& message);
107 virtual bool OnMouseOver(const CPoint &point);
109 virtual void AllocResources();
110 virtual void FreeResources(bool immediately = false);
111 virtual void DynamicResourceAlloc(bool bOnOff);
112 virtual void SetInvalid();
113 virtual void SetPosition(float posX, float posY);
116 virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);
117 virtual bool UpdateColors();
119 CGUITexture m_imgBackground;
120 CGUITexture m_imgLeft;
121 CGUITexture m_imgLeftFocus;
122 CGUITexture m_imgRight;
123 CGUITexture m_imgRightFocus;
124 std::vector<std::string> m_vecItems;
128 bool m_bLeftSelected;
129 bool m_bRightSelected;
132 unsigned int m_ticks;