]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/textctrl.cpp
Make SaveFile and LoadFile virtual so they can be overridden
[wxWidgets.git] / src / gtk1 / textctrl.cpp
index ca95f24fffe6aad67c7903c7d7334671bef0ee74..9dfc2f18575b45e3d13fad8e58d41d51d47e117f 100644 (file)
@@ -55,8 +55,21 @@ static void wxGtkTextInsert(GtkWidget *text,
                             const char *txt,
                             size_t len)
 {
-    GdkFont *font = attr.HasFont() ? attr.GetFont().GetInternalFont()
-                                   : NULL;
+    wxFont tmpFont;
+    GdkFont *font;
+    if (attr.HasFont())
+    {
+        tmpFont = attr.GetFont();
+
+        // FIXME: if this crashes because tmpFont goes out of scope and the GdkFont is
+        // deleted, then we need to call gdk_font_ref on font.
+        // This is because attr.GetFont() now returns a temporary font since wxTextAttr
+        // no longer stores a wxFont object, for efficiency.
+
+        font = tmpFont.GetInternalFont();
+    }
+    else
+        font  = NULL;
 
     GdkColor *colFg = attr.HasTextColour() ? attr.GetTextColour().GetColor()
                                            : NULL;
@@ -412,10 +425,16 @@ wxString wxTextCtrl::GetValue() const
     return tmp;
 }
 
-void wxTextCtrl::SetValue( const wxString &value )
+void wxTextCtrl::DoSetValue( const wxString &value, int flags )
 {
     wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
 
+    if ( !(flags & SetValue_SendEvent) )
+    {
+        // do not generate events
+        IgnoreNextTextUpdate();
+    }
+
     if (m_windowStyle & wxTE_MULTILINE)
     {
         gint len = gtk_text_get_length( GTK_TEXT(m_text) );
@@ -684,32 +703,26 @@ void wxTextCtrl::SetEditable( bool editable )
     }
 }
 
-bool wxTextCtrl::Enable( bool enable )
+void wxTextCtrl::DoEnable( bool enable )
 {
-    if (!wxWindowBase::Enable(enable))
-    {
-        // nothing to do
-        return false;
-    }
-
     if (m_windowStyle & wxTE_MULTILINE)
     {
         gtk_text_set_editable( GTK_TEXT(m_text), enable );
-        OnParentEnable(enable);
     }
     else
     {
         gtk_widget_set_sensitive( m_text, enable );
     }
-
-    return true;
 }
 
 // wxGTK-specific: called recursively by Enable,
 // to give widgets an oppprtunity to correct their colours after they
 // have been changed by Enable
-void wxTextCtrl::OnParentEnable( bool enable )
+void wxTextCtrl::OnEnabled( bool enable )
 {
+    if ( IsSingleLine() )
+        return;
+
     // If we have a custom background colour, we use this colour in both
     // disabled and enabled mode, or we end up with a different colour under the
     // text.