]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/stattext.cpp
The usual RTL fix for GTK+'s theme drawing function.
[wxWidgets.git] / src / gtk / stattext.cpp
index 2641ea02f33db4b7a9c41169d89db99d8dc0c86d..8d2c1e01b42f31ed49675a3ed9896fb14f5693af 100644 (file)
@@ -72,6 +72,15 @@ bool wxStaticText::Create(wxWindow *parent,
       justify = GTK_JUSTIFY_RIGHT;
     else // wxALIGN_LEFT is 0
       justify = GTK_JUSTIFY_LEFT;
+      
+    if (GetLayoutDirection() == wxLayout_RightToLeft)
+    {  
+         if (justify == GTK_JUSTIFY_RIGHT)
+            justify = GTK_JUSTIFY_LEFT;
+         if (justify == GTK_JUSTIFY_LEFT)
+            justify = GTK_JUSTIFY_RIGHT;
+    }
+    
     gtk_label_set_justify(GTK_LABEL(m_widget), justify);
 
     // GTK_JUSTIFY_LEFT is 0, RIGHT 1 and CENTER 2
@@ -154,7 +163,8 @@ wxSize wxStaticText::DoGetBestSize() const
 
     gtk_label_set_line_wrap( GTK_LABEL(m_widget), TRUE );
 
-    return wxSize (req.width, req.height);
+    // Adding 1 to width to workaround GTK sometimes wrapping the text needlessly
+    return wxSize (req.width+1, req.height);
 }
 
 bool wxStaticText::SetForegroundColour(const wxColour& colour)