-
Notifications
You must be signed in to change notification settings - Fork 5
/
Control.h
3003 lines (2860 loc) · 109 KB
/
Control.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Copyright (C) 2005-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#pragma once
#include "Alternative.h"
#include "ListItem.h"
#include "Tuple.h"
#include "guilib/GUIControl.h"
#include "guilib/GUIFont.h"
#include "input/Key.h"
#include "swighelper.h"
#include "utils/Color.h"
#include <vector>
// hardcoded offsets for button controls (and controls that use button controls)
// ideally they should be dynamically read in as with all the other properties.
#define CONTROL_TEXT_OFFSET_X 10
#define CONTROL_TEXT_OFFSET_Y 2
namespace XBMCAddon
{
namespace xbmcgui
{
/// \defgroup python_xbmcgui_control Control
/// \ingroup python_xbmcgui
/// @{
/// @brief **Code based skin access.**
///
/// Offers classes and functions that manipulate the add-on gui controls.
///
///-------------------------------------------------------------------------
///
/// \python_class{ Control() }
///
/// **Code based skin access.**
///
/// Kodi is noted as having a very flexible and robust framework for its
/// GUI, making theme-skinning and personal customization very accessible.
/// Users can create their own skin (or modify an existing skin) and share
/// it with others.
///
/// Kodi includes a new GUI library written from scratch. This library
/// allows you to skin/change everything you see in Kodi, from the images,
/// the sizes and positions of all controls, colours, fonts, and text,
/// through to altering navigation and even adding new functionality. The
/// skin system is quite complex, and this portion of the manual is dedicated
/// to providing in depth information on how it all works, along with tips
/// to make the experience a little more pleasant.
///
///-------------------------------------------------------------------------
//
class Control : public AddonClass
{
protected:
Control() = default;
public:
~Control() override;
#ifndef SWIG
virtual CGUIControl* Create();
#endif
// currently we only accept messages from a button or controllist with a select action
virtual bool canAcceptMessages(int actionId) { return false; }
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ getId() }
///-----------------------------------------------------------------------
/// Returns the control's current id as an integer.
///
/// @return int - Current id
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// id = self.button.getId()
/// ...
/// ~~~~~~~~~~~~~
///
getId()
#else
virtual int getId() { return iControlId; }
#endif
inline bool operator==(const Control& other) const { return iControlId == other.iControlId; }
inline bool operator>(const Control& other) const { return iControlId > other.iControlId; }
inline bool operator<(const Control& other) const { return iControlId < other.iControlId; }
// hack this because it returns a tuple
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ getPosition() }
///-----------------------------------------------------------------------
/// Returns the control's current position as a x,y integer tuple.
///
/// @return Current position as a x,y integer tuple
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// pos = self.button.getPosition()
/// ...
/// ~~~~~~~~~~~~~
///
getPosition();
#else
virtual std::vector<int> getPosition();
#endif
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ getX() }
///-----------------------------------------------------------------------
/// Returns the control's current X position.
///
/// @return int - Current X position
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// posX = self.button.getX()
/// ...
/// ~~~~~~~~~~~~~
///
getX();
#else
int getX() { return dwPosX; }
#endif
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ getY() }
///-----------------------------------------------------------------------
/// Returns the control's current Y position.
///
/// @return int - Current Y position
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// posY = self.button.getY()
/// ...
/// ~~~~~~~~~~~~~
///
getY();
#else
int getY() { return dwPosY; }
#endif
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ getHeight() }
///-----------------------------------------------------------------------
/// Returns the control's current height as an integer.
///
/// @return int - Current height
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// height = self.button.getHeight()
/// ...
/// ~~~~~~~~~~~~~
///
getHeight();
#else
virtual int getHeight() { return dwHeight; }
#endif
// getWidth() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ getWidth() }
///-----------------------------------------------------------------------
/// Returns the control's current width as an integer.
///
/// @return int - Current width
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// width = self.button.getWidth()
/// ...
/// ~~~~~~~~~~~~~
///
getWidth();
#else
virtual int getWidth() { return dwWidth; }
#endif
// setEnabled() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setEnabled(enabled) }
///-----------------------------------------------------------------------
/// Set's the control's enabled/disabled state.
///
/// @param enabled bool - True=enabled / False=disabled.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.setEnabled(False)
/// ...
/// ~~~~~~~~~~~~~
///
setEnabled(...);
#else
virtual void setEnabled(bool enabled);
#endif
// setVisible() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setVisible(visible) }
///-----------------------------------------------------------------------
/// Set's the control's visible/hidden state.
///
/// @param visible bool - True=visible / False=hidden.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.setVisible(False)
/// ...
/// ~~~~~~~~~~~~~
///
setVisible(...);
#else
virtual void setVisible(bool visible);
#endif
// isVisible() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ isVisible() }
///-----------------------------------------------------------------------
/// Get the control's visible/hidden state.
///
///-----------------------------------------------------------------------
/// @python_v18 New function added.
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// if self.button.isVisible():
/// ...
/// ~~~~~~~~~~~~~
///
isVisible(...);
#else
virtual bool isVisible();
#endif
// setVisibleCondition() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setVisibleCondition(visible[,allowHiddenFocus]) }
///-----------------------------------------------------------------------
/// Set's the control's visible condition.
///
/// Allows Kodi to control the visible status of the control.
///
/// [List of Conditions](http://kodi.wiki/view/List_of_Boolean_Conditions)
///
/// @param visible string - Visible condition
/// @param allowHiddenFocus [opt] bool - True=gains focus even if
/// hidden
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// # setVisibleCondition(visible[,allowHiddenFocus])
/// self.button.setVisibleCondition('[Control.IsVisible(41) + !Control.IsVisible(12)]', True)
/// ...
/// ~~~~~~~~~~~~~
///
setVisibleCondition(...);
#else
virtual void setVisibleCondition(const char* visible, bool allowHiddenFocus = false);
#endif
// setEnableCondition() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setEnableCondition(enable) }
///-----------------------------------------------------------------------
/// Set's the control's enabled condition.
///
/// Allows Kodi to control the enabled status of the control.
///
/// [List of Conditions](http://kodi.wiki/view/List_of_Boolean_Conditions)
///
/// @param enable string - Enable condition.
///
///
///--------------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// # setEnableCondition(enable)
/// self.button.setEnableCondition('System.InternetState')
/// ...
/// ~~~~~~~~~~~~~
///
setEnableCondition(...);
#else
virtual void setEnableCondition(const char* enable);
#endif
// setAnimations() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setAnimations([(event, attr,)*]) }
///-----------------------------------------------------------------------
/// Set's the control's animations.
///
/// <b>[(event,attr,)*]</b>: list - A list of tuples consisting of event
/// and attributes pairs.
///
/// [Animating your skin](http://kodi.wiki/view/Animating_Your_Skin)
///
/// @param event string - The event to animate.
/// @param attr string - The whole attribute string
/// separated by spaces.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// # setAnimations([(event, attr,)*])
/// self.button.setAnimations([('focus', 'effect=zoom end=90,247,220,56 time=0',)])
/// ...
/// ~~~~~~~~~~~~~
///
setAnimations(...);
#else
virtual void setAnimations(const std::vector< Tuple<String,String> >& eventAttr);
#endif
// setPosition() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setPosition(x, y) }
///-----------------------------------------------------------------------
/// Set's the controls position.
///
/// @param x integer - x coordinate of control.
/// @param y integer - y coordinate of control.
///
/// @note You may use negative integers. (e.g sliding a control into view)
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.setPosition(100, 250)
/// ...
/// ~~~~~~~~~~~~~
///
setPosition(...);
#else
virtual void setPosition(long x, long y);
#endif
// setWidth() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setWidth(width) }
///-----------------------------------------------------------------------
/// Set's the controls width.
///
/// @param width integer - width of control.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.image.setWidth(100)
/// ...
/// ~~~~~~~~~~~~~
///
setWidth(...);
#else
virtual void setWidth(long width);
#endif
// setHeight() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setHeight(height) }
///-----------------------------------------------------------------------
/// Set's the controls height.
///
/// @param height integer - height of control.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.image.setHeight(100)
/// ...
/// ~~~~~~~~~~~~~
///
setHeight(...);
#else
virtual void setHeight(long height);
#endif
// setNavigation() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ setNavigation(up, down, left, right) }
///-----------------------------------------------------------------------
/// Set's the controls navigation.
///
/// @param up control object - control to navigate to on up.
/// @param down control object - control to navigate to on down.
/// @param left control object - control to navigate to on left.
/// @param right control object - control to navigate to on right.
/// @throw TypeError if one of the supplied arguments is not a
/// control type.
/// @throw ReferenceError if one of the controls is not added to a
/// window.
///
/// @note Same as controlUp(), controlDown(), controlLeft(), controlRight().
/// Set to self to disable navigation for that direction.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.setNavigation(self.button1, self.button2, self.button3, self.button4)
/// ...
/// ~~~~~~~~~~~~~
//
setNavigation(...);
#else
virtual void setNavigation(const Control* up, const Control* down,
const Control* left, const Control* right);
#endif
// controlUp() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ controlUp(control) }
///-----------------------------------------------------------------------
/// Set's the controls up navigation.
///
/// @param control control object - control to navigate to on up.
/// @throw TypeError if one of the supplied arguments is not a
/// control type.
/// @throw ReferenceError if one of the controls is not added to a
/// window.
///
///
/// @note You can also use setNavigation(). Set to self to disable navigation.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.controlUp(self.button1)
/// ...
/// ~~~~~~~~~~~~~
///
controlUp(...);
#else
virtual void controlUp(const Control* up);
#endif
// controlDown() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ controlDown(control) }
///-----------------------------------------------------------------------
/// Set's the controls down navigation.
///
/// @param control control object - control to navigate to on down.
/// @throw TypeError if one of the supplied arguments is not a
/// control type.
/// @throw ReferenceError if one of the controls is not added to a
/// window.
///
///
/// @note You can also use setNavigation(). Set to self to disable navigation.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.controlDown(self.button1)
/// ...
/// ~~~~~~~~~~~~~
///
controlDown(...);
#else
virtual void controlDown(const Control* control);
#endif
// controlLeft() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ controlLeft(control) }
///-----------------------------------------------------------------------
/// Set's the controls left navigation.
///
/// @param control control object - control to navigate to on left.
/// @throw TypeError if one of the supplied arguments is not a
/// control type.
/// @throw ReferenceError if one of the controls is not added to a
/// window.
///
///
/// @note You can also use setNavigation(). Set to self to disable navigation.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.controlLeft(self.button1)
/// ...
/// ~~~~~~~~~~~~~
///
controlLeft(...);
#else
virtual void controlLeft(const Control* control);
#endif
// controlRight() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control
/// @brief \python_func{ controlRight(control) }
///-----------------------------------------------------------------------
/// Set's the controls right navigation.
///
/// @param control control object - control to navigate to on right.
/// @throw TypeError if one of the supplied arguments is not a
/// control type.
/// @throw ReferenceError if one of the controls is not added to a
/// window.
///
///
/// @note You can also use setNavigation(). Set to self to disable navigation.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.button.controlRight(self.button1)
/// ...
/// ~~~~~~~~~~~~~
///
controlRight(...);
#else
virtual void controlRight(const Control* control);
#endif
#ifndef SWIG
int iControlId = 0;
int iParentId = 0;
int dwPosX = 0;
int dwPosY = 0;
int dwWidth = 0;
int dwHeight = 0;
int iControlUp = 0;
int iControlDown = 0;
int iControlLeft = 0;
int iControlRight = 0;
CGUIControl* pGUIControl = nullptr;
#endif
};
/// @}
/// \defgroup python_xbmcgui_control_spin Subclass - ControlSpin
/// \ingroup python_xbmcgui_control
/// @{
/// @brief **Used for cycling up/down controls.**
///
/// Offers classes and functions that manipulate the add-on gui controls.
///
///-------------------------------------------------------------------------
///
/// \python_class{ ControlSpin() }
///
/// **Code based skin access.**
///
/// The spin control is used for when a list of options can be chosen (such
/// as a page up/down control). You can choose the position, size, and look
/// of the spin control.
///
/// @note This class include also all calls from \ref python_xbmcgui_control "Control"
///
/// @warning **Not working yet**.
/// You can't create this object, it is returned by objects like ControlTextBox and ControlList.
///
///
///-------------------------------------------------------------------------
///
///
class ControlSpin : public Control
{
public:
~ControlSpin() override;
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control_spin
/// @brief \python_func{ setTextures(up, down, upFocus, downFocus) }
///-----------------------------------------------------------------------
/// Set's textures for this control.
///
/// Texture are image files that are used for example in the skin
///
/// @warning **Not working yet**.
///
/// @param up label - for the up arrow
/// when it doesn't have focus.
/// @param down label - for the down button
/// when it is not focused.
/// @param upFocus label - for the up button
/// when it has focus.
/// @param downFocus label - for the down button
/// when it has focus.
/// @param upDisabled label - for the up arrow
/// when the button is disabled.
/// @param downDisabled label - for the up arrow
/// when the button is disabled.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// # setTextures(up, down, upFocus, downFocus, upDisabled, downDisabled)
///
/// ...
/// ~~~~~~~~~~~~~
///
setTextures(...);
#else
virtual void setTextures(const char* up, const char* down,
const char* upFocus,
const char* downFocus,
const char* upDisabled, const char* downDisabled);
#endif
#ifndef SWIG
UTILS::Color color;
std::string strTextureUp;
std::string strTextureDown;
std::string strTextureUpFocus;
std::string strTextureDownFocus;
std::string strTextureUpDisabled;
std::string strTextureDownDisabled;
#endif
private:
ControlSpin();
friend class Window;
friend class ControlList;
};
/// @}
/// \defgroup python_xbmcgui_control_label Subclass - ControlLabel
/// \ingroup python_xbmcgui_control
/// @{
/// @brief **Used to show some lines of text.**
///
/// \python_class{ ControlLabel(x, y, width, height, label[, font, textColor,
/// disabledColor, alignment, hasPath, angle]) }
///
/// The label control is used for displaying text in Kodi. You can choose
/// the font, size, colour, location and contents of the text to be
/// displayed.
///
/// @note This class include also all calls from \ref python_xbmcgui_control "Control"
///
/// @param x integer - x coordinate of control.
/// @param y integer - y coordinate of control.
/// @param width integer - width of control.
/// @param height integer - height of control.
/// @param label string or unicode - text string.
/// @param font [opt] string - font used for label
/// text. (e.g. 'font13')
/// @param textColor [opt] hexstring - color of enabled
/// label's label. (e.g. '0xFFFFFFFF')
/// @param disabledColor [opt] hexstring - color of disabled
/// label's label. (e.g. '0xFFFF3300')
/// @param alignment [opt] integer - alignment of label
/// - \ref kodi_gui_font_alignment "Flags for alignment" used as bits to have several together:
/// | Defination name | Bitflag | Description |
/// |-------------------|:----------:|:------------------------------------|
/// | XBFONT_LEFT | 0x00000000 | Align X left
/// | XBFONT_RIGHT | 0x00000001 | Align X right
/// | XBFONT_CENTER_X | 0x00000002 | Align X center
/// | XBFONT_CENTER_Y | 0x00000004 | Align Y center
/// | XBFONT_TRUNCATED | 0x00000008 | Truncated text
/// | XBFONT_JUSTIFIED | 0x00000010 | Justify text
/// @param hasPath [opt] bool - True=stores a
/// path / False=no path
/// @param angle [opt] integer - angle of control.
/// (<b>+</b> rotates CCW, <b>-</b> rotates C)
///
///
///-------------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// # ControlLabel(x, y, width, height, label[, font, textColor,
/// # disabledColor, alignment, hasPath, angle])
/// self.label = xbmcgui.ControlLabel(100, 250, 125, 75, 'Status', angle=45)
/// ...
/// ~~~~~~~~~~~~~
///
class ControlLabel : public Control
{
public:
ControlLabel(long x, long y, long width, long height, const String& label,
const char* font = NULL, const char* textColor = NULL,
const char* disabledColor = NULL,
long alignment = XBFONT_LEFT,
bool hasPath = false, long angle = 0);
~ControlLabel() override;
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control_label
/// @brief \python_func{ getLabel() }
///-----------------------------------------------------------------------
/// Returns the text value for this label.
///
/// @return This label
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// label = self.label.getLabel()
/// ...
/// ~~~~~~~~~~~~~
///
getLabel();
#else
virtual String getLabel();
#endif
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control_label
/// @brief \python_func{ setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor, label2]) }
///-----------------------------------------------------------------------
/// Set's text for this label.
///
/// @param label string or unicode - text string.
/// @param font [opt] string - font used for label text.
/// (e.g. 'font13')
/// @param textColor [opt] hexstring - color of enabled
/// label's label. (e.g. '0xFFFFFFFF')
/// @param disabledColor [opt] hexstring - color of disabled
/// label's label. (e.g. '0xFFFF3300')
/// @param shadowColor [opt] hexstring - color of button's
/// label's shadow. (e.g. '0xFF000000')
/// @param focusedColor [opt] hexstring - color of focused
/// button's label. (e.g. '0xFF00FFFF')
/// @param label2 [opt] string or unicode - text string.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.label.setLabel('Status')
/// ...
/// ~~~~~~~~~~~~~
///
setLabel(...);
#else
virtual void setLabel(const String& label = emptyString,
const char* font = NULL,
const char* textColor = NULL,
const char* disabledColor = NULL,
const char* shadowColor = NULL,
const char* focusedColor = NULL,
const String& label2 = emptyString);
#endif
#ifndef SWIG
ControlLabel() = default;
std::string strFont;
std::string strText;
UTILS::Color textColor;
UTILS::Color disabledColor;
uint32_t align;
bool bHasPath = false;
int iAngle = 0;
CGUIControl* Create() override;
#endif
};
/// @}
// ControlEdit class
/// \defgroup python_xbmcgui_control_edit Subclass - ControlEdit
/// \ingroup python_xbmcgui_control
/// @{
/// **Used as an input control for the osd keyboard and other input fields.**
///
/// \python_class{ ControlEdit(x, y, width, height, label[, font, textColor,
/// disabledColor, alignment, focusTexture, noFocusTexture]) }
///
/// The edit control allows a user to input text in Kodi. You can choose the
/// font, size, colour, location and header of the text to be displayed.
///
/// @note This class include also all calls from \ref python_xbmcgui_control "Control"
///
/// @param x integer - x coordinate of control.
/// @param y integer - y coordinate of control.
/// @param width integer - width of control.
/// @param height integer - height of control.
/// @param label string or unicode - text string.
/// @param font [opt] string - font used for label text.
/// (e.g. 'font13')
/// @param textColor [opt] hexstring - color of enabled
/// label's label. (e.g. '0xFFFFFFFF')
/// @param disabledColor [opt] hexstring - color of disabled
/// label's label. (e.g. '0xFFFF3300')
/// @param alignment [opt] integer - alignment of label
/// - \ref kodi_gui_font_alignment "Flags for alignment" used as bits to have several together:
/// | Defination name | Bitflag | Description |
/// |-------------------|:----------:|:------------------------------------|
/// | XBFONT_LEFT | 0x00000000 | Align X left
/// | XBFONT_RIGHT | 0x00000001 | Align X right
/// | XBFONT_CENTER_X | 0x00000002 | Align X center
/// | XBFONT_CENTER_Y | 0x00000004 | Align Y center
/// | XBFONT_TRUNCATED | 0x00000008 | Truncated text
/// | XBFONT_JUSTIFIED | 0x00000010 | Justify text
/// @param focusTexture [opt] string - filename for focus texture.
/// @param noFocusTexture [opt] string - filename for no focus texture.
/// @param isPassword [opt] bool - True=mask text value with `****`(deprecated, use setType()).
///
/// @note You can use the above as keywords for arguments and skip certain
/// optional arguments.\n
/// Once you use a keyword, all following arguments require the keyword.\n
/// After you create the control, you need to add it to the window with
/// addControl().\n
///
///
///
///-------------------------------------------------------------------------
/// @python_v18 Deprecated **isPassword**
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.edit = xbmcgui.ControlEdit(100, 250, 125, 75, 'Status')
/// ...
/// ~~~~~~~~~~~~~
///
class ControlEdit : public Control
{
public:
ControlEdit(long x, long y, long width, long height, const String& label,
const char* font = NULL, const char* textColor = NULL,
const char* disabledColor = NULL,
long _alignment = XBFONT_LEFT, const char* focusTexture = NULL,
const char* noFocusTexture = NULL, bool isPassword = false);
// setLabel() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control_edit
/// @brief \python_func{ setLabel(label[, font, textColor, disabledColor, shadowColor, focusedColor, label2]) }
///-----------------------------------------------------------------------
/// Set's text heading for this edit control.
///
/// @param label string or unicode - text string.
/// @param font [opt] string - font used for label text.
/// (e.g. 'font13')
/// @param textColor [opt] hexstring - color of enabled
/// label's label. (e.g. '0xFFFFFFFF')
/// @param disabledColor [opt] hexstring - color of disabled
/// label's label. (e.g. '0xFFFF3300')
/// @param shadowColor [opt] hexstring - color of button's
/// label's shadow. (e.g. '0xFF000000')
/// @param focusedColor [opt] hexstring - color of focused
/// button's label. (e.g. '0xFF00FFFF')
/// @param label2 [opt] string or unicode - text string.
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// self.edit.setLabel('Status')
/// ...
/// ~~~~~~~~~~~~~
///
setLabel(...);
#else
virtual void setLabel(const String& label = emptyString,
const char* font = NULL,
const char* textColor = NULL,
const char* disabledColor = NULL,
const char* shadowColor = NULL,
const char* focusedColor = NULL,
const String& label2 = emptyString);
#endif
// getLabel() Method
#ifdef DOXYGEN_SHOULD_USE_THIS
/// \ingroup python_xbmcgui_control_edit
/// @brief \python_func{ getLabel() }
///-----------------------------------------------------------------------
/// Returns the text heading for this edit control.
///
/// @return Heading text
///
///
///-----------------------------------------------------------------------
///
/// **Example:**
/// ~~~~~~~~~~~~~{.py}
/// ...
/// label = self.edit.getLabel()
/// ...
/// ~~~~~~~~~~~~~
///
getLabel();
#else
virtual String getLabel();
#endif
// setText() Method