]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/textctrl.cpp
Fix compile errors when using gtk 1.2
[wxWidgets.git] / src / gtk1 / textctrl.cpp
index 590e88f272108b0e51a8526c8a07c38b672e6870..a2ad1509bb50d71cdfef1ff25d1257a8af080494 100644 (file)
@@ -4,7 +4,7 @@
 // Author:      Robert Roebling
 // Id:          $Id$
 // Copyright:   (c) 1998 Robert Roebling, Vadim Zeitlin
-// Licence:     wxWidgets licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
@@ -424,6 +424,26 @@ bool wxTextCtrl::Create( wxWindow *parent,
 #endif
     }
 
+#ifdef __WXGTK20__
+    if (multi_line)
+    {
+        if (style & wxTE_RIGHT)
+            gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_RIGHT );
+        else if (style & wxTE_CENTRE)
+            gtk_text_view_set_justification( GTK_TEXT_VIEW(m_text), GTK_JUSTIFY_CENTER );
+        // Left justify (alignment) is the default and we don't need to apply GTK_JUSTIFY_LEFT
+    }
+    // gtk_entry_set_alignment was introduced in gtk+-2.3.5
+#if GTK_CHECK_VERSION(2, 3, 5)
+    else
+    {
+        if (style & wxTE_RIGHT)
+            gtk_entry_set_alignment( GTK_ENTRY(m_text), 1.0 );
+        else if (style & wxTE_CENTRE)
+            gtk_entry_set_alignment( GTK_ENTRY(m_text), 0.5 );
+    }
+#endif // gtk+-2.3.5
+#endif // __WXGTK20__
     
     // We want to be notified about text changes.
 #ifdef __WXGTK20__