mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-11 09:51:06 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80225fa4f0 |
@@ -17,6 +17,7 @@
|
||||
BEGIN_EVENT_TABLE(SideButton, wxWindow)
|
||||
EVT_LEFT_DOWN(SideButton::mouseDown)
|
||||
EVT_LEFT_UP(SideButton::mouseReleased)
|
||||
EVT_MOUSE_CAPTURE_LOST(SideButton::mouseCaptureLost)
|
||||
EVT_PAINT(SideButton::paintEvent)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
@@ -331,20 +332,30 @@ void SideButton::mouseDown(wxMouseEvent& event)
|
||||
event.Skip();
|
||||
pressedDown = true;
|
||||
SetFocus();
|
||||
CaptureMouse();
|
||||
// Capturing twice pushes this button onto the capture stack twice, and the
|
||||
// release would then hand the capture straight back to it.
|
||||
if (!HasCapture())
|
||||
CaptureMouse();
|
||||
}
|
||||
|
||||
void SideButton::mouseReleased(wxMouseEvent& event)
|
||||
{
|
||||
event.Skip();
|
||||
// A press whose release went elsewhere still holds the capture.
|
||||
if (HasCapture())
|
||||
ReleaseMouse();
|
||||
if (pressedDown) {
|
||||
pressedDown = false;
|
||||
ReleaseMouse();
|
||||
if (wxRect({0, 0}, GetSize()).Contains(event.GetPosition()))
|
||||
sendButtonEvent();
|
||||
}
|
||||
}
|
||||
|
||||
void SideButton::mouseCaptureLost(wxMouseCaptureLostEvent&)
|
||||
{
|
||||
pressedDown = false;
|
||||
}
|
||||
|
||||
void SideButton::sendButtonEvent()
|
||||
{
|
||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
|
||||
|
||||
@@ -94,6 +94,7 @@ private:
|
||||
|
||||
void mouseDown(wxMouseEvent& event);
|
||||
void mouseReleased(wxMouseEvent& event);
|
||||
void mouseCaptureLost(wxMouseCaptureLostEvent& event);
|
||||
|
||||
void sendButtonEvent();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user