summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio>2007-05-18 18:16:52 +0000
committerSilenio Quarti <silenio>2007-05-18 18:16:52 +0000
commitb0ce542f60cb1fa151f351ae95b6b82622586687 (patch)
tree7714fd3d9554ff53647af6db0835934dc3aa701f
parentbc9956a6f967a96697e77f5ed7831350af3db840 (diff)
downloadeclipse.platform.swt-b0ce542f60cb1fa151f351ae95b6b82622586687.tar.gz
eclipse.platform.swt-b0ce542f60cb1fa151f351ae95b6b82622586687.tar.xz
eclipse.platform.swt-b0ce542f60cb1fa151f351ae95b6b82622586687.zip
150397 - Text: SWT.RIGHT without SWT.BORDER does not show text
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java24
1 files changed, 22 insertions, 2 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java
index 46151b7db5..916306256f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/carbon/org/eclipse/swt/widgets/Text.java
@@ -358,8 +358,14 @@ public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget();
int width = 0, height = 0;
if (txnObject == 0) {
+ if ((style & SWT.RIGHT) != 0) {
+ OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextSingleLineTag, 1, new byte [] {1});
+ }
Rect rect = new Rect ();
OS.GetBestControlRect (handle, rect, null);
+ if ((style & SWT.RIGHT) != 0) {
+ OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextSingleLineTag, 1, new byte [] {0});
+ }
width = rect.right - rect.left;
height = rect.bottom - rect.top;
if ((style & SWT.SEARCH) != 0) {
@@ -477,7 +483,14 @@ void createHandle () {
OS.HIViewSetVisible (scrolledHandle, true);
}
int iFrameOptions = OS.kTXNDontDrawCaretWhenInactiveMask | OS.kTXNMonostyledTextMask;
- if ((style & SWT.SINGLE) != 0) iFrameOptions |= OS.kTXNSingleLineOnlyMask;
+ /*
+ * Bug in the Macintosh. For some reason a single line text does not
+ * display properly when it is right aligned. The fix is to use a
+ * multi line text when right aligned.
+ */
+ if ((style & SWT.RIGHT) == 0) {
+ if ((style & SWT.SINGLE) != 0) iFrameOptions |= OS.kTXNSingleLineOnlyMask;
+ }
if ((style & SWT.WRAP) != 0) iFrameOptions |= OS.kTXNAlwaysWrapAtViewEdgeMask;
OS.HITextViewCreate (null, 0, iFrameOptions, outControl);
if (outControl [0] == 0) error (SWT.ERROR_NO_HANDLES);
@@ -525,7 +538,14 @@ void createHandle () {
if ((style & SWT.SEARCH) != 0 && display.smallFonts) {
OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlSizeTag, 2, new short [] {OS.kControlSizeSmall});
}
- OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextSingleLineTag, 1, new byte [] {1});
+ /*
+ * Bug in the Macintosh. For some reason a single line text does not
+ * display selection properly when it is right aligned. The fix is to use a
+ * multi line text when right aligned.
+ */
+ if ((style & SWT.RIGHT) == 0) {
+ OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextSingleLineTag, 1, new byte [] {1});
+ }
if ((style & SWT.READ_ONLY) != 0) {
OS.SetControlData (handle, OS.kControlEntireControl, OS.kControlEditTextLockedTag, 1, new byte [] {1});
}