|
Lines 391-399
public class Button extends Control {
Link Here
|
| 391 |
width += extent.x; |
391 |
width += extent.x; |
| 392 |
height = Math.max( height, extent.y ); |
392 |
height = Math.max( height, extent.y ); |
| 393 |
} |
393 |
} |
| 394 |
if( width == 0 ) { |
|
|
| 395 |
width = 1; |
| 396 |
} |
| 397 |
if( height == 0 ) { |
394 |
if( height == 0 ) { |
| 398 |
height = 10; |
395 |
height = 10; |
| 399 |
} |
396 |
} |
|
Lines 405-411
public class Button extends Control {
Link Here
|
| 405 |
} |
402 |
} |
| 406 |
if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) { |
403 |
if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) { |
| 407 |
Point checkSize = themeAdapter.getCheckSize( this ); |
404 |
Point checkSize = themeAdapter.getCheckSize( this ); |
| 408 |
width += checkSize.x + themeAdapter.getCheckSpacing( this ); |
405 |
width += checkSize.x; |
|
|
406 |
if (hasText || hasImage) { |
| 407 |
width += themeAdapter.getCheckSpacing( this ); |
| 408 |
} |
| 409 |
height = Math.max( height, checkSize.y ); |
409 |
height = Math.max( height, checkSize.y ); |
| 410 |
} |
410 |
} |
| 411 |
Rectangle padding = themeAdapter.getPadding( this ); |
411 |
Rectangle padding = themeAdapter.getPadding( this ); |
| 412 |
bug 330334 [Button (CHECK)] Improve computeSize implementation for the case there is no Image / Text |
412 |
bug 330334 [Button (CHECK)] Improve computeSize implementation for the case there is no Image / Text |
| 413 |
|
413 |
|
| 414 |
Patch to reproduce the problem. |
414 |
Patch to reproduce the problem. |
| 415 |
|
415 |
|
| 416 |
--- |
416 |
--- |
| 417 |
|
417 |
|
| 418 |
Improve the computeSize implementation in the Button.java |
418 |
Improve the computeSize implementation in the Button.java |
| 419 |
class for the case |
419 |
class for the case |
| 420 |
- there is no Image and Text, and |
420 |
- there is no Image and Text, and |
| 421 |
- the Button is of type SWT.CHECK |
421 |
- the Button is of type SWT.CHECK |
| 422 |
|
422 |
|
| 423 |
ie. |
423 |
ie. |
| 424 |
- add the spacing to the width (that serves to separate the check symbol |
424 |
- add the spacing to the width (that serves to separate the check symbol |
| 425 |
and the text / image) only if there is a text or image. |
425 |
and the text / image) only if there is a text or image. |
| 426 |
- if there is no text and image, do not initialise the width with 1 |
426 |
- if there is no text and image, do not initialise the width with 1 |
| 427 |
(I couldn't find any usecase for that); 0 is appropriate |
427 |
(I couldn't find any usecase for that); 0 is appropriate |