forked from mia/Aegisub
Add mouse wheel forwarding to ScintillaTextCtrl as wxSTC uses the scroll wheel
Originally committed to SVN as r5783.
This commit is contained in:
parent
9ed1653aae
commit
17b9347562
2 changed files with 10 additions and 0 deletions
|
@ -42,6 +42,7 @@
|
||||||
ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style)
|
ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: wxStyledTextCtrl(parent, id, pos, size, style, value)
|
: wxStyledTextCtrl(parent, id, pos, size, style, value)
|
||||||
{
|
{
|
||||||
|
Bind(wxEVT_MOUSEWHEEL, &ScintillaTextCtrl::OnMouseWheel, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief Get unicode-compatible position
|
/// @brief Get unicode-compatible position
|
||||||
|
@ -111,3 +112,10 @@ wxString ScintillaTextCtrl::GetWordAtPosition(int pos) {
|
||||||
void ScintillaTextCtrl::SetSelectionU(int start, int end) {
|
void ScintillaTextCtrl::SetSelectionU(int start, int end) {
|
||||||
SetSelection(GetUnicodePosition(start),GetUnicodePosition(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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
/// DOCME
|
/// DOCME
|
||||||
class ScintillaTextCtrl : public wxStyledTextCtrl {
|
class ScintillaTextCtrl : public wxStyledTextCtrl {
|
||||||
wxString text;
|
wxString text;
|
||||||
|
|
||||||
|
void OnMouseWheel(wxMouseEvent& evt);
|
||||||
public:
|
public:
|
||||||
wxString GetWordAtPosition(int pos);
|
wxString GetWordAtPosition(int pos);
|
||||||
void GetBoundsOfWordAtPosition(int pos,int &start,int &end);
|
void GetBoundsOfWordAtPosition(int pos,int &start,int &end);
|
||||||
|
|
Loading…
Reference in a new issue