X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..4227afa4f748870bbfce75047db465f024e0ac1d:/src/x11/textctrl.cpp diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp index c3b1b6411f..3b778c72a9 100644 --- a/src/x11/textctrl.cpp +++ b/src/x11/textctrl.cpp @@ -7,11 +7,12 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "textctrl.h" #endif #include "wx/textctrl.h" + #include "wx/utils.h" #include "wx/intl.h" #include "wx/log.h" @@ -19,6 +20,7 @@ #include "wx/panel.h" #include "wx/clipbrd.h" #include "wx/tokenzr.h" +#include "wx/dcclient.h" #include "wx/univ/inphand.h" #include "wx/univ/renderer.h" @@ -134,7 +136,6 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_CHAR(wxTextCtrl::OnChar) EVT_MOUSE_EVENTS(wxTextCtrl::OnMouse) - EVT_IDLE(wxTextCtrl::OnIdle) EVT_KILL_FOCUS(wxTextCtrl::OnKillFocus) EVT_SET_FOCUS(wxTextCtrl::OnSetFocus) @@ -156,8 +157,6 @@ void wxTextCtrl::Init() m_editable = TRUE; m_modified = FALSE; - m_undos.DeleteContents( TRUE ); - m_lang = wxSOURCE_LANG_NONE; m_capturing = FALSE; @@ -201,6 +200,11 @@ wxTextCtrl::wxTextCtrl( wxWindow *parent, Create( parent, id, value, pos, size, style, validator, name ); } +wxTextCtrl::~wxTextCtrl() +{ + WX_CLEAR_LIST(wxList, m_undos); +} + bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, @@ -217,7 +221,7 @@ bool wxTextCtrl::Create( wxWindow *parent, style |= wxALWAYS_SHOW_SB; wxTextCtrlBase::Create( parent, id, pos /* wxDefaultPosition */, size, - style|wxVSCROLL|wxHSCROLL|wxNO_FULL_REPAINT_ON_RESIZE ); + style | wxVSCROLL | wxHSCROLL); SetBackgroundColour( *wxWHITE ); @@ -397,7 +401,7 @@ void wxTextCtrl::Clear() SetScrollbars( m_charWidth, m_lineHeight, 0, 0, 0, 0 ); Refresh(); - m_undos.Clear(); + WX_CLEAR_LIST(wxList, m_undos); } void wxTextCtrl::Replace(long from, long to, const wxString& value) @@ -794,12 +798,13 @@ void wxTextCtrl::Undo() { if (m_undos.GetCount() == 0) return; - wxNode *node = m_undos.Nth( m_undos.GetCount()-1 ); - wxSourceUndoStep *undo = (wxSourceUndoStep*) node->Data(); + wxList::compatibility_iterator node = m_undos.Item( m_undos.GetCount()-1 ); + wxSourceUndoStep *undo = (wxSourceUndoStep*) node->GetData(); undo->Undo(); - - delete node; + + delete undo; + m_undos.Erase( node ); m_modified = TRUE; } @@ -1937,8 +1942,8 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) } default: { - if ( (event.KeyCode() >= 'a') && - (event.KeyCode() <= 'z') && + if ( (event.GetKeyCode() >= 'a') && + (event.GetKeyCode() <= 'z') && (event.AltDown()) ) { // Alt-F etc. @@ -1946,13 +1951,13 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) return; } - if ( (event.KeyCode() >= 32) && - (event.KeyCode() <= 255) && + if ( (event.GetKeyCode() >= 32) && + (event.GetKeyCode() <= 255) && !(event.ControlDown() && !event.AltDown()) ) // filters out Ctrl-X but leaves Alt-Gr { if (HasSelection()) Delete(); - DoChar( (char) event.KeyCode() ); + DoChar( (char) event.GetKeyCode() ); return; } } @@ -1961,14 +1966,14 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) event.Skip(); } -void wxTextCtrl::OnIdle( wxIdleEvent &event ) +void wxTextCtrl::OnInternalIdle() { + wxControl::OnInternalIdle(); + m_ignoreInput = FALSE; if (m_lang != wxSOURCE_LANG_NONE) SearchForBrackets(); - - event.Skip( TRUE ); } void wxTextCtrl::Indent()