2 * Copyright (C) 2005-2013 Team XBMC
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with XBMC; see the file COPYING. If not, see
17 * <http://www.gnu.org/licenses/>.
23 #include "guilib/GUIControl.h"
24 #include "guilib/GUIFont.h"
25 #include "guilib/Key.h"
27 #include "Alternative.h"
30 #include "swighelper.h"
31 #include "WindowException.h"
34 // hardcoded offsets for button controls (and controls that use button controls)
35 // ideally they should be dynamically read in as with all the other properties.
36 #define CONTROL_TEXT_OFFSET_X 10
37 #define CONTROL_TEXT_OFFSET_Y 2
46 * Base class for all controls.
48 class Control : public AddonClass
51 Control() : iControlId(0), iParentId(0), dwPosX(0), dwPosY(0), dwWidth(0),
52 dwHeight(0), iControlUp(0), iControlDown(0), iControlLeft(0),
53 iControlRight(0), pGUIControl(NULL) {}
59 virtual CGUIControl* Create() throw (WindowException);
62 // currently we only accept messages from a button or controllist with a select action
63 virtual bool canAcceptMessages(int actionId) { return false; }
66 * getId() -- Returns the control's current id as an integer.
69 * - id = self.button.getId()
71 virtual int getId() { return iControlId; }
73 inline bool operator==(const Control& other) const { return iControlId == other.iControlId; }
74 inline bool operator>(const Control& other) const { return iControlId > other.iControlId; }
75 inline bool operator<(const Control& other) const { return iControlId < other.iControlId; }
77 // hack this because it returns a tuple
79 * getPosition() -- Returns the control's current position as a x,y integer tuple.
82 * - pos = self.button.getPosition()
84 virtual std::vector<int> getPosition();
85 virtual int getX() { return dwPosX; }
86 virtual int getY() { return dwPosY; }
89 * getHeight() -- Returns the control's current height as an integer.
92 * - height = self.button.getHeight()
94 virtual int getHeight() { return dwHeight; }
98 * getWidth() -- Returns the control's current width as an integer.
101 * - width = self.button.getWidth()
103 virtual int getWidth() { return dwWidth; }
105 // setEnabled() Method
107 * setEnabled(enabled) -- Set's the control's enabled/disabled state.
109 * enabled : bool - True=enabled / False=disabled.
112 * - self.button.setEnabled(False)n
114 virtual void setEnabled(bool enabled);
116 // setVisible() Method
118 * setVisible(visible) -- Set's the control's visible/hidden state.
120 * visible : bool - True=visible / False=hidden.
123 * - self.button.setVisible(False)
125 virtual void setVisible(bool visible);
127 // setVisibleCondition() Method
129 * setVisibleCondition(visible[,allowHiddenFocus]) -- Set's the control's visible condition.
130 * Allows XBMC to control the visible status of the control.
132 * visible : string - Visible condition.\n
133 * allowHiddenFocus : bool - True=gains focus even if hidden.
135 * List of Conditions - http://wiki.xbmc.org/index.php?title=List_of_Boolean_Conditions
138 * - self.button.setVisibleCondition('[Control.IsVisible(41) + !Control.IsVisible(12)]', True)
140 virtual void setVisibleCondition(const char* visible, bool allowHiddenFocus = false);
142 // setEnableCondition() Method
144 * setEnableCondition(enable) -- Set's the control's enabled condition.
145 * Allows XBMC to control the enabled status of the control.
147 * enable : string - Enable condition.
149 * List of Conditions - http://wiki.xbmc.org/index.php?title=List_of_Boolean_Conditions
152 * - self.button.setEnableCondition('System.InternetState')
154 virtual void setEnableCondition(const char* enable);
156 // setAnimations() Method
158 * setAnimations([(event, attr,)*]) -- Set's the control's animations.
160 * [(event,attr,)*] : list - A list of tuples consisting of event and attributes pairs.
161 * - event : string - The event to animate.
162 * - attr : string - The whole attribute string separated by spaces.
164 * Animating your skin - http://wiki.xbmc.org/?title=Animating_Your_Skin
167 * - self.button.setAnimations([('focus', 'effect=zoom end=90,247,220,56 time=0',)])
169 virtual void setAnimations(const std::vector< Tuple<String,String> >& eventAttr) throw (WindowException);
171 // setPosition() Method
173 * setPosition(x, y) -- Set's the controls position.
175 * x : integer - x coordinate of control.\n
176 * y : integer - y coordinate of control.
178 * *Note, You may use negative integers. (e.g sliding a control into view)
181 * - self.button.setPosition(100, 250)
183 virtual void setPosition(long x, long y);
187 * setWidth(width) -- Set's the controls width.
189 * width : integer - width of control.
192 * - self.image.setWidth(100)
194 virtual void setWidth(long width);
196 // setHeight() Method
198 * setHeight(height) -- Set's the controls height.
200 * height : integer - height of control.
203 * - self.image.setHeight(100)
205 virtual void setHeight(long height);
207 // setNavigation() Method
209 * setNavigation(up, down, left, right) -- Set's the controls navigation.
211 * up : control object - control to navigate to on up.\n
212 * down : control object - control to navigate to on down.\n
213 * left : control object - control to navigate to on left.\n
214 * right : control object - control to navigate to on right.
216 * *Note, Same as controlUp(), controlDown(), controlLeft(), controlRight().
217 * Set to self to disable navigation for that direction.
220 * - TypeError, if one of the supplied arguments is not a control type.
221 * - ReferenceError, if one of the controls is not added to a window.
224 * - self.button.setNavigation(self.button1, self.button2, self.button3, self.button4)
226 virtual void setNavigation(const Control* up, const Control* down,
227 const Control* left, const Control* right)
228 throw (WindowException);
230 // controlUp() Method
232 * controlUp(control) -- Set's the controls up navigation.
234 * control : control object - control to navigate to on up.
236 * *Note, You can also use setNavigation(). Set to self to disable navigation.
239 * - TypeError, if one of the supplied arguments is not a control type.
240 * - ReferenceError, if one of the controls is not added to a window.
243 * - self.button.controlUp(self.button1)
245 virtual void controlUp(const Control* up) throw (WindowException);
247 // controlDown() Method
249 * controlDown(control) -- Set's the controls down navigation.
251 * control : control object - control to navigate to on down.
253 * *Note, You can also use setNavigation(). Set to self to disable navigation.
256 * - TypeError, if one of the supplied arguments is not a control type.
257 * - ReferenceError, if one of the controls is not added to a window.
260 * - self.button.controlDown(self.button1)
262 virtual void controlDown(const Control* control) throw (WindowException);
264 // controlLeft() Method
266 * controlLeft(control) -- Set's the controls left navigation.
268 * control : control object - control to navigate to on left.
270 * *Note, You can also use setNavigation(). Set to self to disable navigation.
273 * - TypeError, if one of the supplied arguments is not a control type.
274 * - ReferenceError, if one of the controls is not added to a window.
277 * - self.button.controlLeft(self.button1)
279 virtual void controlLeft(const Control* control) throw (WindowException);
281 // controlRight() Method
283 * controlRight(control) -- Set's the controls right navigation.
285 * control : control object - control to navigate to on right.
287 * *Note, You can also use setNavigation(). Set to self to disable navigation.
290 * - TypeError, if one of the supplied arguments is not a control type.
291 * - ReferenceError, if one of the controls is not added to a window.
294 * - self.button.controlRight(self.button1)
296 virtual void controlRight(const Control* control) throw (WindowException);
309 CGUIControl* pGUIControl;
317 * - Not working yet -.
319 * you can't create this object, it is returned by objects like ControlTextBox and ControlList.
321 class ControlSpin : public Control
324 virtual ~ControlSpin();
327 * setTextures(up, down, upFocus, downFocus) -- Set's textures for this control.
329 * texture are image files that are used for example in the skin
331 virtual void setTextures(const char* up, const char* down,
333 const char* downFocus) throw(UnimplementedException);
336 std::string strTextureUp;
337 std::string strTextureDown;
338 std::string strTextureUpFocus;
339 std::string strTextureDownFocus;
346 friend class ControlList;
351 * ControlLabel class.
353 * ControlLabel(x, y, width, height, label[, font, textColor,
354 * disabledColor, alignment, hasPath, angle])
356 * x : integer - x coordinate of control.\n
357 * y : integer - y coordinate of control.\n
358 * width : integer - width of control.\n
359 * height : integer - height of control.\n
360 * label : string or unicode - text string.\n
361 * font : [opt] string - font used for label text. (e.g. 'font13')\n
362 * textColor : [opt] hexstring - color of enabled label's label. (e.g. '0xFFFFFFFF')\n
363 * disabledColor : [opt] hexstring - color of disabled label's label. (e.g. '0xFFFF3300')\n
364 * alignment : [opt] integer - alignment of label - *Note, see xbfont.h\n
365 * hasPath : [opt] bool - True=stores a path / False=no path.\n
366 * angle : [opt] integer - angle of control. (+ rotates CCW, - rotates C\n
369 * - self.label = xbmcgui.ControlLabel(100, 250, 125, 75, 'Status', angle=45)
371 class ControlLabel : public Control
374 ControlLabel(long x, long y, long width, long height, const String& label,
375 const char* font = NULL, const char* textColor = NULL,
376 const char* disabledColor = NULL,
377 long alignment = XBFONT_LEFT,
378 bool hasPath = false, long angle = 0);
380 virtual ~ControlLabel();
383 * getLabel() -- Returns the text value for this label.
386 * - label = self.label.getLabel()
388 virtual String getLabel() throw(UnimplementedException);
391 * setLabel(label) -- Set's text for this label.
393 * label : string or unicode - text string.
396 * - self.label.setLabel('Status')
398 virtual void setLabel(const String& label = emptyString,
399 const char* font = NULL,
400 const char* textColor = NULL,
401 const char* disabledColor = NULL,
402 const char* shadowColor = NULL,
403 const char* focusedColor = NULL,
404 const String& label2 = emptyString) throw(UnimplementedException);
414 color_t disabledColor;
419 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
428 * ControlEdit(x, y, width, height, label[, font, textColor,
429 * disabledColor, alignment, focusTexture, noFocusTexture])
431 * x : integer - x coordinate of control.\n
432 * y : integer - y coordinate of control.\n
433 * width : integer - width of control.\n
434 * height : integer - height of control.\n
435 * label : string or unicode - text string.\n
436 * font : [opt] string - font used for label text. (e.g. 'font13')\n
437 * textColor : [opt] hexstring - color of enabled label's label. (e.g. '0xFFFFFFFF')\n
438 * disabledColor : [opt] hexstring - color of disabled label's label. (e.g. '0xFFFF3300')\n
439 * alignment : [opt] integer - alignment of label - *Note, see xbfont.h\n
440 * focusTexture : [opt] string - filename for focus texture.\n
441 * noFocusTexture : [opt] string - filename for no focus texture.\n
442 * isPassword : [opt] bool - if true, mask text value.
444 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
445 * Once you use a keyword, all following arguments require the keyword.\n
446 * After you create the control, you need to add it to the window with addControl().\n
449 * - self.edit = xbmcgui.ControlEdit(100, 250, 125, 75, 'Status')
451 class ControlEdit : public Control
454 ControlEdit(long x, long y, long width, long height, const String& label,
455 const char* font = NULL, const char* textColor = NULL,
456 const char* disabledColor = NULL,
457 long _alignment = XBFONT_LEFT, const char* focusTexture = NULL,
458 const char* noFocusTexture = NULL, bool isPassword = false);
463 * setLabel(label) -- Set's text heading for this edit control.
465 * label : string or unicode - text string.
468 * - self.edit.setLabel('Status')
470 virtual void setLabel(const String& label = emptyString,
471 const char* font = NULL,
472 const char* textColor = NULL,
473 const char* disabledColor = NULL,
474 const char* shadowColor = NULL,
475 const char* focusedColor = NULL,
476 const String& label2 = emptyString) throw(UnimplementedException);
480 * getLabel() -- Returns the text heading for this edit control.
483 * - label = self.edit.getLabel()
485 virtual String getLabel() throw(UnimplementedException);
489 * setText(value) -- Set's text value for this edit control.
491 * value : string or unicode - text string.
494 * - self.edit.setText('online')
496 virtual void setText(const String& text) throw(UnimplementedException);
500 * getText() -- Returns the text value for this edit control.
503 * - value = self.edit.getText()
505 virtual String getText() throw(UnimplementedException);
514 std::string strTextureFocus;
515 std::string strTextureNoFocus;
517 color_t disabledColor;
521 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
528 * ControlList(x, y, width, height[, font, textColor, buttonTexture, buttonFocusTexture,
529 * selectedColor, imageWidth, imageHeight, itemTextXOffset, itemTextYOffset,
530 * itemHeight, space, alignmentY])n"//, shadowColor])
532 * x : integer - x coordinate of control.\n
533 * y : integer - y coordinate of control.\n
534 * width : integer - width of control.\n
535 * height : integer - height of control.\n
536 * font : [opt] string - font used for items label. (e.g. 'font13')\n
537 * textColor : [opt] hexstring - color of items label. (e.g. '0xFFFFFFFF')\n
538 * buttonTexture : [opt] string - filename for focus texture.\n
539 * buttonFocusTexture : [opt] string - filename for no focus texture.\n
540 * selectedColor : [opt] integer - x offset of label.\n
541 * imageWidth : [opt] integer - width of items icon or thumbnail.\n
542 * imageHeight : [opt] integer - height of items icon or thumbnail.\n
543 * itemTextXOffset : [opt] integer - x offset of items label.\n
544 * itemTextYOffset : [opt] integer - y offset of items label.\n
545 * itemHeight : [opt] integer - height of items.\n
546 * space : [opt] integer - space between items.\n
547 * alignmentY : [opt] integer - Y-axis alignment of items label - *Note, see xbfont.h\n
548 * //"shadowColor : [opt] hexstring - color of items label's shadow. (e.g. '0xFF000000')
550 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
551 * Once you use a keyword, all following arguments require the keyword.\n
552 * After you create the control, you need to add it to the window with addControl().\n
555 * - self.cList = xbmcgui.ControlList(100, 250, 200, 250, 'font14', space=5)
557 class ControlList : public Control
559 void internAddListItem(AddonClass::Ref<ListItem> listitem, bool sendMessage) throw(WindowException);
562 ControlList(long x, long y, long width, long height, const char* font = NULL,
563 const char* textColor = NULL, const char* buttonTexture = NULL,
564 const char* buttonFocusTexture = NULL,
565 const char* selectedColor = NULL,
566 long _imageWidth=10, long _imageHeight=10, long _itemTextXOffset = CONTROL_TEXT_OFFSET_X,
567 long _itemTextYOffset = CONTROL_TEXT_OFFSET_Y, long _itemHeight = 27, long _space = 2,
568 long _alignmentY = XBFONT_CENTER_Y);
570 virtual ~ControlList();
573 * addItem(item) -- Add a new item to this list control.
575 * item : string, unicode or ListItem - item to add.
578 * - cList.addItem('Reboot XBMC')
580 virtual void addItem(const Alternative<String, const XBMCAddon::xbmcgui::ListItem* > & item, bool sendMessage = true);
583 * addItems(items) -- Adds a list of listitems or strings to this list control.
585 * items : List - list of strings, unicode objects or ListItems to add.
587 * *Note, You can use the above as keywords for arguments.
589 * Large lists benefit considerably, than using the standard addItem()
592 * - cList.addItems(items=listitems)
594 virtual void addItems(const std::vector<Alternative<String, const XBMCAddon::xbmcgui::ListItem* > > & items);
597 * selectItem(item) -- Select an item by index number.
599 * item : integer - index number of the item to select.
602 * - cList.selectItem(12)
604 virtual void selectItem(long item) throw(UnimplementedException);
607 * removeItem(index) -- Remove an item by index number.
609 * index : integer - index number of the item to remove.
612 * - cList.removeItem(12)
614 virtual void removeItem(int index) throw (UnimplementedException,WindowException);
617 * reset() -- Clear all ListItems in this control list.
622 virtual void reset() throw (UnimplementedException);
625 * getSpinControl() -- returns the associated ControlSpin object.
627 * *Note, Not working completely yet -\n
628 * After adding this control list to a window it is not possible to change\n
629 * the settings of this spin control.
632 * - ctl = cList.getSpinControl()
634 virtual Control* getSpinControl() throw (UnimplementedException);
637 * getSelectedPosition() -- Returns the position of the selected item as an integer.
639 * *Note, Returns -1 for empty lists.
642 * - pos = cList.getSelectedPosition()
644 virtual long getSelectedPosition() throw (UnimplementedException);
647 * getSelectedItem() -- Returns the selected item as a ListItem object.
649 * *Note, Same as getSelectedPosition(), but instead of an integer a ListItem object\n
650 * is returned. Returns None for empty lists.\n
651 * See windowexample.py on how to use this.
654 * - item = cList.getSelectedItem()
656 virtual XBMCAddon::xbmcgui::ListItem* getSelectedItem() throw (UnimplementedException);
659 // setImageDimensions() method
661 * setImageDimensions(imageWidth, imageHeight) -- Sets the width/height of items icon or thumbnail.
663 * imageWidth : [opt] integer - width of items icon or thumbnail.\n
664 * imageHeight : [opt] integer - height of items icon or thumbnail.
667 * - cList.setImageDimensions(18, 18)
669 virtual void setImageDimensions(long imageWidth,long imageHeight) throw (UnimplementedException);
671 // setItemHeight() method
673 * setItemHeight(itemHeight) -- Sets the height of items.
675 * itemHeight : integer - height of items.
678 * - cList.setItemHeight(25)
680 virtual void setItemHeight(long height) throw (UnimplementedException);
684 * setSpace(space) -- Set's the space between items.
686 * space : [opt] integer - space between items.
689 * - cList.setSpace(5)
691 virtual void setSpace(int space) throw (UnimplementedException);
693 // setPageControlVisible() method
695 * setPageControlVisible(visible) -- Sets the spin control's visible/hidden state.
697 * visible : boolean - True=visible / False=hidden.
700 * - cList.setPageControlVisible(True)
702 virtual void setPageControlVisible(bool visible) throw(UnimplementedException);
706 * size() -- Returns the total number of items in this list control as an integer.
709 * - cnt = cList.size()
711 virtual long size() throw (UnimplementedException);
714 // getItemHeight() Method
716 * getItemHeight() -- Returns the control's current item height as an integer.
719 * - item_height = self.cList.getItemHeight()
721 virtual long getItemHeight() throw(UnimplementedException);
725 * getSpace() -- Returns the control's space between items as an integer.
728 * - gap = self.cList.getSpace()
730 virtual long getSpace() throw (UnimplementedException);
732 // getListItem() method
734 * getListItem(index) -- Returns a given ListItem in this List.
736 * index : integer - index number of item to return.
738 * *Note, throws a ValueError if index is out of range.
741 * - listitem = cList.getListItem(6)
743 virtual XBMCAddon::xbmcgui::ListItem* getListItem(int index) throw (UnimplementedException,WindowException);
746 * setStaticContent(items) -- Fills a static list with a list of listitems.
748 * items : List - list of listitems to add.
750 * *Note, You can use the above as keywords for arguments.
753 * - cList.setStaticContent(items=listitems)
755 virtual void setStaticContent(const ListItemList* items) throw (UnimplementedException);
758 void sendLabelBind(int tail);
760 SWIGHIDDENVIRTUAL bool canAcceptMessages(int actionId)
761 { return ((actionId == ACTION_SELECT_ITEM) | (actionId == ACTION_MOUSE_LEFT_CLICK)); }
763 // This is called from AddonWindow.cpp but shouldn't be available
764 // to the scripting languages.
774 std::vector<AddonClass::Ref<ListItem> > vecItems;
776 AddonClass::Ref<ControlSpin> pControlSpin;
779 color_t selectedColor;
780 std::string strTextureButton;
781 std::string strTextureButtonFocus;
792 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
796 // ControlFadeLabel class
798 * ControlFadeLabel class.\n
799 * Control that scroll's labl
801 * ControlFadeLabel(x, y, width, height[, font, textColor, alignment])
803 * x : integer - x coordinate of control.\n
804 * y : integer - y coordinate of control.\n
805 * width : integer - width of control.\n
806 * height : integer - height of control.\n
807 * font : [opt] string - font used for label text. (e.g. 'font13')\n
808 * textColor : [opt] hexstring - color of fadelabel's labels. (e.g. '0xFFFFFFFF')\n
809 * alignment : [opt] integer - alignment of label - *Note, see xbfont.h
811 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
812 * Once you use a keyword, all following arguments require the keyword.\n
813 * After you create the control, you need to add it to the window with addControl().
816 * - self.fadelabel = xbmcgui.ControlFadeLabel(100, 250, 200, 50, textColor='0xFFFFFFFF')
818 class ControlFadeLabel : public Control
821 ControlFadeLabel(long x, long y, long width, long height,
822 const char* font = NULL,
823 const char* textColor = NULL,
824 long _alignment = XBFONT_LEFT);
828 * addLabel(label) -- Add a label to this control for scrolling.
830 * label : string or unicode - text string.
833 * - self.fadelabel.addLabel('This is a line of text that can scroll.')
835 virtual void addLabel(const String& label) throw (UnimplementedException);
838 * reset() -- Clear this fade label.
841 * - self.fadelabel.reset()
843 virtual void reset() throw (UnimplementedException);
848 std::vector<std::string> vecLabels;
851 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
853 ControlFadeLabel() {}
858 * ControlTextBox class.
860 * ControlTextBox(x, y, width, height[, font, textColor])
862 * x : integer - x coordinate of control.\n
863 * y : integer - y coordinate of control.\n
864 * width : integer - width of control.\n
865 * height : integer - height of control.\n
866 * font : [opt] string - font used for text. (e.g. 'font13')\n
867 * textColor : [opt] hexstring - color of textbox's text. (e.g. '0xFFFFFFFF')
869 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
870 * Once you use a keyword, all following arguments require the keyword.\n
871 * After you create the control, you need to add it to the window with addControl().
874 * - self.textbox = xbmcgui.ControlTextBox(100, 250, 300, 300, textColor='0xFFFFFFFF')
876 class ControlTextBox : public Control
879 ControlTextBox(long x, long y, long width, long height,
880 const char* font = NULL,
881 const char* textColor = NULL);
885 * setText(text) -- Set's the text for this textbox.
887 * text : string or unicode - text string.
890 * - self.textbox.setText('This is a line of text that can wrap.')
892 virtual void setText(const String& text) throw(UnimplementedException);
896 * getText() -- Returns the text value for this textbox.
899 * - text = self.text.getText()
901 virtual String getText() throw(UnimplementedException);
905 * reset() -- Clear's this textbox.
908 * - self.textbox.reset()
910 virtual void reset() throw(UnimplementedException);
914 * scroll(position) -- Scrolls to the given position.
916 * id : integer - position to scroll to.
919 * - self.textbox.scroll(10)
921 virtual void scroll(long id) throw(UnimplementedException);
927 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
933 // ControlImage class
935 * ControlImage class.
937 * ControlImage(x, y, width, height, filename[, aspectRatio, colorDiffuse])
939 * x : integer - x coordinate of control.\n
940 * y : integer - y coordinate of control.\n
941 * width : integer - width of control.\n
942 * height : integer - height of control.\n
943 * filename : string - image filename.\n
944 * aspectRatio : [opt] integer - (values 0 = stretch (default), 1 = scale up (crops), 2 = scale down (black bar\n
945 * colorDiffuse : hexString - (example, '0xC0FF0000' (red tint))
947 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
948 * Once you use a keyword, all following arguments require the keyword.\n
949 * After you create the control, you need to add it to the window with addControl().
952 * - self.image = xbmcgui.ControlImage(100, 250, 125, 75, aspectRatio=2)
954 class ControlImage : public Control
957 ControlImage(long x, long y, long width, long height,
958 const char* filename, long aspectRatio = 0,
959 const char* colorDiffuse = NULL);
962 * setImage(filename, useCache) -- Changes the image.
964 * filename : string - image filename.
965 * useCache : [opt] bool - true/use cache, false/don't use cache
968 * - self.image.setImage('special://home/scripts/test.png')
970 virtual void setImage(const char* imageFilename, const bool useCache = true) throw (UnimplementedException);
973 * setColorDiffuse(colorDiffuse) -- Changes the images color.
975 * colorDiffuse : hexString - (example, '0xC0FF0000' (red tint))
978 * - self.image.setColorDiffuse('0xC0FF0000')
980 virtual void setColorDiffuse(const char* hexString) throw (UnimplementedException);
987 std::string strFileName;
989 color_t colorDiffuse;
991 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
995 class ControlProgress : public Control
998 ControlProgress(long x, long y, long width, long height,
999 const char* texturebg = NULL,
1000 const char* textureleft = NULL,
1001 const char* texturemid = NULL,
1002 const char* textureright = NULL,
1003 const char* textureoverlay = NULL);
1006 * setPercent(percent) -- Sets the percentage of the progressbar to show.
1008 * percent : float - percentage of the bar to show.
1010 * *Note, valid range for percent is 0-100
1013 * - self.progress.setPercent(60)
1015 virtual void setPercent(float pct) throw (UnimplementedException);
1018 * getPercent() -- Returns a float of the percent of the progress.
1021 * - print self.progress.getValue()
1023 virtual float getPercent() throw (UnimplementedException);
1026 std::string strTextureLeft;
1027 std::string strTextureMid;
1028 std::string strTextureRight;
1029 std::string strTextureBg;
1030 std::string strTextureOverlay;
1032 color_t colorDiffuse;
1034 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
1041 // ControlButton class
1043 * ControlButton class.
1045 * ControlButton(x, y, width, height, label[, focusTexture, noFocusTexture, textOffsetX, textOffsetY,
1046 * alignment, font, textColor, disabledColor, angle, shadowColor, focusedColor])
1048 * x : integer - x coordinate of control.\n
1049 * y : integer - y coordinate of control.\n
1050 * width : integer - width of control.\n
1051 * height : integer - height of control.\n
1052 * label : string or unicode - text string.\n
1053 * focusTexture : [opt] string - filename for focus texture.\n
1054 * noFocusTexture : [opt] string - filename for no focus texture.\n
1055 * textOffsetX : [opt] integer - x offset of label.\n
1056 * textOffsetY : [opt] integer - y offset of label.\n
1057 * alignment : [opt] integer - alignment of label - *Note, see xbfont.h\n
1058 * font : [opt] string - font used for label text. (e.g. 'font13')\n
1059 * textColor : [opt] hexstring - color of enabled button's label. (e.g. '0xFFFFFFFF')\n
1060 * disabledColor : [opt] hexstring - color of disabled button's label. (e.g. '0xFFFF3300')\n
1061 * angle : [opt] integer - angle of control. (+ rotates CCW, - rotates CW)\n
1062 * shadowColor : [opt] hexstring - color of button's label's shadow. (e.g. '0xFF000000')\n
1063 * focusedColor : [opt] hexstring - color of focused button's label. (e.g. '0xFF00FFFF')
1065 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1066 * Once you use a keyword, all following arguments require the keyword.\n
1067 * After you create the control, you need to add it to the window with addControl().
1070 * - self.button = xbmcgui.ControlButton(100, 250, 200, 50, 'Status', font='font14')
1072 class ControlButton : public Control
1075 ControlButton(long x, long y, long width, long height, const String& label,
1076 const char* focusTexture = NULL, const char* noFocusTexture = NULL,
1077 long textOffsetX = CONTROL_TEXT_OFFSET_X,
1078 long textOffsetY = CONTROL_TEXT_OFFSET_Y,
1079 long alignment = (XBFONT_LEFT | XBFONT_CENTER_Y),
1080 const char* font = NULL, const char* textColor = NULL,
1081 const char* disabledColor = NULL, long angle = 0,
1082 const char* shadowColor = NULL, const char* focusedColor = NULL);
1084 // setLabel() Method
1086 * setLabel([label, font, textColor, disabledColor, shadowColor, focusedColor]) -- Set's this buttons text attributes.
1088 * label : [opt] string or unicode - text string.\n
1089 * font : [opt] string - font used for label text. (e.g. 'font13')\n
1090 * textColor : [opt] hexstring - color of enabled button's label. (e.g. '0xFFFFFFFF')\n
1091 * disabledColor : [opt] hexstring - color of disabled button's label. (e.g. '0xFFFF3300')\n
1092 * shadowColor : [opt] hexstring - color of button's label's shadow. (e.g. '0xFF000000')\n
1093 * focusedColor : [opt] hexstring - color of focused button's label. (e.g. '0xFFFFFF00')\n
1094 * label2 : [opt] string or unicode - text string.
1096 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1097 * Once you use a keyword, all following arguments require the keyword.
1100 * - self.button.setLabel('Status', 'font14', '0xFFFFFFFF', '0xFFFF3300', '0xFF000000')
1102 virtual void setLabel(const String& label = emptyString,
1103 const char* font = NULL,
1104 const char* textColor = NULL,
1105 const char* disabledColor = NULL,
1106 const char* shadowColor = NULL,
1107 const char* focusedColor = NULL,
1108 const String& label2 = emptyString) throw (UnimplementedException);
1110 // setDisabledColor() Method
1112 * setDisabledColor(disabledColor) -- Set's this buttons disabled color.
1114 * disabledColor : hexstring - color of disabled button's label. (e.g. '0xFFFF3300')
1117 * - self.button.setDisabledColor('0xFFFF3300')
1119 virtual void setDisabledColor(const char* color) throw (UnimplementedException);
1121 // getLabel() Method
1123 * getLabel() -- Returns the buttons label as a unicode string.
1126 * - label = self.button.getLabel()
1128 virtual String getLabel() throw (UnimplementedException);
1130 // getLabel2() Method
1132 * getLabel2() -- Returns the buttons label2 as a unicode string.
1135 * - label = self.button.getLabel2()
1137 virtual String getLabel2() throw (UnimplementedException);
1139 SWIGHIDDENVIRTUAL bool canAcceptMessages(int actionId) { return true; }
1144 std::string strFont;
1146 color_t disabledColor;
1150 std::string strText;
1151 std::string strText2;
1152 std::string strTextureFocus;
1153 std::string strTextureNoFocus;
1155 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
1167 // ControlCheckMark class
1169 * ControlCheckMark class.
1171 * ControlCheckMark(x, y, width, height, label[, focusTexture, noFocusTexture,
1172 * checkWidth, checkHeight, alignment, font, textColor, disabledColor])
1174 * x : integer - x coordinate of control.\n
1175 * y : integer - y coordinate of control.\n
1176 * width : integer - width of control.\n
1177 * height : integer - height of control.\n
1178 * label : string or unicode - text string.\n
1179 * focusTexture : [opt] string - filename for focus texture.\n
1180 * noFocusTexture : [opt] string - filename for no focus texture.\n
1181 * checkWidth : [opt] integer - width of checkmark.\n
1182 * checkHeight : [opt] integer - height of checkmark.\n
1183 * alignment : [opt] integer - alignment of label - *Note, see xbfont.h\n
1184 * font : [opt] string - font used for label text. (e.g. 'font13')\n
1185 * textColor : [opt] hexstring - color of enabled checkmark's label. (e.g. '0xFFFFFFFF')\n
1186 * disabledColor : [opt] hexstring - color of disabled checkmark's label. (e.g. '0xFFFF3300')
1188 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1189 * Once you use a keyword, all following arguments require the keyword.\n
1190 * After you create the control, you need to add it to the window with addControl().
1193 * - self.checkmark = xbmcgui.ControlCheckMark(100, 250, 200, 50, 'Status', font='font14')
1195 class ControlCheckMark : public Control
1199 ControlCheckMark(long x, long y, long width, long height, const String& label,
1200 const char* focusTexture = NULL, const char* noFocusTexture = NULL,
1201 long checkWidth = 30, long checkHeight = 30,
1202 long _alignment = XBFONT_RIGHT, const char* font = NULL,
1203 const char* textColor = NULL, const char* disabledColor = NULL);
1205 // getSelected() Method
1207 * getSelected() -- Returns the selected status for this checkmark as a bool.
1210 * - selected = self.checkmark.getSelected()
1212 virtual bool getSelected() throw (UnimplementedException);
1214 // setSelected() Method
1216 * setSelected(isOn) -- Sets this checkmark status to on or off.
1218 * isOn : bool - True=selected (on) / False=not selected (off)
1221 * - self.checkmark.setSelected(True)
1223 virtual void setSelected(bool selected) throw (UnimplementedException);
1225 // setLabel() Method
1227 * setLabel(label[, font, textColor, disabledColor]) -- Set's this controls text attributes.
1229 * label : string or unicode - text string.\n
1230 * font : [opt] string - font used for label text. (e.g. 'font13')\n
1231 * textColor : [opt] hexstring - color of enabled checkmark's label. (e.g. '0xFFFFFFFF')\n
1232 * disabledColor : [opt] hexstring - color of disabled checkmark's label. (e.g. '0xFFFF3300')
1235 * - self.checkmark.setLabel('Status', 'font14', '0xFFFFFFFF', '0xFFFF3300')
1237 virtual void setLabel(const String& label = emptyString,
1238 const char* font = NULL,
1239 const char* textColor = NULL,
1240 const char* disabledColor = NULL,
1241 const char* shadowColor = NULL,
1242 const char* focusedColor = NULL,
1243 const String& label2 = emptyString) throw (UnimplementedException);
1245 // setDisabledColor() Method
1247 * setDisabledColor(disabledColor) -- Set's this controls disabled color.
1249 * disabledColor : hexstring - color of disabled checkmark's label. (e.g. '0xFFFF3300')
1252 * - self.checkmark.setDisabledColor('0xFFFF3300')
1254 virtual void setDisabledColor(const char* color) throw (UnimplementedException);
1257 SWIGHIDDENVIRTUAL bool canAcceptMessages(int actionId) { return true; }
1259 std::string strFont;
1264 color_t disabledColor;
1265 std::string strTextureFocus;
1266 std::string strTextureNoFocus;
1267 std::string strText;
1269 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
1271 ControlCheckMark() :
1278 // ControlGroup class
1280 * ControlGroup class.
1282 * ControlGroup(x, y, width, height
1284 * x : integer - x coordinate of control.\n
1285 * y : integer - y coordinate of control.\n
1286 * width : integer - width of control.\n
1287 * height : integer - height of control.
1289 * - self.group = xbmcgui.ControlGroup(100, 250, 125, 75)
1291 class ControlGroup : public Control
1294 ControlGroup(long x, long y, long width, long height);
1297 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
1299 inline ControlGroup() {}
1303 // ControlRadioButton class
1305 * ControlRadioButton class.
1307 * ControlRadioButton(x, y, width, height, label[, focusOnTexture, noFocusOnTexture,\n
1308 * focusOffTexture, noFocusOffTexture, focusTexture, noFocusTexture,\n
1309 * textOffsetX, textOffsetY, alignment, font, textColor, disabledColor])
1311 * x : integer - x coordinate of control.\n
1312 * y : integer - y coordinate of control.\n
1313 * width : integer - width of control.\n
1314 * height : integer - height of control.\n
1315 * label : string or unicode - text string.\n
1316 * focusOnTexture : [opt] string - filename for radio ON focused texture.\n
1317 * noFocusOnTexture : [opt] string - filename for radio ON not focused texture.\n
1318 * focusOfTexture : [opt] string - filename for radio OFF focused texture.\n
1319 * noFocusOffTexture : [opt] string - filename for radio OFF not focused texture.\n
1320 * focusTexture : [opt] string - filename for radio ON texture (deprecated, use focusOnTexture and noFocusOnTexture).\n
1321 * noFocusTexture : [opt] string - filename for radio OFF texture (deprecated, use focusOffTexture and noFocusOffTexture).\n
1322 * textOffsetX : [opt] integer - horizontal text offset\n
1323 * textOffsetY : [opt] integer - vertical text offset\n
1324 * alignment : [opt] integer - alignment of label - *Note, see xbfont.h\n
1325 * font : [opt] string - font used for label text. (e.g. 'font13')\n
1326 * textColor : [opt] hexstring - color of enabled checkmark's label. (e.g. '0xFFFFFFFF')\n
1327 * disabledColor : [opt] hexstring - color of disabled checkmark's label. (e.g. '0xFFFF3300')
1329 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1330 * Once you use a keyword, all following arguments require the keyword.\n
1331 * After you create the control, you need to add it to the window with addControl().
1334 * - self.radiobutton = xbmcgui.ControlRadioButton(100, 250, 200, 50, 'Enable', font='font14')
1336 class ControlRadioButton : public Control
1339 ControlRadioButton(long x, long y, long width, long height, const String& label,
1340 const char* focusOnTexture = NULL, const char* noFocusOnTexture = NULL,
1341 const char* focusOffTexture = NULL, const char* noFocusOffTexture = NULL,
1342 const char* focusTexture = NULL, const char* noFocusTexture = NULL,
1343 long textOffsetX = CONTROL_TEXT_OFFSET_X,
1344 long textOffsetY = CONTROL_TEXT_OFFSET_Y,
1345 long _alignment = (XBFONT_LEFT | XBFONT_CENTER_Y),
1346 const char* font = NULL, const char* textColor = NULL,
1347 const char* disabledColor = NULL, long angle = 0,
1348 const char* shadowColor = NULL, const char* focusedColor = NULL);
1350 // setSelected() Method
1352 * setSelected(selected) -- Sets the radio buttons's selected status.
1354 * selected : bool - True=selected (on) / False=not selected (off)
1356 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1357 * Once you use a keyword, all following arguments require the keyword.
1360 * - self.radiobutton.setSelected(True)
1362 virtual void setSelected(bool selected) throw (UnimplementedException);
1364 // isSelected() Method
1366 * isSelected() -- Returns the radio buttons's selected status.
1369 * - is = self.radiobutton.isSelected()
1371 virtual bool isSelected() throw (UnimplementedException);
1373 // setLabel() Method
1375 * setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor]) -- Set's the radio buttons text attributes.
1377 * label : string or unicode - text string.\n
1378 * font : [opt] string - font used for label text. (e.g. 'font13')\n
1379 * textColor : [opt] hexstring - color of enabled radio button's label. (e.g. '0xFFFFFFFF')\n
1380 * disabledColor : [opt] hexstring - color of disabled radio button's label. (e.g. '0xFFFF3300')\n
1381 * shadowColor : [opt] hexstring - color of radio button's label's shadow. (e.g. '0xFF000000')\n
1382 * focusedColor : [opt] hexstring - color of focused radio button's label. (e.g. '0xFFFFFF00')
1384 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1385 * Once you use a keyword, all following arguments require the keyword.
1388 * - self.radiobutton.setLabel('Status', 'font14', '0xFFFFFFFF', '0xFFFF3300', '0xFF000000')
1390 virtual void setLabel(const String& label = emptyString,
1391 const char* font = NULL,
1392 const char* textColor = NULL,
1393 const char* disabledColor = NULL,
1394 const char* shadowColor = NULL,
1395 const char* focusedColor = NULL,
1396 const String& label2 = emptyString) throw (UnimplementedException);
1398 // setRadioDimension() Method
1400 * setRadioDimension(x, y, width, height) -- Sets the radio buttons's radio texture's position and size.
1402 * x : integer - x coordinate of radio texture.\n
1403 * y : integer - y coordinate of radio texture.\n
1404 * width : integer - width of radio texture.\n
1405 * height : integer - height of radio texture.
1407 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1408 * Once you use a keyword, all following arguments require the keyword.
1411 * - self.radiobutton.setRadioDimension(x=100, y=5, width=20, height=20)
1413 virtual void setRadioDimension(long x, long y, long width, long height) throw (UnimplementedException);
1416 SWIGHIDDENVIRTUAL bool canAcceptMessages(int actionId) { return true; }
1418 std::string strFont;
1419 std::string strText;
1420 std::string strTextureFocus;
1421 std::string strTextureNoFocus;
1422 std::string strTextureRadioOnFocus;
1423 std::string strTextureRadioOnNoFocus;
1424 std::string strTextureRadioOffFocus;
1425 std::string strTextureRadioOffNoFocus;
1427 color_t disabledColor;
1432 color_t shadowColor;
1433 color_t focusedColor;
1435 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
1437 ControlRadioButton() :
1446 * ControlSlider class.
1448 * ControlSlider(x, y, width, height[, textureback, texture, texturefocus])
1450 * x : integer - x coordinate of control.\n
1451 * y : integer - y coordinate of control.\n
1452 * width : integer - width of control.\n
1453 * height : integer - height of control.\n
1454 * textureback : [opt] string - image filename.\n
1455 * texture : [opt] string - image filename.\n
1456 * texturefocus : [opt] string - image filename.n"
1458 * *Note, You can use the above as keywords for arguments and skip certain optional arguments.\n
1459 * Once you use a keyword, all following arguments require the keyword.\n
1460 * After you create the control, you need to add it to the window with addControl().
1463 * - self.slider = xbmcgui.ControlSlider(100, 250, 350, 40)
1465 class ControlSlider : public Control
1468 ControlSlider(long x, long y, long width, long height,
1469 const char* textureback = NULL,
1470 const char* texture = NULL,
1471 const char* texturefocus = NULL);
1474 * getPercent() -- Returns a float of the percent of the slider.
1477 * - print self.slider.getPercent()
1479 virtual float getPercent() throw (UnimplementedException);
1482 * setPercent(50) -- Sets the percent of the slider.
1485 * - self.slider.setPercent(50)
1487 virtual void setPercent(float pct) throw (UnimplementedException);
1490 std::string strTextureBack;
1491 std::string strTexture;
1492 std::string strTextureFoc;
1494 SWIGHIDDENVIRTUAL CGUIControl* Create() throw (WindowException);
1496 inline ControlSlider() {}