X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7d8268a1d64de58aab194e4d8ae800c755990aad..f8d0234d39c66f3d1d7fc2346562cb96c8c7be20:/src/x11/textctrl.cpp diff --git a/src/x11/textctrl.cpp b/src/x11/textctrl.cpp index e1a366aa37..9cb8938945 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,20 +7,22 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "textctrl.h" -#endif +// 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" @@ -54,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 ); } @@ -129,9 +131,9 @@ WX_DEFINE_OBJARRAY(wxSourceLineArray); // wxTextCtrl //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxTextCtrlBase) -BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) +BEGIN_EVENT_TABLE(wxTextCtrl, wxTextCtrlBase) EVT_PAINT(wxTextCtrl::OnPaint) EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground) EVT_CHAR(wxTextCtrl::OnChar) @@ -275,7 +277,7 @@ wxString wxTextCtrl::GetValue() const return ret; } -void wxTextCtrl::SetValue(const wxString& value) +void wxTextCtrl::DoSetValue(const wxString& value, int flags) { m_modified = false; @@ -289,7 +291,7 @@ void wxTextCtrl::SetValue(const wxString& value) if (value.empty()) { - m_lines.Add( new wxSourceLine( wxT("") ) ); + m_lines.Add( new wxSourceLine( wxEmptyString ) ); } else { @@ -341,6 +343,9 @@ void wxTextCtrl::SetValue(const wxString& value) MyAdjustScrollbars(); Refresh(); + + if ( flags & SetValue_SendEvent ) + SendTextUpdatedEvent(); } int wxTextCtrl::GetLineLength(long lineNo) const @@ -354,7 +359,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; } @@ -397,7 +402,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(); @@ -1740,7 +1745,7 @@ void wxTextCtrl::OnMouse( wxMouseEvent &event ) #if 0 // there is no middle button on iPAQs if (event.MiddleDown()) { - Paste( TRUE ); + Paste( true ); return; } #endif @@ -1796,15 +1801,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; } } @@ -1872,7 +1877,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() ); @@ -1891,12 +1896,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()) @@ -2370,18 +2375,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 @@ -2411,4 +2404,3 @@ bool wxTextCtrl::ScrollPages(int pages) return false; } -