diff options
author | Felipe Heidrich <fheidric> | 2010-12-23 19:03:29 +0000 |
---|---|---|
committer | Felipe Heidrich <fheidric> | 2010-12-23 19:03:29 +0000 |
commit | e1ddb07c7c0cc45210739f25c19adbd93ffa639d (patch) | |
tree | e86a3ee5e0dbe8ad0879c9dabcb511e901373a07 /bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java | |
parent | b13cb0959e0afe3c17aa178a3bca80d7d1fd22d7 (diff) | |
download | eclipse.platform.swt-e1ddb07c7c0cc45210739f25c19adbd93ffa639d.tar.gz eclipse.platform.swt-e1ddb07c7c0cc45210739f25c19adbd93ffa639d.tar.xz eclipse.platform.swt-e1ddb07c7c0cc45210739f25c19adbd93ffa639d.zip |
[Bug 29779] BIDI: lack of ability to change orientation of widget in runtime
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java index e72bcc9cd8..a550d916b1 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Control.java @@ -1426,6 +1426,24 @@ public Monitor getMonitor () { } /** + * Returns the orientation of the receiver, which will be one of the + * constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>. + * + * @return the orientation style + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.7 + */ +public int getOrientation () { + checkWidget (); + return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); +} + +/** * Returns the receiver's parent, which must be a <code>Composite</code> * or null when the receiver is a shell that was created with null or * a display for a parent. @@ -3247,6 +3265,33 @@ public void setMenu (Menu menu) { this.menu = menu; } +/** + * Sets the orientation of the receiver, which must be one + * of the constants <code>SWT.LEFT_TO_RIGHT</code> or <code>SWT.RIGHT_TO_LEFT</code>. + * <p> + * + * @param orientation new orientation style + * + * @exception SWTException <ul> + * <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li> + * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> + * </ul> + * + * @since 3.7 + */ +public void setOrientation (int orientation) { + checkWidget (); + if (OS.IsWinCE) return; + if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return; + int flags = SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT; + if ((orientation & flags) == 0 || (orientation & flags) == flags) return; + style &= ~SWT.MIRRORED; + style &= ~flags; + style |= orientation & flags; + updateOrientation (); + checkMirrored (); +} + boolean setRadioFocus (boolean tabbing) { return false; } @@ -4143,6 +4188,17 @@ void updateLayout (boolean resize, boolean all) { /* Do nothing */ } +void updateOrientation () { + int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE); + if ((style & SWT.RIGHT_TO_LEFT) != 0) { + bits |= OS.WS_EX_LAYOUTRTL; + } else { + bits &= ~OS.WS_EX_LAYOUTRTL; + } + OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits); + OS.InvalidateRect (handle, null, true); +} + CREATESTRUCT widgetCreateStruct () { return null; } |