/////////////////////////////////////////////////////////////////////////////
-// Name: richtext/richeditctrl.cpp
+// Name: src/richtext/richeditctrl.cpp
// Purpose: A rich edit control
// Author: Julian Smart
// Modified by:
#include "wx/wxprec.h"
#ifdef __BORLANDC__
- #pragma hdrstop
+ #pragma hdrstop
#endif
#if wxUSE_RICHTEXT
#include "wx/richtext/richtextctrl.h"
#ifndef WX_PRECOMP
- #include "wx/wx.h"
+ #include "wx/wx.h"
+ #include "wx/settings.h"
#endif
#include "wx/textfile.h"
#include "wx/ffile.h"
-#include "wx/settings.h"
#include "wx/filename.h"
#include "wx/dcbuffer.h"
#include "wx/arrimpl.cpp"
event.GetKeyCode() == WXK_HOME ||
event.GetKeyCode() == WXK_PAGEUP ||
event.GetKeyCode() == WXK_PAGEDOWN ||
- event.GetKeyCode() == WXK_PRIOR ||
- event.GetKeyCode() == WXK_NEXT ||
event.GetKeyCode() == WXK_END)
{
KeyboardNavigate(event.GetKeyCode(), flags);
+ return;
}
- else if (event.GetKeyCode() == WXK_RETURN)
+
+ // all the other keys modify the controls contents which shouldn't be
+ // possible if we're read-only
+ if ( !IsEditable() )
+ {
+ event.Skip();
+ return;
+ }
+
+ if (event.GetKeyCode() == WXK_RETURN)
{
BeginBatchUndo(_("Insert Text"));
SetDefaultStyleToCursorStyle();
ScrollIntoView(m_caretPosition, WXK_RIGHT);
}
-#if 0
- else
- event.Skip();
-#endif
}
/// Delete content if there is a selection, e.g. when pressing a key.
else
success = MoveDown(1, flags);
}
- else if (keyCode == WXK_PAGEUP || keyCode == WXK_PRIOR)
+ else if (keyCode == WXK_PAGEUP)
{
success = PageUp(1, flags);
}
- else if (keyCode == WXK_PAGEDOWN || keyCode == WXK_NEXT)
+ else if (keyCode == WXK_PAGEDOWN)
{
success = PageDown(1, flags);
}
wxSize clientSize = GetClientSize();
// Going down
- if (keyCode == WXK_DOWN || keyCode == WXK_RIGHT || keyCode == WXK_END || keyCode == WXK_NEXT || keyCode == WXK_PAGEDOWN)
+ if (keyCode == WXK_DOWN || keyCode == WXK_RIGHT || keyCode == WXK_END || keyCode == WXK_PAGEDOWN)
{
if ((rect.y + rect.height) > (clientSize.y + startY))
{
}
}
// Going up
- else if (keyCode == WXK_UP || keyCode == WXK_LEFT || keyCode == WXK_HOME || keyCode == WXK_PRIOR || keyCode == WXK_PAGEUP)
+ else if (keyCode == WXK_UP || keyCode == WXK_LEFT || keyCode == WXK_HOME || keyCode == WXK_PAGEUP )
{
if (rect.y < startY)
{
}
// do the window-specific processing after processing the update event
+#if !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
void wxRichTextCtrl::DoUpdateWindowUI(wxUpdateUIEvent& event)
{
- if ( event.GetSetEnabled() )
- Enable(event.GetEnabled());
+ // call inherited
+ wxWindowBase::DoUpdateWindowUI(event);
+ // update text
if ( event.GetSetText() )
{
if ( event.GetText() != GetValue() )
SetValue(event.GetText());
}
}
+#endif // !wxRICHTEXT_DERIVES_FROM_TEXTCTRLBASE
// ----------------------------------------------------------------------------
// hit testing
#endif
// wxUSE_RICHTEXT
-