]> git.saurik.com Git - wxWidgets.git/commitdiff
implemented wxTE_RIGHT, wxTE_CENTRE for wxGTK2 (patch 957687)
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 25 May 2004 10:35:34 +0000 (10:35 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 25 May 2004 10:35:34 +0000 (10:35 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/text.tex
src/gtk/textctrl.cpp
src/gtk1/textctrl.cpp

index 7a7014c79e68032d05294db8831b562bebb47d8d..3aa4ab3db1f262a9b9c45d664403d8a6437052b1 100644 (file)
@@ -141,6 +141,10 @@ wxMSW:
 - fixed wxFileDataObject in Unicode build (Alex D)
 - subdindented paragraphs support (Tim Kosse)
 
+wxGTK:
+
+- added support for wxTE_RIGHT and wxTE_CENTRE styles under GTK2 (Mart Raudsepp)
+
 wxMotif:
 
 - removed wxMenuItem::DeleteSubMenu()
index 0bef1067e59b322a743feac2df84b9584bad723c..743ca390581ad40542ab61214dc87f240b571716 100644 (file)
@@ -304,8 +304,8 @@ it to always show it. It doesn't do anything under other platforms.}
 \twocolitem{\windowstyle{wxHSCROLL}}{A horizontal scrollbar will be created and
 used, so that text won't be wrapped. No effect under GTK+.}
 \twocolitem{\windowstyle{wxTE\_LEFT}}{The text in the control will be left-justified (default).}
-\twocolitem{\windowstyle{wxTE\_CENTRE}}{The text in the control will be centered.}
-\twocolitem{\windowstyle{wxTE\_RIGHT}}{The text in the control will be right-justified.}
+\twocolitem{\windowstyle{wxTE\_CENTRE}}{The text in the control will be centered (currently wxMSW and wxGTK2 only).}
+\twocolitem{\windowstyle{wxTE\_RIGHT}}{The text in the control will be right-justified (currently wxMSW and wxGTK2 only).}
 \twocolitem{\windowstyle{wxTE\_DONTWRAP}}{Same as {\tt wxHSCROLL} style.}
 \twocolitem{\windowstyle{wxTE\_LINEWRAP}}{Wrap the lines too long to be shown entirely at any position (wxUniv only currently).}
 \twocolitem{\windowstyle{wxTE\_WORDWRAP}}{Wrap the lines too long to be shown entirely at word boundaries only (wxUniv only currently).}
index c93cae832f390c21425cb184f9bd6ec4212e383c..be60f4def208c2d916536a3f88f5d1d1f025c695 100644 (file)
@@ -414,6 +414,26 @@ bool wxTextCtrl::Create( wxWindow *parent,
             gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
 #ifdef __WXGTK20__
         else
+#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__
             gtk_text_view_set_editable( GTK_TEXT_VIEW( m_text), FALSE);
 #else
     }
index c93cae832f390c21425cb184f9bd6ec4212e383c..be60f4def208c2d916536a3f88f5d1d1f025c695 100644 (file)
@@ -414,6 +414,26 @@ bool wxTextCtrl::Create( wxWindow *parent,
             gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE );
 #ifdef __WXGTK20__
         else
+#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__
             gtk_text_view_set_editable( GTK_TEXT_VIEW( m_text), FALSE);
 #else
     }