m_linesPerAction = event.m_linesPerAction;
}
-// True if was a button dclick event (1 = left, 2 = middle, 3 = right)
-// or any button dclick event (but = -1)
+// return true if was a button dclick event
bool wxMouseEvent::ButtonDClick(int but) const
{
switch (but)
{
- case -1:
+ default:
+ wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick"));
+ // fall through
+
+ case wxMOUSE_BTN_ANY:
return (LeftDClick() || MiddleDClick() || RightDClick());
- case 1:
+
+ case wxMOUSE_BTN_LEFT:
return LeftDClick();
- case 2:
+
+ case wxMOUSE_BTN_MIDDLE:
return MiddleDClick();
- case 3:
+
+ case wxMOUSE_BTN_RIGHT:
return RightDClick();
- default:
- wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDClick"));
}
-
- return false;
}
-// True if was a button down event (1 = left, 2 = middle, 3 = right)
-// or any button down event (but = -1)
+// return true if was a button down event
bool wxMouseEvent::ButtonDown(int but) const
{
switch (but)
{
- case -1:
+ default:
+ wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown"));
+ // fall through
+
+ case wxMOUSE_BTN_ANY:
return (LeftDown() || MiddleDown() || RightDown());
- case 1:
+
+ case wxMOUSE_BTN_LEFT:
return LeftDown();
- case 2:
+
+ case wxMOUSE_BTN_MIDDLE:
return MiddleDown();
- case 3:
+
+ case wxMOUSE_BTN_RIGHT:
return RightDown();
- default:
- wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonDown"));
}
-
- return false;
}
-// True if was a button up event (1 = left, 2 = middle, 3 = right)
-// or any button up event (but = -1)
+// return true if was a button up event
bool wxMouseEvent::ButtonUp(int but) const
{
switch (but)
{
- case -1:
+ default:
+ wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp"));
+ // fall through
+
+ case wxMOUSE_BTN_ANY:
return (LeftUp() || MiddleUp() || RightUp());
- case 1:
+
+ case wxMOUSE_BTN_LEFT:
return LeftUp();
- case 2:
+
+ case wxMOUSE_BTN_MIDDLE:
return MiddleUp();
- case 3:
+
+ case wxMOUSE_BTN_RIGHT:
return RightUp();
- default:
- wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonUp"));
}
-
- return false;
}
-// True if the given button is currently changing state
+// return true if the given button is currently changing state
bool wxMouseEvent::Button(int but) const
{
switch (but)
{
- case -1:
- return (ButtonUp(-1) || ButtonDown(-1) || ButtonDClick(-1));
- case 1:
- return (LeftDown() || LeftUp() || LeftDClick());
- case 2:
- return (MiddleDown() || MiddleUp() || MiddleDClick());
- case 3:
- return (RightDown() || RightUp() || RightDClick());
default:
wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::Button"));
- }
+ // fall through
- return false;
+ case wxMOUSE_BTN_ANY:
+ return ButtonUp(wxMOUSE_BTN_ANY) ||
+ ButtonDown(wxMOUSE_BTN_ANY) ||
+ ButtonDClick(wxMOUSE_BTN_ANY);
+
+ case wxMOUSE_BTN_LEFT:
+ return LeftDown() || LeftUp() || LeftDClick();
+
+ case wxMOUSE_BTN_MIDDLE:
+ return MiddleDown() || MiddleUp() || MiddleDClick();
+
+ case wxMOUSE_BTN_RIGHT:
+ return RightDown() || RightUp() || RightDClick();
+ }
}
bool wxMouseEvent::ButtonIsDown(int but) const
{
switch (but)
{
- case -1:
- return (LeftIsDown() || MiddleIsDown() || RightIsDown());
- case 1:
+ default:
+ wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown"));
+ // fall through
+
+ case wxMOUSE_BTN_ANY:
+ return LeftIsDown() || MiddleIsDown() || RightIsDown();
+
+ case wxMOUSE_BTN_LEFT:
return LeftIsDown();
- case 2:
+
+ case wxMOUSE_BTN_MIDDLE:
return MiddleIsDown();
- case 3:
+
+ case wxMOUSE_BTN_RIGHT:
return RightIsDown();
- default:
- wxFAIL_MSG(wxT("invalid parameter in wxMouseEvent::ButtonIsDown"));
}
-
- return false;
}
int wxMouseEvent::GetButton() const
}
}
- return -1;
+ return wxMOUSE_BTN_NONE;
}
// Find the logical position of the event given the DC
void wxEvtHandler::ProcessPendingEvents()
{
+ // this method is only called by wxApp if this handler does have pending
+ // events
+ wxCHECK_RET( m_pendingEvents,
+ wxT("Please call wxApp::ProcessPendingEvents() instead") );
+
#if defined(__VISAGECPP__)
wxENTER_CRIT_SECT( m_eventsLocker);
#else
wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
#endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
- if ((event.m_eventType == entry->m_eventType) && entry->m_fn)
+ if ((event.m_eventType == entry->m_eventType) && (entry->m_fn != 0))
{
wxEvtHandler *handler =
#if !WXWIN_COMPATIBILITY_EVENT_TYPES