mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-13 02:41:16 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80225fa4f0 |
@@ -17,6 +17,7 @@
|
|||||||
BEGIN_EVENT_TABLE(SideButton, wxWindow)
|
BEGIN_EVENT_TABLE(SideButton, wxWindow)
|
||||||
EVT_LEFT_DOWN(SideButton::mouseDown)
|
EVT_LEFT_DOWN(SideButton::mouseDown)
|
||||||
EVT_LEFT_UP(SideButton::mouseReleased)
|
EVT_LEFT_UP(SideButton::mouseReleased)
|
||||||
|
EVT_MOUSE_CAPTURE_LOST(SideButton::mouseCaptureLost)
|
||||||
EVT_PAINT(SideButton::paintEvent)
|
EVT_PAINT(SideButton::paintEvent)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -331,20 +332,30 @@ void SideButton::mouseDown(wxMouseEvent& event)
|
|||||||
event.Skip();
|
event.Skip();
|
||||||
pressedDown = true;
|
pressedDown = true;
|
||||||
SetFocus();
|
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)
|
void SideButton::mouseReleased(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
|
// A press whose release went elsewhere still holds the capture.
|
||||||
|
if (HasCapture())
|
||||||
|
ReleaseMouse();
|
||||||
if (pressedDown) {
|
if (pressedDown) {
|
||||||
pressedDown = false;
|
pressedDown = false;
|
||||||
ReleaseMouse();
|
|
||||||
if (wxRect({0, 0}, GetSize()).Contains(event.GetPosition()))
|
if (wxRect({0, 0}, GetSize()).Contains(event.GetPosition()))
|
||||||
sendButtonEvent();
|
sendButtonEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SideButton::mouseCaptureLost(wxMouseCaptureLostEvent&)
|
||||||
|
{
|
||||||
|
pressedDown = false;
|
||||||
|
}
|
||||||
|
|
||||||
void SideButton::sendButtonEvent()
|
void SideButton::sendButtonEvent()
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ private:
|
|||||||
|
|
||||||
void mouseDown(wxMouseEvent& event);
|
void mouseDown(wxMouseEvent& event);
|
||||||
void mouseReleased(wxMouseEvent& event);
|
void mouseReleased(wxMouseEvent& event);
|
||||||
|
void mouseCaptureLost(wxMouseCaptureLostEvent& event);
|
||||||
|
|
||||||
void sendButtonEvent();
|
void sendButtonEvent();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user