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 102960 Details for
Bug 234037
[ToolBar] Preferred size too wide
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 that repairs the width computation of ToolItem
clipboard.txt (text/plain), 2.51 KB, created by
Ralf Sternberg
on 2008-05-30 16:58:46 EDT
(
hide
)
Description:
Patch that repairs the width computation of ToolItem
Filename:
MIME Type:
Creator:
Ralf Sternberg
Created:
2008-05-30 16:58:46 EDT
Size:
2.51 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rap.rwt >Index: src/org/eclipse/swt/widgets/ToolItem.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.rap/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/ToolItem.java,v >retrieving revision 1.16 >diff -u -r1.16 ToolItem.java >--- src/org/eclipse/swt/widgets/ToolItem.java 12 May 2008 10:11:48 -0000 1.16 >+++ src/org/eclipse/swt/widgets/ToolItem.java 30 May 2008 20:41:05 -0000 >@@ -38,7 +38,13 @@ > > private static final int DEFAULT_WIDTH = 24; > private static final int DEFAULT_HEIGHT = 22; >- private static final int DROP_DOWN_ARROW_WIDTH = 13; >+ // TODO [rst] Read these values from ThemeAdapter as soon as ToolItem is >+ // themeable >+ private static final int DROP_DOWN_ARROW_WIDTH = 15; >+ private static final int SEPARATOR_WIDTH = 8; >+ private static final int SPACING = 4; >+ private static final int PADDING_WIDTH = 6; >+ private static final int BORDER_WIDTH = 2; > > private final ToolBar parent; > private boolean selected; >@@ -408,22 +414,23 @@ > if( ( style & SWT.SEPARATOR ) != 0 ) { > result = width; > } else { >- // TODO [rh] must be kept in sync with DefaultAppearanceTheme.js >- result = 7; // approx left + right padding as defined in appearance theme >- if( getImage() != null ) { >- result += getImage().getBounds().width; >+ result = 0; >+ boolean hasImage = image != null; >+ boolean hasText = !"".equals( text ); >+ if( hasImage ) { >+ result += image.getBounds().width; > } >- String text = getText(); >- if( !"".equals( text ) ) { >+ if( hasText ) { > Font font = parent.getFont(); >- // TODO [fappel]: need some more space for the Workbench perspective >- // switcher. Check this after a proper font size >- // calculation is in place >- result += 11 + TextSizeDetermination.stringExtent( font, getText() ).x; >+ result += TextSizeDetermination.stringExtent( font, text ).x; >+ } >+ if( hasText && hasImage ) { >+ result += SPACING; > } > if( ( style & SWT.DROP_DOWN ) != 0 ) { > result += DROP_DOWN_ARROW_WIDTH; > } >+ result += PADDING_WIDTH + BORDER_WIDTH; > } > return result; > } >@@ -594,7 +601,7 @@ > > private void computeInitialWidth() { > if( ( style & SWT.SEPARATOR ) != 0 ) { >- width = 8; >+ width = SEPARATOR_WIDTH; > } else { > width = DEFAULT_WIDTH; > if( ( style & SWT.DROP_DOWN ) != 0 ) {
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 234037
:
102059
| 102960