]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/textctrl.cpp
fix for menu separator
[wxWidgets.git] / src / gtk / textctrl.cpp
index cd52a4dc49fc3a7cbc1e6da5465052423dd8671d..b8bba6c69b86da45062810a37f83bf5babc63ff0 100644 (file)
@@ -158,6 +158,9 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
                       (GtkAttachOptions)(GTK_FILL | GTK_EXPAND | GTK_SHRINK),
                        0, 0);
 
+        /* always wrap words */
+        gtk_text_set_word_wrap( GTK_TEXT(m_text), TRUE );
+       
         /* put the horizontal scrollbar in the lower left hand corner */
         if (bHasHScrollbar)
         {
@@ -169,8 +172,13 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
                        GTK_FILL,
                        0, 0);
             gtk_widget_show(hscrollbar);
-        }
 
+#if (GTK_MINOR_VERSION > 0)
+           /* don't wrap lines, otherwise we wouldn't need the scrollbar */
+           gtk_text_set_line_wrap( GTK_TEXT(m_text), FALSE );
+#endif
+        }
+       
         /* finally, put the vertical scrollbar in the upper right corner */
         m_vScrollbar = gtk_vscrollbar_new( GTK_TEXT(m_text)->vadj );
         GTK_WIDGET_UNSET_FLAGS( m_vScrollbar, GTK_CAN_FOCUS );
@@ -952,6 +960,8 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
     wxCHECK_RET( m_text != NULL, _T("invalid text ctrl") );
 
     wxControl::SetBackgroundColour( colour );
+    
+    if (!m_widget->window) return;
 
     wxColour sysbg = wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNFACE );
     if (sysbg.Red() == colour.Red() &&
@@ -966,6 +976,7 @@ void wxTextCtrl::SetBackgroundColour( const wxColour &colour )
     if (m_windowStyle & wxTE_MULTILINE)
     {
         GdkWindow *window = GTK_TEXT(m_text)->text_area;
+       if (!window) return;
         m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
         gdk_window_set_background( window, m_backgroundColour.GetColor() );
         gdk_window_clear( window );