From: Vadim Zeitlin Date: Mon, 21 Mar 2005 23:23:46 +0000 (+0000) Subject: added support for wxTE_LINEWRAP; use GTK_WRAP_WORD_CHAR for wxTE_WORDWRAP instead... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/c211082373ea8ba2c229a4c640256b8cff49a7c3 added support for wxTE_LINEWRAP; use GTK_WRAP_WORD_CHAR for wxTE_WORDWRAP instead of GTK_WRAP_WORD (parts of patch 1156507) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32971 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/changes.txt b/docs/changes.txt index 001575b604..a0f2040983 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -41,6 +41,7 @@ wxGTK: - Corrected default button size handling for different themes. - Corrected splitter sash size and look for different themes. - Fixed keyboard input for dead-keys. +- Added support for wxTE_LINEWRAP (Mart Raudsepp) wxMac: diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index 3cd7d06b2c..f0dad16cff 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -570,11 +570,13 @@ bool wxTextCtrl::Create( wxWindow *parent, // Insert view into scrolled window gtk_container_add( GTK_CONTAINER(m_widget), m_text ); - // Global settings which can be overridden by tags, I guess. - if (HasFlag( wxHSCROLL ) || HasFlag( wxTE_DONTWRAP )) + // translate wx wrapping style to GTK+ + if ( HasFlag( wxTE_DONTWRAP ) ) gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_NONE ); - else - gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_WORD ); + else if ( HasFlag( wxTE_LINEWRAP ) ) + gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_CHAR ); + else // HasFlag(wxTE_WORDWRAP) always true as wxTE_WORDWRAP == 0 + gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_WORD_CHAR ); if (!HasFlag(wxNO_BORDER)) gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); @@ -582,7 +584,7 @@ bool wxTextCtrl::Create( wxWindow *parent, gtk_widget_add_events( GTK_WIDGET(m_text), GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); -#else +#else // GTK+ 1 // create our control ... m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); @@ -605,7 +607,7 @@ bool wxTextCtrl::Create( wxWindow *parent, GTK_FILL, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), 0, 0); -#endif +#endif // GTK+ 2/1 } else { diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index 3cd7d06b2c..f0dad16cff 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -570,11 +570,13 @@ bool wxTextCtrl::Create( wxWindow *parent, // Insert view into scrolled window gtk_container_add( GTK_CONTAINER(m_widget), m_text ); - // Global settings which can be overridden by tags, I guess. - if (HasFlag( wxHSCROLL ) || HasFlag( wxTE_DONTWRAP )) + // translate wx wrapping style to GTK+ + if ( HasFlag( wxTE_DONTWRAP ) ) gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_NONE ); - else - gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_WORD ); + else if ( HasFlag( wxTE_LINEWRAP ) ) + gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_CHAR ); + else // HasFlag(wxTE_WORDWRAP) always true as wxTE_WORDWRAP == 0 + gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), GTK_WRAP_WORD_CHAR ); if (!HasFlag(wxNO_BORDER)) gtk_scrolled_window_set_shadow_type( GTK_SCROLLED_WINDOW(m_widget), GTK_SHADOW_IN ); @@ -582,7 +584,7 @@ bool wxTextCtrl::Create( wxWindow *parent, gtk_widget_add_events( GTK_WIDGET(m_text), GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK ); GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); -#else +#else // GTK+ 1 // create our control ... m_text = gtk_text_new( (GtkAdjustment *) NULL, (GtkAdjustment *) NULL ); @@ -605,7 +607,7 @@ bool wxTextCtrl::Create( wxWindow *parent, GTK_FILL, (GtkAttachOptions)(GTK_EXPAND | GTK_FILL | GTK_SHRINK), 0, 0); -#endif +#endif // GTK+ 2/1 } else {