Add mouse wheel forwarding to ScintillaTextCtrl as wxSTC uses the scroll wheel

Originally committed to SVN as r5783.
This commit is contained in:
Thomas Goyne 2011-10-25 19:41:06 +00:00
parent 9ed1653aae
commit 17b9347562
2 changed files with 10 additions and 0 deletions

View file

@ -42,6 +42,7 @@
ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style)
: wxStyledTextCtrl(parent, id, pos, size, style, value)
{
Bind(wxEVT_MOUSEWHEEL, &ScintillaTextCtrl::OnMouseWheel, this);
}
/// @brief Get unicode-compatible position
@ -111,3 +112,10 @@ wxString ScintillaTextCtrl::GetWordAtPosition(int pos) {
void ScintillaTextCtrl::SetSelectionU(int start, int end) {
SetSelection(GetUnicodePosition(start),GetUnicodePosition(end));
}
void ScintillaTextCtrl::OnMouseWheel(wxMouseEvent& evt) {
if (ForwardMouseWheelEvent(this, evt)) {
// Skip the event so that wxSTC's default mouse wheel handler is hit
evt.Skip();
}
}

View file

@ -45,6 +45,8 @@
/// DOCME
class ScintillaTextCtrl : public wxStyledTextCtrl {
wxString text;
void OnMouseWheel(wxMouseEvent& evt);
public:
wxString GetWordAtPosition(int pos);
void GetBoundsOfWordAtPosition(int pos,int &start,int &end);