diff options
author | Felipe Heidrich <fheidric> | 2006-02-03 20:52:35 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2006-02-03 20:52:35 +0000 |
commit | 4c866768b6eda55a673d73ef33b7ef346101cbc0 (patch) | |
tree | 8ae24e1c3a6bdcbd204f372c32421c9fcfdc4dfb /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java | |
parent | cf6d924932aa6fed339ec8b1638742047d9b02cf (diff) | |
download | eclipse.platform.swt-4c866768b6eda55a673d73ef33b7ef346101cbc0.tar.gz eclipse.platform.swt-4c866768b6eda55a673d73ef33b7ef346101cbc0.tar.xz eclipse.platform.swt-4c866768b6eda55a673d73ef33b7ef346101cbc0.zip |
*** empty log message ***
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java index 8cb79b3099..a1a03b173b 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/ExpandBar.java @@ -120,21 +120,23 @@ public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget (); int height = 0, width = 0; if (wHint == SWT.DEFAULT || hHint == SWT.DEFAULT) { - int hDC = OS.GetDC (handle); - int hTheme = 0; - if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { - hTheme = OS.OpenThemeData (handle, EXPLORERBAR); - } - height += spacing; - for (int i = 0; i < itemCount; i++) { - ExpandItem item = items [i]; - height += ExpandBar.HEADER_HEIGHT; - if (item.expanded) height += item.height; + if (itemCount > 0) { + int hDC = OS.GetDC (handle); + int hTheme = 0; + if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) { + hTheme = OS.OpenThemeData (handle, EXPLORERBAR); + } height += spacing; - width = Math.max (width, item.getPreferredWidth (hTheme, hDC)); - } - OS.ReleaseDC (handle, hDC); - if (hTheme != 0) OS.CloseThemeData (hTheme); + for (int i = 0; i < itemCount; i++) { + ExpandItem item = items [i]; + height += ExpandBar.HEADER_HEIGHT; + if (item.expanded) height += item.height; + height += spacing; + width = Math.max (width, item.getPreferredWidth (hTheme, hDC)); + } + OS.ReleaseDC (handle, hDC); + if (hTheme != 0) OS.CloseThemeData (hTheme); + } } if (width == 0) width = DEFAULT_WIDTH; if (height == 0) height = DEFAULT_HEIGHT; |