]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/stattext.cpp
minimize overlay area to avoid eg scrolling artifacts when using a caret
[wxWidgets.git] / src / gtk / stattext.cpp
index 1befdd1c898c6d659d13befb5a75f7febfb80db6..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)
@@ -166,6 +176,16 @@ bool wxStaticText::SetForegroundColour(const wxColour& colour)
     return true;
 }
 
+bool wxStaticText::GTKWidgetNeedsMnemonic() const
+{
+    return true;
+}
+
+void wxStaticText::GTKWidgetDoSetMnemonic(GtkWidget* w)
+{
+    gtk_label_set_mnemonic_widget(GTK_LABEL(m_widget), w);
+}
+
 // static
 wxVisualAttributes
 wxStaticText::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))