]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/textctrl.cpp
wxaui maximize/restore button patch from Aleksey Sanin (many thanks)
[wxWidgets.git] / src / gtk / textctrl.cpp
index 182d64038a18776ddc6f418ebdd6529a705227ff..08bb79660ba547a62cad2a3653ecf2aec516d968 100644 (file)
@@ -16,7 +16,6 @@
     #include "wx/intl.h"
     #include "wx/log.h"
     #include "wx/utils.h"
-    #include "wx/panel.h"
     #include "wx/settings.h"
     #include "wx/math.h"
 #endif
@@ -29,7 +28,6 @@
 #include <ctype.h>
 
 #include "wx/gtk/private.h"
-#include <gdk/gdkkeysyms.h>
 
 // ----------------------------------------------------------------------------
 // helpers
@@ -926,7 +924,7 @@ wxFontEncoding wxTextCtrl::GetTextEncoding() const
 bool wxTextCtrl::IsEmpty() const
 {
     if ( IsMultiLine() )
-        return gtk_text_buffer_get_char_count(m_buffer) != 0;
+        return gtk_text_buffer_get_char_count(m_buffer) == 0;
 
     return wxTextCtrlBase::IsEmpty();
 }
@@ -969,6 +967,12 @@ void wxTextCtrl::DoSetValue( const wxString &value, int flags )
         gtk_entry_set_text( GTK_ENTRY(m_text), buffer );
     }
 
+    // if, for whatever reason, the callback wasn't called the expected number
+    // of times, still reset the flags to the default values
+    m_dontMarkDirty = false;
+    m_countUpdatesToIgnore = 0;
+
+
     // GRG, Jun/2000: Changed this after a lot of discussion in
     //   the lists. wxWidgets 2.2 will have a set of flags to
     //   customize this behaviour.
@@ -1846,7 +1850,10 @@ void wxTextCtrl::Freeze()
                               G_CALLBACK (gtk_text_exposed_callback), this);
             gtk_widget_set_sensitive(m_widget, false);
             g_object_ref(m_buffer);
-            gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), gtk_text_buffer_new(NULL));
+            GtkTextBuffer* buf_new = gtk_text_buffer_new(NULL);
+            gtk_text_view_set_buffer(GTK_TEXT_VIEW(m_text), buf_new);
+            // gtk_text_view_set_buffer adds its own reference
+            g_object_unref(buf_new);
         }
     }
 }