/////////////////////////////////////////////////////////////////////////////
-// Name: textctrl.cpp
+// Name: src/x11/textctrl.cpp
// Purpose:
// Author: Robert Roebling
-// Id: $Id$
// Copyright: (c) 1998 Robert Roebling
// 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"
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 );
}
// 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)
return ret;
}
-void wxTextCtrl::SetValue(const wxString& value)
+void wxTextCtrl::DoSetValue(const wxString& value, int flags)
{
m_modified = false;
if (value.empty())
{
- m_lines.Add( new wxSourceLine( wxT("") ) );
+ m_lines.Add( new wxSourceLine( wxEmptyString ) );
}
else
{
MyAdjustScrollbars();
Refresh();
+
+ if ( flags & SetValue_SendEvent )
+ SendTextUpdatedEvent();
}
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;
}
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();
size_t pos = 0;
wxString token( GetNextToken( line, pos ) );
- while (!token.IsNull())
+ while ( !token.empty() )
{
if (m_keywords.Index( token ) != wxNOT_FOUND)
{
#if 0 // there is no middle button on iPAQs
if (event.MiddleDown())
{
- Paste( TRUE );
+ Paste( true );
return;
}
#endif
{
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;
}
}
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() );
}
case WXK_RETURN:
{
- if (m_windowStyle & wxPROCESS_ENTER)
+ if (m_windowStyle & 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 (GetEventHandler()->ProcessEvent(event)) return;
+ if (HandleWindowEvent(event)) return;
}
if (IsSingleLine())
}
}
-// ----------------------------------------------------------------------------
-// freeze/thaw
-// ----------------------------------------------------------------------------
-
-void wxTextCtrl::Freeze()
-{
-}
-
-void wxTextCtrl::Thaw()
-{
-}
-
void wxTextCtrl::OnSetFocus( wxFocusEvent& event )
{
// To hide or show caret, as appropriate
return false;
}
-