diff options
author | Silenio Quarti <silenio> | 2005-10-19 19:21:31 +0000 |
---|---|---|
committer | Silenio Quarti <silenio> | 2005-10-19 19:21:31 +0000 |
commit | 39f87846f6f8ce24f2cd0bbd721271690766d3ca (patch) | |
tree | c0fac006773bae144362365eb28dd6a1dbc3292b | |
parent | 7c4a78e98b89e3915f90014ba34390fb70ac683c (diff) | |
download | eclipse.platform.swt-39f87846f6f8ce24f2cd0bbd721271690766d3ca.tar.gz eclipse.platform.swt-39f87846f6f8ce24f2cd0bbd721271690766d3ca.tar.xz eclipse.platform.swt-39f87846f6f8ce24f2cd0bbd721271690766d3ca.zip |
fixing inset and redraw problem
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java | 18 | ||||
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Spinner.java | 9 |
2 files changed, 19 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java index d123896a0c..25f2d8268d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Display.java @@ -2027,11 +2027,19 @@ void initializeInsets () { OS.CreateTabsControl (0, rect, (short)OS.kControlTabSizeLarge, (short)OS.kControlTabDirectionSouth, (short) 0, 0, outControl); tabFolderSouthInset = computeInset (outControl [0]); OS.DisposeControl (outControl [0]); - - OS.CreateEditUnicodeTextControl (0, rect, 0, false, null, outControl); - editTextInset = computeInset (outControl [0]); - OS.DisposeControl (outControl [0]); - + + /* For some reason, this code calculates insets too big. */ +// OS.CreateEditUnicodeTextControl (0, rect, 0, false, null, outControl); +// editTextInset = computeInset (outControl [0]); +// OS.DisposeControl (outControl [0]); + editTextInset = new Rect (); + int [] outMetric = new int [1]; + OS.GetThemeMetric (OS.kThemeMetricFocusRectOutset, outMetric); + int inset = outMetric [0]; + OS.GetThemeMetric (OS.kThemeMetricEditTextFrameOutset, outMetric); + inset += outMetric [0]; + editTextInset.left = editTextInset.top = editTextInset.right = editTextInset.bottom = (short) inset; + CGRect cgRect = new CGRect (); cgRect.width = cgRect.height = 200; int inAttributes = OS.kHIComboBoxAutoCompletionAttribute | OS.kHIComboBoxAutoSizeListAttribute; diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Spinner.java index 7db726ac69..8a81b69b7c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Spinner.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Spinner.java @@ -44,6 +44,8 @@ public class Spinner extends Composite { int pageIncrement = 10; int digits = 0; + static int GAP = 3; + /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. @@ -258,7 +260,7 @@ public Rectangle computeTrim (int x, int y, int width, int height) { height += inset.top + inset.bottom; int [] outMetric = new int [1]; OS.GetThemeMetric (OS.kThemeMetricLittleArrowsWidth, outMetric); - width += outMetric [0]; + width += outMetric [0] + GAP; return new Rectangle (x, y, width, height); } @@ -735,7 +737,7 @@ void resetVisibleRegion (int control) { void resizeClientArea () { int [] outMetric = new int [1]; OS.GetThemeMetric (OS.kThemeMetricLittleArrowsWidth, outMetric); - int buttonWidth = outMetric [0]; + int buttonWidth = outMetric [0] + GAP; OS.GetThemeMetric (OS.kThemeMetricLittleArrowsHeight, outMetric); int buttonHeight = outMetric [0]; Rect rect = new Rect (); @@ -745,7 +747,7 @@ void resizeClientArea () { int height = Math.max (0, rect.bottom - rect.top - inset.top - inset.bottom); buttonHeight = Math.min (buttonHeight, rect.bottom - rect.top); setBounds (textHandle, inset.left, inset.top, width, height, true, true, false); - setBounds (buttonHandle, inset.left + inset.right + width, inset.top + (height - buttonHeight) / 2, buttonWidth, buttonHeight, true, true, false); + setBounds (buttonHandle, inset.left + inset.right + width + GAP, inset.top + (height - buttonHeight) / 2, buttonWidth, buttonHeight, true, true, false); } boolean sendKeyEvent (int type, Event event) { @@ -986,6 +988,7 @@ void setSelection (int value, boolean notify) { if (ptr == 0) error (SWT.ERROR_CANNOT_SET_TEXT); OS.SetControlData (textHandle, OS.kControlEntireControl, OS.kControlEditTextCFStringTag, 4, new int[] {ptr}); OS.CFRelease (ptr); + redrawWidget (textHandle, false); sendEvent (SWT.Modify); if (notify) postEvent (SWT.Selection); } |