1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 from pyjamas import DOM
16 from pyjamas import Factory
17
18 from pyjamas.ui.ButtonBase import ButtonBase
19 from pyjamas.ui import Event
20 from pyjamas.ui import Focus
21
22 _CheckBox_unique_id=0;
25
26 _props = [("name", "Name", "Name", None),
27 ]
28 - def __init__(self, label=None, asHTML=False, **ka):
29 ka['StyleName'] = ka.get('StyleName', "gwt-CheckBox")
30 if label:
31 if asHTML:
32 ka['HTML'] = label
33 else:
34 ka['Text'] = label
35 element = ka.pop('Element', None) or DOM.createInputCheck()
36 self.initElement(element, **ka)
37
38 @classmethod
41
42
44 """ Unlike other widgets the CheckBox sinks on its inputElement,
45 not its wrapper
46 """
47 eventBitsToAdd |= DOM.getEventsSunk(self.inputElem)
48 DOM.sinkEvents(self.inputElem, eventBitsToAdd)
49
64
65
70
73
76
78 return DOM.getInnerText(self.labelElem)
79
83
85 """ XXX this function is deprecated: use getChecked
86 """
87 return self.getChecked()
88
96
98 """ XXX this function is deprecated: use getEnabled
99 """
100 return self.getEnabled()
101
104
107
113
116
119
122
123 - def setText(self, text):
124 DOM.setInnerText(self.labelElem, text)
125
129
130 Factory.registerClass('pyjamas.ui.CheckBox', 'CheckBox', CheckBox)
131