+    event.Enable( CanPaste() );
+}
+
+void wxTextCtrl::OnUpdateUndo(wxUpdateUIEvent& event)
+{
+    event.Enable( CanUndo() );
+}
+
+void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
+{
+    event.Enable( CanRedo() );
+}
+
+void wxTextCtrl::OnInternalIdle()
+{
+    wxCursor cursor = m_cursor;
+    if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+    if (cursor.Ok())
+    {
+        GdkWindow *window = (GdkWindow*) NULL;
+        if (HasFlag(wxTE_MULTILINE))
+            window = GTK_TEXT(m_text)->text_area;
+        else
+            window = GTK_ENTRY(m_text)->text_area;
+
+        if (window)
+            gdk_window_set_cursor( window, cursor.GetCursor() );
+
+        if (!g_globalCursor.Ok())
+            cursor = *wxSTANDARD_CURSOR;
+
+        window = m_widget->window;
+        if ((window) && !(GTK_WIDGET_NO_WINDOW(m_widget)))
+            gdk_window_set_cursor( window, cursor.GetCursor() );
+    }
+
+    UpdateWindowUI();
+}
+
+wxSize wxTextCtrl::DoGetBestSize() const
+{
+    // FIXME should be different for multi-line controls...
+    wxSize ret( wxControl::DoGetBestSize() );
+    return wxSize(80, ret.y);
+}
+
+// ----------------------------------------------------------------------------
+// freeze/thaw
+// ----------------------------------------------------------------------------
+
+void wxTextCtrl::Freeze()
+{
+    if ( HasFlag(wxTE_MULTILINE) )
+    {
+        gtk_text_freeze(GTK_TEXT(m_text));
+    }
+}
+
+void wxTextCtrl::Thaw()
+{
+    if ( HasFlag(wxTE_MULTILINE) )
+    {
+        GTK_TEXT(m_text)->vadj->value = 0.0;
+
+        gtk_text_thaw(GTK_TEXT(m_text));
+    }
+}
+
+// ----------------------------------------------------------------------------
+// scrolling
+// ----------------------------------------------------------------------------
+
+GtkAdjustment *wxTextCtrl::GetVAdj() const
+{
+    return HasFlag(wxTE_MULTILINE) ? GTK_TEXT(m_text)->vadj : NULL;
+}
+
+bool wxTextCtrl::DoScroll(GtkAdjustment *adj, int diff)
+{
+    float value = adj->value + diff;
+
+    if ( value < 0 )
+        value = 0;
+
+    float upper = adj->upper - adj->page_size;
+    if ( value > upper )
+        value = upper;
+
+    // did we noticeably change the scroll position?
+    if ( fabs(adj->value - value) < 0.2 )
+    {
+        // well, this is what Robert does in wxScrollBar, so it must be good...
+        return FALSE;
+    }
+
+    adj->value = value;
+
+    gtk_signal_emit_by_name(GTK_OBJECT(adj), "value_changed");
+
+    return TRUE;
+}
+
+bool wxTextCtrl::ScrollLines(int lines)
+{
+    GtkAdjustment *adj = GetVAdj();
+    if ( !adj )
+        return FALSE;
+
+    // this is hardcoded to 10 in GTK+ 1.2 (great idea)
+    static const int KEY_SCROLL_PIXELS = 10;
+
+    return DoScroll(adj, lines*KEY_SCROLL_PIXELS);
+}
+
+bool wxTextCtrl::ScrollPages(int pages)
+{
+    GtkAdjustment *adj = GetVAdj();
+    if ( !adj )
+        return FALSE;
+
+    return DoScroll(adj, (int)ceil(pages*adj->page_increment));