206346 GTK-BIDI: RTL support in ExpandBar
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index 88935e9..d4b40fe 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -73,7 +73,7 @@
* @see Widget#getStyle
*/
public ExpandItem (ExpandBar parent, int style) {
- super (parent, style);
+ super (parent, checkStyle (parent, style));
this.parent = parent;
createWidget (parent.getItemCount ());
}
@@ -109,11 +109,22 @@
* @see Widget#getStyle
*/
public ExpandItem (ExpandBar parent, int style, int index) {
- super (parent, style);
+ super (parent, checkStyle (parent, style));
this.parent = parent;
createWidget (index);
}
+static int checkStyle (ExpandBar parent, int style) {
+ style &= ~SWT.MIRRORED;
+ if ((style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT)) == 0) {
+ if (parent != null) {
+ if ((parent.style & SWT.LEFT_TO_RIGHT) != 0) style |= SWT.LEFT_TO_RIGHT;
+ if ((parent.style & SWT.RIGHT_TO_LEFT) != 0) style |= SWT.RIGHT_TO_LEFT;
+ }
+ }
+ return Widget.checkBits (style, SWT.LEFT_TO_RIGHT, SWT.RIGHT_TO_LEFT, 0, 0, 0, 0);
+}
+
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
@@ -572,6 +583,14 @@
}
}
+void setOrientation() {
+ super.setOrientation ();
+ if ((style & SWT.RIGHT_TO_LEFT) != 0) {
+ OS.gtk_widget_set_direction (handle, OS.GTK_TEXT_DIR_RTL);
+ OS.gtk_container_forall (handle, display.setDirectionProc, OS.GTK_TEXT_DIR_RTL);
+ }
+}
+
public void setText (String string) {
super.setText (string);
if (OS.GTK_VERSION >= OS.VERSION (2, 4, 0)) {