Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 284378
Collapse All | Expand All

(-)src/org/eclipse/swt/internal/widgets/buttonkit/ButtonThemeAdapter.java (-5 lines)
Lines 22-28 Link Here
22
public final class ButtonThemeAdapter extends ControlThemeAdapter {
22
public final class ButtonThemeAdapter extends ControlThemeAdapter {
23
23
24
  private static final Point CHECK_SIZE = new Point( 13, 13 );
24
  private static final Point CHECK_SIZE = new Point( 13, 13 );
25
  private static final int CHECK_SPACING = 4;
26
25
27
  protected void configureMatcher( final WidgetMatcher matcher ) {
26
  protected void configureMatcher( final WidgetMatcher matcher ) {
28
    super.configureMatcher( matcher );
27
    super.configureMatcher( matcher );
Lines 41-50 Link Here
41
    return getCssDimension( "Button", "spacing", button );
40
    return getCssDimension( "Button", "spacing", button );
42
  }
41
  }
43
42
44
  public int getCheckSpacing( final Button button ) {
45
    return CHECK_SPACING;
46
  }
47
48
  public Point getCheckSize( final Button button ) {
43
  public Point getCheckSize( final Button button ) {
49
    return CHECK_SIZE;
44
    return CHECK_SIZE;
50
  }
45
  }
(-)src/org/eclipse/swt/widgets/Button.java (-1 / +1 lines)
Lines 400-406 Link Here
400
    }
400
    }
401
    if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) {
401
    if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) {
402
      Point checkSize = themeAdapter.getCheckSize( this );
402
      Point checkSize = themeAdapter.getCheckSize( this );
403
      width += checkSize.x + themeAdapter.getCheckSpacing( this );
403
      width += checkSize.x + themeAdapter.getSpacing( this );
404
      height = Math.max( height, checkSize.y );
404
      height = Math.max( height, checkSize.y );
405
    }
405
    }
406
    Rectangle padding = themeAdapter.getPadding( this );
406
    Rectangle padding = themeAdapter.getPadding( this );
(-)js/org/eclipse/swt/widgets/RadioButton.js (-17 / +26 lines)
Lines 22-29 Link Here
22
    
22
    
23
    // Default values
23
    // Default values
24
    this._selection = false;
24
    this._selection = false;
25
    this._text = "";
26
    this._image = null;
27
    this._hasSelectionListener = false;
25
    this._hasSelectionListener = false;
28
    
26
    
29
    // RadioButton icon
27
    // RadioButton icon
Lines 31-43 Link Here
31
    this._icon.setAppearance( "radio-button-icon" );
29
    this._icon.setAppearance( "radio-button-icon" );
32
    this.add( this._icon );
30
    this.add( this._icon );
33
    
31
    
34
    // RadioButton content - image and text
32
    // RadioButton image
35
    this._content = new qx.ui.basic.Atom( "(empty)", this._image );
33
    this._image = new qx.ui.basic.Image;
36
    this._content.getLabelObject().setAppearance( "label-graytext" );
34
    this._image.setDisplay( false );
37
    this._content.setLabel( this._text );
35
    this.add( this._image );
38
    this._content.setHorizontalChildrenAlign( "center" );
36
    
39
    this._content.setVerticalChildrenAlign( "middle" );
37
    // RadioButton text
40
    this.add( this._content );
38
    this._text = new qx.ui.basic.Label;
39
    this._text.setAppearance( "label-graytext" );
40
    this._text.setText( "" );
41
    this._text.setCursor( "default" );
42
    this._text.setDisplay( false );
43
    this.add( this._text );
41
44
42
    // Add events listeners
45
    // Add events listeners
43
    this.addEventListener( "contextmenu", this._onContextMenu, this );
46
    this.addEventListener( "contextmenu", this._onContextMenu, this );
Lines 55-61 Link Here
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.removeEventListener( "keypress", this._onkeypress );
60
    this.removeEventListener( "keypress", this._onkeypress );
58
    this._disposeObjects( "_icon", "_content" );
61
    this._disposeObjects( "_icon", "_image", "_text" );
59
  },  
62
  },  
60
  
63
  
61
  members : {
64
  members : {
Lines 72-80 Link Here
72
    _applyCursor : function( value, old ) {
75
    _applyCursor : function( value, old ) {
73
      this.base( arguments, value, old );
76
      this.base( arguments, value, old );
74
      if( value ) {
77
      if( value ) {
75
        this._content.setCursor( value );
78
        this._image.setCursor( value );
79
        this._text.setCursor( value );
76
      } else {
80
      } else {
77
        this._content.resetCursor();
81
        this._image.resetCursor();
82
        this._text.setCursor( "default" );
78
      }
83
      }
79
    },
84
    },
80
85
Lines 176-192 Link Here
176
    },
181
    },
177
    
182
    
178
    setLabel : function( value ) {
183
    setLabel : function( value ) {
179
      this._text = value;
184
      this._text.setText( value );
180
      this._content.setLabel( value );
185
      if( value != "" ) {
186
        this._text.setDisplay( true );
187
      }
181
    },
188
    },
182
    
189
    
183
    setIcon : function( value ) {
190
    setIcon : function( value ) {
184
      this._image = value;
191
      this._image.setSource( value );
185
      this._content.setIcon( value );
192
      if( value ) {
193
        this._image.setDisplay( true );
194
      }
186
    },
195
    },
187
    
196
    
188
    setHorizontalChildrenAlign : function( value ) {
197
    setHorizontalChildrenAlign : function( value ) {
189
      this._content.setHorizontalChildrenAlign( value );
198
      this._text.setTextAlign( value );
190
    },
199
    },
191
    
200
    
192
    setSelection : function( value ) {
201
    setSelection : function( value ) {
(-)js/org/eclipse/swt/widgets/CheckBox.js (-18 / +27 lines)
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 ) {
(-)js/org/eclipse/swt/theme/AppearancesBase.js (-2 / +2 lines)
Lines 237-243 Link Here
237
        backgroundColor : tv.getCssColor( "Button", "background-color" ),
237
        backgroundColor : tv.getCssColor( "Button", "background-color" ),
238
        backgroundImage : tv.getCssImage( "Button", "background-image" ),
238
        backgroundImage : tv.getCssImage( "Button", "background-image" ),
239
        backgroundGradient : tv.getCssGradient( "Button", "background-image" ),
239
        backgroundGradient : tv.getCssGradient( "Button", "background-image" ),
240
        spacing : 4,
240
        spacing : tv.getCssDimension( "Button", "spacing" ),
241
        padding : tv.getCssBoxDimensions( "Button", "padding" )
241
        padding : tv.getCssBoxDimensions( "Button", "padding" )
242
      }
242
      }
243
    }
243
    }
Lines 270-276 Link Here
270
        backgroundColor : tv.getCssColor( "Button", "background-color" ),
270
        backgroundColor : tv.getCssColor( "Button", "background-color" ),
271
        backgroundImage : tv.getCssImage( "Button", "background-image" ),
271
        backgroundImage : tv.getCssImage( "Button", "background-image" ),
272
        backgroundGradient : tv.getCssGradient( "Button", "background-image" ),
272
        backgroundGradient : tv.getCssGradient( "Button", "background-image" ),
273
        spacing : 4,
273
        spacing : tv.getCssDimension( "Button", "spacing" ),
274
        padding : tv.getCssBoxDimensions( "Button", "padding" )
274
        padding : tv.getCssBoxDimensions( "Button", "padding" )
275
      }
275
      }
276
    }
276
    }

Return to bug 284378