|
Lines 23-44
Link Here
|
| 23 |
// Default values |
23 |
// Default values |
| 24 |
this._selected = false; |
24 |
this._selected = false; |
| 25 |
this._grayed = false; |
25 |
this._grayed = false; |
| 26 |
this._text = ""; |
|
|
| 27 |
this._image = null; |
| 28 |
this._hasSelectionListener = false; |
26 |
this._hasSelectionListener = false; |
| 29 |
|
27 |
|
| 30 |
// CheckButton icon |
28 |
// CheckButton icon |
| 31 |
this._icon = new qx.ui.basic.Image; |
29 |
this._icon = new qx.ui.basic.Image; |
| 32 |
this._icon.setAppearance( "check-box-icon" ); |
30 |
this._icon.setAppearance( "check-box-icon" ); |
| 33 |
this.add( this._icon ); |
31 |
this.add( this._icon ); |
| 34 |
|
32 |
|
| 35 |
// CheckButton content - image and text |
33 |
// CheckButton image |
| 36 |
this._content = new qx.ui.basic.Atom( "(empty)", this._image ); |
34 |
this._image = new qx.ui.basic.Image; |
| 37 |
this._content.getLabelObject().setAppearance( "label-graytext" ); |
35 |
this._image.setDisplay( false ); |
| 38 |
this._content.setLabel( this._text ); |
36 |
this.add( this._image ); |
| 39 |
this._content.setHorizontalChildrenAlign( "center" ); |
37 |
|
| 40 |
this._content.setVerticalChildrenAlign( "middle" ); |
38 |
// CheckButton text |
| 41 |
this.add( this._content ); |
39 |
this._text = new qx.ui.basic.Label; |
|
|
40 |
this._text.setAppearance( "label-graytext" ); |
| 41 |
this._text.setText( "" ); |
| 42 |
this._text.setCursor( "default" ); |
| 43 |
this._text.setDisplay( false ); |
| 44 |
this.add( this._text ); |
| 42 |
|
45 |
|
| 43 |
// Add events listeners |
46 |
// Add events listeners |
| 44 |
this.addEventListener( "contextmenu", this._onContextMenu, this ); |
47 |
this.addEventListener( "contextmenu", this._onContextMenu, this ); |
|
Lines 54-60
Link Here
|
| 54 |
this.removeEventListener( "mouseover", this._onmouseover ); |
57 |
this.removeEventListener( "mouseover", this._onmouseover ); |
| 55 |
this.removeEventListener( "mouseout", this._onmouseout ); |
58 |
this.removeEventListener( "mouseout", this._onmouseout ); |
| 56 |
this.removeEventListener( "keyup", this._onkeyup ); |
59 |
this.removeEventListener( "keyup", this._onkeyup ); |
| 57 |
this._disposeObjects( "_icon", "_content" ); |
60 |
this._disposeObjects( "_icon", "_image", "_text" ); |
| 58 |
}, |
61 |
}, |
| 59 |
|
62 |
|
| 60 |
members : { |
63 |
members : { |
|
Lines 84-92
Link Here
|
| 84 |
_applyCursor : function( value, old ) { |
87 |
_applyCursor : function( value, old ) { |
| 85 |
this.base( arguments, value, old ); |
88 |
this.base( arguments, value, old ); |
| 86 |
if( value ) { |
89 |
if( value ) { |
| 87 |
this._content.setCursor( value ); |
90 |
this._image.setCursor( value ); |
|
|
91 |
this._text.setCursor( value ); |
| 88 |
} else { |
92 |
} else { |
| 89 |
this._content.resetCursor(); |
93 |
this._image.resetCursor(); |
|
|
94 |
this._text.setCursor( "default" ); |
| 90 |
} |
95 |
} |
| 91 |
}, |
96 |
}, |
| 92 |
|
97 |
|
|
Lines 118-134
Link Here
|
| 118 |
}, |
123 |
}, |
| 119 |
|
124 |
|
| 120 |
setLabel : function( value ) { |
125 |
setLabel : function( value ) { |
| 121 |
this._text = value; |
126 |
this._text.setText( value ); |
| 122 |
this._content.setLabel( value ); |
127 |
if( value != "" ) { |
|
|
128 |
this._text.setDisplay( true ); |
| 129 |
} |
| 123 |
}, |
130 |
}, |
| 124 |
|
131 |
|
| 125 |
setIcon : function( value ) { |
132 |
setIcon : function( value ) { |
| 126 |
this._image = value; |
133 |
this._image.setSource( value ); |
| 127 |
this._content.setIcon( value ); |
134 |
if( value ) { |
|
|
135 |
this._image.setDisplay( true ); |
| 136 |
} |
| 128 |
}, |
137 |
}, |
| 129 |
|
138 |
|
| 130 |
setHorizontalChildrenAlign : function( value ) { |
139 |
setHorizontalChildrenAlign : function( value ) { |
| 131 |
this._content.setHorizontalChildrenAlign( value ); |
140 |
this._text.setTextAlign( value ); |
| 132 |
}, |
141 |
}, |
| 133 |
|
142 |
|
| 134 |
setSelection : function( value ) { |
143 |
setSelection : function( value ) { |