]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index f3247070def25c776b5e1da1c07cc05bc233cf68..62acf0a2fab7c46a180d28e4f7ebb1db14171364 100644 (file)
@@ -76,6 +76,7 @@ BEGIN_EVENT_TABLE( wxRichTextCtrl, wxControl )
     EVT_KILL_FOCUS(wxRichTextCtrl::OnKillFocus)
     EVT_MOUSE_CAPTURE_LOST(wxRichTextCtrl::OnCaptureLost)
     EVT_CONTEXT_MENU(wxRichTextCtrl::OnContextMenu)
     EVT_KILL_FOCUS(wxRichTextCtrl::OnKillFocus)
     EVT_MOUSE_CAPTURE_LOST(wxRichTextCtrl::OnCaptureLost)
     EVT_CONTEXT_MENU(wxRichTextCtrl::OnContextMenu)
+    EVT_SYS_COLOUR_CHANGED(wxRichTextCtrl::OnSysColourChanged)
 
     EVT_MENU(wxID_UNDO, wxRichTextCtrl::OnUndo)
     EVT_UPDATE_UI(wxID_UNDO, wxRichTextCtrl::OnUpdateUndo)
 
     EVT_MENU(wxID_UNDO, wxRichTextCtrl::OnUndo)
     EVT_UPDATE_UI(wxID_UNDO, wxRichTextCtrl::OnUpdateUndo)
@@ -506,7 +507,7 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
 }
 
 /// Right-click
 }
 
 /// Right-click
-void wxRichTextCtrl::OnRightClick(wxMouseEvent& WXUNUSED(event))
+void wxRichTextCtrl::OnRightClick(wxMouseEvent& event)
 {
     SetFocus();
 
 {
     SetFocus();
 
@@ -516,7 +517,8 @@ void wxRichTextCtrl::OnRightClick(wxMouseEvent& WXUNUSED(event))
     cmdEvent.SetEventObject(this);
     cmdEvent.SetPosition(m_caretPosition+1);
 
     cmdEvent.SetEventObject(this);
     cmdEvent.SetPosition(m_caretPosition+1);
 
-    GetEventHandler()->ProcessEvent(cmdEvent);
+    if (!GetEventHandler()->ProcessEvent(cmdEvent))
+        event.Skip();
 }
 
 /// Left-double-click
 }
 
 /// Left-double-click
@@ -1142,17 +1144,10 @@ bool wxRichTextCtrl::IsPositionVisible(long pos) const
     startX = 0;
     startY = startY * ppuY;
 
     startX = 0;
     startY = startY * ppuY;
 
-    int sx = 0, sy = 0;
-    GetVirtualSize(& sx, & sy);
-    sx = 0;
-    if (ppuY != 0)
-        sy = sy/ppuY;
-
     wxRect rect = line->GetRect();
     wxRect rect = line->GetRect();
-
     wxSize clientSize = GetClientSize();
 
     wxSize clientSize = GetClientSize();
 
-    return !(((rect.y + rect.height) > (clientSize.y + startY)) || rect.y < startY);
+    return (rect.GetBottom() > startY) && (rect.GetTop() < (startY + clientSize.y));
 }
 
 void wxRichTextCtrl::SetCaretPosition(long position, bool showAtLineStart)
 }
 
 void wxRichTextCtrl::SetCaretPosition(long position, bool showAtLineStart)
@@ -3118,5 +3113,17 @@ void wxRichTextCtrl::ClearAvailableFontNames()
     sm_availableFontNames.Clear();
 }
 
     sm_availableFontNames.Clear();
 }
 
+void wxRichTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(event))
+{
+    //wxLogDebug(wxT("wxRichTextCtrl::OnSysColourChanged"));
+
+    wxTextAttrEx basicStyle = GetBasicStyle();
+    basicStyle.SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+    SetBasicStyle(basicStyle);
+    SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
+
+    Refresh();
+}
+
 #endif
     // wxUSE_RICHTEXT
 #endif
     // wxUSE_RICHTEXT