Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 236490 Details for
Bug 419441
[Button] computeSize algorithm is wrong when using SWT.WRAP
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch proposal
Fix-bug419441.patch (text/plain), 2.51 KB, created by
Sebastien Arod
on 2013-10-15 11:27:57 EDT
(
hide
)
Description:
Patch proposal
Filename:
MIME Type:
Creator:
Sebastien Arod
Created:
2013-10-15 11:27:57 EDT
Size:
2.51 KB
patch
obsolete
>diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Button.java >index 53df3b8..f9955cc 100644 >--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Button.java >+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Button.java >@@ -379,15 +379,34 @@ > int height = 0; > boolean hasImage = image != null; > boolean hasText = text.length() > 0; >- if( hasImage ) { >+ ButtonThemeAdapter themeAdapter = ( ButtonThemeAdapter )getAdapter( IThemeAdapter.class ); >+ Rectangle padding = themeAdapter.getPadding( this ); >+ if( hasImage ) { > Rectangle imageBounds = image.getBounds (); > width = imageBounds.width; > height = imageBounds.height; > } >+ if( hasText && hasImage ) { >+ int spacing = themeAdapter.getSpacing( this ); >+ width += spacing; >+ } > if( hasText ) { > Point extent; > if( ( style & SWT.WRAP ) != 0 ) { >- extent = TextSizeUtil.textExtent( getFont(), text, wHint ); >+ int wrapWidth = wHint; >+ if (wHint != SWT.DEFAULT) { >+ // Width is constrained so compute width remaining for text when all other button elements are displayed >+ int checkOrRadioWidth = 0; >+ if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) { >+ Point checkSize = themeAdapter.getCheckSize( this ); >+ checkOrRadioWidth = checkSize.x; >+ if( hasText || hasImage ) { >+ checkOrRadioWidth += themeAdapter.getCheckSpacing( this ); >+ } >+ } >+ wrapWidth = wHint - (width + checkOrRadioWidth + padding.width); >+ } >+ extent = TextSizeUtil.textExtent( getFont(), text, wrapWidth ); > } else { > extent = TextSizeUtil.stringExtent( getFont(), text ); > } >@@ -396,12 +415,7 @@ > } > if( height == 0 ) { > height = 10; >- } >- ButtonThemeAdapter themeAdapter = ( ButtonThemeAdapter )getAdapter( IThemeAdapter.class ); >- if( hasText && hasImage ) { >- int spacing = themeAdapter.getSpacing( this ); >- width += spacing; >- } >+ } > if( ( style & ( SWT.CHECK | SWT.RADIO ) ) != 0 ) { > Point checkSize = themeAdapter.getCheckSize( this ); > width += checkSize.x; >@@ -413,7 +427,6 @@ > width = themeAdapter.getArrowSize( this ).x; > height = themeAdapter.getArrowSize( this ).y; > } >- Rectangle padding = themeAdapter.getPadding( this ); > width += padding.width; > height += padding.height; > if( wHint != SWT.DEFAULT ) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 419441
: 236490