// Name: src/gtk/textctrl.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $Id$
// Copyright: (c) 1998 Robert Roebling, Vadim Zeitlin, 2005 Mart Raudsepp
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#endif
// First remove the selection if there is one
- // TODO: Is there an easier GTK specific way to do this?
- long from, to;
- GetSelection(&from, &to);
- if (from != to)
- Remove(from, to);
+ gtk_text_buffer_delete_selection(m_buffer, false, true);
// Insert the text
wxGtkTextInsert( m_text, m_buffer, m_defaultStyle, buffer );
return true;
}
-// wxGTK-specific: called recursively by Enable,
-// to give widgets an opportunity to correct their colours after they
-// have been changed by Enable
-void wxTextCtrl::OnEnabled(bool WXUNUSED(enable))
-{
- // 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.
- wxColour oldColour = GetBackgroundColour();
- if (oldColour.IsOk())
- {
- // Need to set twice or it'll optimize the useful stuff out
- if (oldColour == * wxWHITE)
- SetBackgroundColour(*wxBLACK);
- else
- SetBackgroundColour(*wxWHITE);
- SetBackgroundColour(oldColour);
- }
-}
-
void wxTextCtrl::MarkDirty()
{
m_modified = true;
{
if ( HasFlag(wxTE_PROCESS_ENTER) )
{
- wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId);
+ wxCommandEvent event(wxEVT_TEXT_ENTER, m_windowId);
event.SetEventObject(this);
event.SetString(GetValue());
if ( HandleWindowEvent(event) )