]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
Missing header
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index 36a885aa2b7832cd18b6f9aeda66c7ea45016f30..b414fa7bb5f6cd270715fb77c9434d27ff3dfb7f 100644 (file)
@@ -13,7 +13,7 @@
 #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"
@@ -432,8 +432,18 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
         event.GetKeyCode() == WXK_END)
     {
         KeyboardNavigate(event.GetKeyCode(), flags);
+        return;
+    }
+
+    // all the other keys modify the controls contents which shouldn't be
+    // possible if we're read-only
+    if ( !IsEditable() )
+    {
+        event.Skip();
+        return;
     }
-    else if (event.GetKeyCode() == WXK_RETURN)
+
+    if (event.GetKeyCode() == WXK_RETURN)
     {
         BeginBatchUndo(_("Insert Text"));
 
@@ -527,10 +537,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
         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.