Implement EVT_MOUSE_CAPTURE_LOST handler in wxSTC
When mouse is captured somwhere in the application, it's recommended to have implemented a EVT_MOUSE_CAPTURE_LOST handler. Resetting in the handler flag signalling captured state seems to be a sufficient action because something like this is implemented in the native Scintilla and it works fine in SciTE. Closes #17961.
This commit is contained in:
committed by
Artur Wieczorek
parent
6d0cb403a9
commit
3a362c64cf
@@ -5439,6 +5439,7 @@ protected:
|
||||
void OnMenu(wxCommandEvent& evt);
|
||||
void OnListBox(wxCommandEvent& evt);
|
||||
void OnIdle(wxIdleEvent& evt);
|
||||
void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt);
|
||||
|
||||
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
|
||||
|
@@ -1180,6 +1180,12 @@ void ScintillaWX::DoOnListBox() {
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::DoMouseCaptureLost()
|
||||
{
|
||||
capturedMouse = false;
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::DoOnIdle(wxIdleEvent& evt) {
|
||||
|
||||
if ( Idle() )
|
||||
|
@@ -183,6 +183,7 @@ public:
|
||||
void DoCommand(int ID);
|
||||
bool DoContextMenu(Point pt);
|
||||
void DoOnListBox();
|
||||
void DoMouseCaptureLost();
|
||||
|
||||
|
||||
// helpers
|
||||
|
@@ -162,6 +162,7 @@ wxBEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
|
||||
EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
|
||||
EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu)
|
||||
EVT_LISTBOX_DCLICK (wxID_ANY, wxStyledTextCtrl::OnListBox)
|
||||
EVT_MOUSE_CAPTURE_LOST (wxStyledTextCtrl::OnMouseCaptureLost)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
|
||||
@@ -5369,6 +5370,11 @@ void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoMouseCaptureLost();
|
||||
}
|
||||
|
||||
|
||||
wxSize wxStyledTextCtrl::DoGetBestSize() const
|
||||
{
|
||||
// What would be the best size for a wxSTC?
|
||||
|
@@ -162,6 +162,7 @@ wxBEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
|
||||
EVT_ERASE_BACKGROUND (wxStyledTextCtrl::OnEraseBackground)
|
||||
EVT_MENU_RANGE (10, 16, wxStyledTextCtrl::OnMenu)
|
||||
EVT_LISTBOX_DCLICK (wxID_ANY, wxStyledTextCtrl::OnListBox)
|
||||
EVT_MOUSE_CAPTURE_LOST (wxStyledTextCtrl::OnMouseCaptureLost)
|
||||
wxEND_EVENT_TABLE()
|
||||
|
||||
|
||||
@@ -884,6 +885,11 @@ void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnMouseCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(evt)) {
|
||||
m_swx->DoMouseCaptureLost();
|
||||
}
|
||||
|
||||
|
||||
wxSize wxStyledTextCtrl::DoGetBestSize() const
|
||||
{
|
||||
// What would be the best size for a wxSTC?
|
||||
|
@@ -562,6 +562,7 @@ protected:
|
||||
void OnMenu(wxCommandEvent& evt);
|
||||
void OnListBox(wxCommandEvent& evt);
|
||||
void OnIdle(wxIdleEvent& evt);
|
||||
void OnMouseCaptureLost(wxMouseCaptureLostEvent& evt);
|
||||
|
||||
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
||||
|
||||
|
Reference in New Issue
Block a user