]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
Always make wxWindow::SetFocus() focus the window, overriding SetCanFocus, some more...
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index bf06f72f309d7581073f5482dfd17ca1458709ad..f82ffe87076ada26ec2736c9e72523f354c539b8 100644 (file)
@@ -151,7 +151,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
     // The base attributes must all have default values
     wxTextAttrEx attributes;
     attributes.SetFont(GetFont());
-    attributes.SetTextColour(*wxBLACK);
+    attributes.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
     attributes.SetAlignment(wxTEXT_ALIGNMENT_LEFT);
     attributes.SetLineSpacing(10);
     attributes.SetParagraphSpacingAfter(10);
@@ -166,7 +166,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
     wxTextAttrEx defaultAttributes;
     SetDefaultStyle(defaultAttributes);
 
-    SetBackgroundColour(*wxWHITE);
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
     SetBackgroundStyle(wxBG_STYLE_CUSTOM);
 
     // Tell the sizers to use the given or best size
@@ -2527,8 +2527,14 @@ void wxRichTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
     event.Enable(GetLastPosition() > 0);
 }
 
-void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& WXUNUSED(event))
+void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
 {
+    if (event.GetEventObject() != this)
+    {
+        event.Skip();
+        return;
+    }
+
     if (!m_contextMenu)
     {
         m_contextMenu = new wxMenu;
@@ -2707,12 +2713,13 @@ void wxRichTextCtrl::PositionCaret()
     wxRect caretRect;
     if (GetCaretPositionForIndex(GetCaretPosition(), caretRect))
     {
-        wxPoint originalPt = caretRect.GetPosition();
-        wxPoint pt = GetPhysicalPoint(originalPt);
-        if (GetCaret()->GetPosition() != pt)
+        wxPoint newPt = caretRect.GetPosition();
+        wxSize newSz = caretRect.GetSize();
+        wxPoint pt = GetPhysicalPoint(newPt);
+        if (GetCaret()->GetPosition() != pt || GetCaret()->GetSize() != newSz)
         {
             GetCaret()->Move(pt);
-            GetCaret()->SetSize(caretRect.GetSize());
+            GetCaret()->SetSize(newSz);
         }
     }
 }