X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..cf2227623a889dd0a5f36288d346fc6bf64b55fa:/src/x11/textctrl.cpp?ds=sidebyside diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp index 4d2785703d..d37b667068 100644 --- a/src/x11/textctrl.cpp +++ b/src/x11/textctrl.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: textctrl.cpp +// Name: src/x11/textctrl.cpp // Purpose: // Author: Robert Roebling // Id: $Id$ @@ -7,16 +7,22 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/textctrl.h" -#include "wx/utils.h" -#include "wx/intl.h" -#include "wx/log.h" -#include "wx/settings.h" -#include "wx/panel.h" +#ifndef WX_PRECOMP + #include "wx/intl.h" + #include "wx/log.h" + #include "wx/utils.h" + #include "wx/panel.h" + #include "wx/dcclient.h" + #include "wx/settings.h" +#endif + #include "wx/clipbrd.h" #include "wx/tokenzr.h" -#include "wx/dcclient.h" #include "wx/univ/inphand.h" #include "wx/univ/renderer.h" @@ -50,7 +56,7 @@ wxSourceUndoStep::wxSourceUndoStep( wxSourceUndo type, int y1, int y2, wxTextCtr for (int i = m_y1; i < m_y2+2; i++) { if (i >= (int)m_owner->m_lines.GetCount()) - m_lines.Add( wxT("") ); + m_lines.Add( wxEmptyString ); else m_lines.Add( m_owner->m_lines[i].m_text ); } @@ -125,9 +131,7 @@ WX_DEFINE_OBJARRAY(wxSourceLineArray); // wxTextCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl) - -BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) +BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_PAINT(wxTextCtrl::OnPaint) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_CHAR(wxTextCtrl::OnChar) @@ -271,7 +275,7 @@ wxString wxTextCtrl::GetValue() const return ret; } -void wxTextCtrl::SetValue(const wxString& value) +void wxTextCtrl::DoSetValue(const wxString& value, int flags) { m_modified = false; @@ -285,7 +289,7 @@ void wxTextCtrl::SetValue(const wxString& value) if (value.empty()) { - m_lines.Add( new wxSourceLine( wxT("") ) ); + m_lines.Add( new wxSourceLine( wxEmptyString ) ); } else { @@ -337,6 +341,9 @@ void wxTextCtrl::SetValue(const wxString& value) MyAdjustScrollbars(); Refresh(); + + if ( flags & SetValue_SendEvent ) + SendTextUpdatedEvent(); } int wxTextCtrl::GetLineLength(long lineNo) const @@ -350,7 +357,7 @@ int wxTextCtrl::GetLineLength(long lineNo) const wxString wxTextCtrl::GetLineText(long lineNo) const { if (lineNo >= (long)m_lines.GetCount()) - return wxT(""); + return wxEmptyString; return m_lines[lineNo].m_text; } @@ -393,7 +400,7 @@ void wxTextCtrl::Clear() ClearSelection(); m_lines.Clear(); - m_lines.Add( new wxSourceLine( wxT("") ) ); + m_lines.Add( new wxSourceLine( wxEmptyString ) ); SetScrollbars( m_charWidth, m_lineHeight, 0, 0, 0, 0 ); Refresh(); @@ -1549,7 +1556,7 @@ void wxTextCtrl::DrawLine( wxDC &dc, int x, int y, const wxString &line2, int li size_t pos = 0; wxString token( GetNextToken( line, pos ) ); - while (!token.IsNull()) + while ( !token.empty() ) { if (m_keywords.Index( token ) != wxNOT_FOUND) { @@ -1736,7 +1743,7 @@ void wxTextCtrl::OnMouse( wxMouseEvent &event ) #if 0 // there is no middle button on iPAQs if (event.MiddleDown()) { - Paste( TRUE ); + Paste( true ); return; } #endif @@ -1792,15 +1799,15 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) { switch (event.GetKeyCode()) { - case '4': event.m_keyCode = WXK_LEFT; break; - case '8': event.m_keyCode = WXK_UP; break; - case '6': event.m_keyCode = WXK_RIGHT; break; - case '2': event.m_keyCode = WXK_DOWN; break; - case '9': event.m_keyCode = WXK_PRIOR; break; - case '3': event.m_keyCode = WXK_NEXT; break; - case '7': event.m_keyCode = WXK_HOME; break; - case '1': event.m_keyCode = WXK_END; break; - case '0': event.m_keyCode = WXK_INSERT; break; + case '4': event.m_keyCode = WXK_LEFT; break; + case '8': event.m_keyCode = WXK_UP; break; + case '6': event.m_keyCode = WXK_RIGHT; break; + case '2': event.m_keyCode = WXK_DOWN; break; + case '9': event.m_keyCode = WXK_PAGEUP; break; + case '3': event.m_keyCode = WXK_PAGEDOWN; break; + case '7': event.m_keyCode = WXK_HOME; break; + case '1': event.m_keyCode = WXK_END; break; + case '0': event.m_keyCode = WXK_INSERT; break; } } @@ -1868,7 +1875,7 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) m_ignoreInput = true; return; } - case WXK_PRIOR: + case WXK_PAGEUP: { if (m_ignoreInput) return; MoveCursor( m_cursorX, wxMax( 0, m_cursorY-size_y ), event.ShiftDown() ); @@ -1887,12 +1894,12 @@ void wxTextCtrl::OnChar( wxKeyEvent &event ) } case WXK_RETURN: { - if (m_windowStyle & wxPROCESS_ENTER) + if (m_windowStyle & wxTE_PROCESS_ENTER) { wxCommandEvent event(wxEVT_COMMAND_TEXT_ENTER, m_windowId); event.SetEventObject(this); event.SetString(GetValue()); - if (GetEventHandler()->ProcessEvent(event)) return; + if (HandleWindowEvent(event)) return; } if (IsSingleLine()) @@ -2366,18 +2373,6 @@ wxSize wxTextCtrl::DoGetBestSize() const } } -// ---------------------------------------------------------------------------- -// freeze/thaw -// ---------------------------------------------------------------------------- - -void wxTextCtrl::Freeze() -{ -} - -void wxTextCtrl::Thaw() -{ -} - void wxTextCtrl::OnSetFocus( wxFocusEvent& event ) { // To hide or show caret, as appropriate @@ -2407,4 +2402,3 @@ bool wxTextCtrl::ScrollPages(int pages) return false; } -