C++ (Cpp) wxMouseCaptureChangedEvent Example


The c++ (cpp) wxmousecapturechangedevent example is extracted from the most popular open source projects, you can refer to the following example for usage.

Programming language: C++ (Cpp)

Class/type: wxMouseCaptureChangedEvent

File: WXSceneCanvas.cppProject: jjiezheng/pap_full

void ActorSceneCanvas::OnMouseCaptureChanged(wxMouseCaptureChangedEvent& e)
    if (e.GetEventObject() == this && e.GetCapturedWindow() != this)
        switch (mDragButton)
        case wxMOUSE_BTN_MIDDLE:
                wxPoint pt = wxGetMousePosition();
                pt = ScreenToClient(pt);
                m_pCameraManip->onEnd(pt.x, pt.y, true);
                m_pCameraManip = NULL;

        case wxMOUSE_BTN_LEFT:
                //wxPoint pt = wxGetMousePosition();
                //pt = ScreenToClient(pt);
                //GetActiveAction()->onEnd(pt.x, pt.y, true);

        mDragButton = wxMOUSE_BTN_NONE;

File: Stage.cppProject: colonelqubit/halyard

void Stage::OnMouseCaptureChanged(wxMouseCaptureChangedEvent &inEvent) {
    // According to the manual: "An mouse capture changed event is sent to
    // a window that loses its mouse capture."  Theoretically, this means
    // that we should *never* receive this event to notify us that we
    // *regained* a mouse capture.  However, there's a stack of mouse
    // captures in wxWidgets, and the event name is suspiciously
    // ambiguous, so we're going to check.
    ASSERT(inEvent.GetCapturedWindow() != this);

    // Clear the grabbed element.  Note that this code will be run whenever
    // we lose the mouse grab (at least on Windows, where this event is
    // implemented), even if it's because MouseUngrab called ReleaseMouse
    // directly.  So this may be redudant 99% of the time on windows.  But
    // the other 1% of the time, it happens because somebody popped up an
    // error window while the mouse was grabbed.
    mGrabbedElement = ElementPtr();