InheritAttributes();
m_hasVMT = true;
+
+ SetLayoutDirection(wxLayout_Default);
// unless the window was created initially hidden (i.e. Hide() had been
// called before Create()), we should show it at GTK+ level as well
// don't take the x,y values, they're wrong because toolbar sets them
GtkWidget *widget = GTK_WIDGET(m_widget);
gtk_widget_set_size_request (widget, m_width, m_height);
- if (GTK_WIDGET_VISIBLE (widget))
- gtk_widget_queue_resize (widget);
}
else
#endif
/* reverse: prevent GTK from deleting the widget arbitrarily */
gtk_widget_unref( m_widget );
+
+ SetLayoutDirection(wxLayout_Default);
return true;
}
wxapp_install_idle_handler();
}
+/* static */
+wxLayoutDirection wxWindowGTK::GTKGetLayout(GtkWidget *widget)
+{
+ return gtk_widget_get_direction(GTK_WIDGET(widget)) == GTK_TEXT_DIR_RTL
+ ? wxLayout_RightToLeft
+ : wxLayout_LeftToRight;
+}
+
+/* static */
+void wxWindowGTK::GTKSetLayout(GtkWidget *widget, wxLayoutDirection dir)
+{
+ wxASSERT_MSG( dir != wxLayout_Default, _T("invalid layout direction") );
+
+ gtk_widget_set_direction(GTK_WIDGET(widget),
+ dir == wxLayout_RightToLeft ? GTK_TEXT_DIR_RTL
+ : GTK_TEXT_DIR_LTR);
+}
+
+wxLayoutDirection wxWindowGTK::GetLayoutDirection() const
+{
+ return GTKGetLayout(m_widget);
+}
+
+void wxWindowGTK::SetLayoutDirection(wxLayoutDirection dir)
+{
+ if ( dir == wxLayout_Default )
+ {
+ const wxWindow *const parent = GetParent();
+ if ( parent )
+ {
+ // inherit layout from parent.
+ dir = parent->GetLayoutDirection();
+ }
+ else // no parent, use global default layout
+ {
+ dir = wxTheApp->GetLayoutDirection();
+ }
+ }
+
+ if ( dir == wxLayout_Default )
+ return;
+
+ GTKSetLayout(m_widget, dir);
+}
+
void wxWindowGTK::DoMoveInTabOrder(wxWindow *win, MoveKind move)
{
wxWindowBase::DoMoveInTabOrder(win, move);