enum
{
wxMOUSE_BTN_ANY = -1,
- wxMOUSE_BTN_NONE = -1,
- wxMOUSE_BTN_LEFT = 0,
- wxMOUSE_BTN_MIDDLE = 1,
- wxMOUSE_BTN_RIGHT = 2
+ wxMOUSE_BTN_NONE = 0,
+ wxMOUSE_BTN_LEFT = 1,
+ wxMOUSE_BTN_MIDDLE = 2,
+ wxMOUSE_BTN_RIGHT = 3
};
class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent
// Was it a button event? (*doesn't* mean: is any button *down*?)
bool IsButton() const { return Button(wxMOUSE_BTN_ANY); }
- // Was it a down event from button 1, 2 or 3 or any?
+ // Was it a down event from this (or any) button?
bool ButtonDown(int but = wxMOUSE_BTN_ANY) const;
- // Was it a dclick event from button 1, 2 or 3 or any?
+ // Was it a dclick event from this (or any) button?
bool ButtonDClick(int but = wxMOUSE_BTN_ANY) const;
- // Was it a up event from button 1, 2 or 3 or any?
+ // Was it a up event from this (or any) button?
bool ButtonUp(int but = wxMOUSE_BTN_ANY) const;
- // Was the given button 1,2,3 or any changing state?
+ // Was the given button?
bool Button(int but) const;
- // Was the given button 1,2,3 or any in Down state?
+ // Was the given button in Down state?
bool ButtonIsDown(int but) const;
// Get the button which is changing state (wxMOUSE_BTN_NONE if none)
// True if a button is down and the mouse is moving
bool Dragging() const
{
- return ((m_eventType == wxEVT_MOTION) &&
- (LeftIsDown() || MiddleIsDown() || RightIsDown()));
+ return (m_eventType == wxEVT_MOTION) && ButtonIsDown(wxMOUSE_BTN_ANY);
}
// True if the mouse is moving, and no button is down
- bool Moving() const { return (m_eventType == wxEVT_MOTION); }
+ bool Moving() const
+ {
+ return (m_eventType == wxEVT_MOTION) && !ButtonIsDown(wxMOUSE_BTN_ANY);
+ }
// True if the mouse is just entering the window
bool Entering() const { return (m_eventType == wxEVT_ENTER_WINDOW); }
// wxEventHashTable: a helper of wxEvtHandler to speed up wxEventTable lookups.
// ----------------------------------------------------------------------------
-WX_DEFINE_ARRAY_NO_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
+WX_DEFINE_ARRAY_PTR(const wxEventTableEntry*, wxEventTableEntryPointerArray);
class WXDLLIMPEXP_BASE wxEvtHandler;
class WXDLLIMPEXP_BASE wxEventHashTable