add wxMouseEvent::GetClickCount() and implement it for wxMac

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-10-29 22:31:18 +00:00
parent 75cdd73f80
commit 8866abbb17
5 changed files with 38 additions and 10 deletions

View File

@@ -189,6 +189,7 @@ All (GUI):
- Added support for drop down toolbar buttons (Tim Kosse). - Added support for drop down toolbar buttons (Tim Kosse).
- Added support for labels for toolbar controls (Vince Harron). - Added support for labels for toolbar controls (Vince Harron).
- Added wxMessageDialog::SetMessage() and SetExtendedMessage(). - Added wxMessageDialog::SetMessage() and SetExtendedMessage().
- Added wxMouseEvent::GetClickCount() (Julian Scheid)
- Added wxBG_STYLE_TRANSPARENT background style (Julian Scheid) - Added wxBG_STYLE_TRANSPARENT background style (Julian Scheid)
- Added XRCSIZERITEM() macro for obtaining sizers from XRC (Brian Vanderburg II) - Added XRCSIZERITEM() macro for obtaining sizers from XRC (Brian Vanderburg II)
- New and improved wxFileCtrl (Diaa Sami and Marcin Wojdyr) - New and improved wxFileCtrl (Diaa Sami and Marcin Wojdyr)

View File

@@ -366,6 +366,20 @@ double click events, {\tt wxMOUSE\_BTN\_MIDDLE} and {\tt wxMOUSE\_BTN\_RIGHT}
for the same events for the middle and the right buttons respectively. for the same events for the middle and the right buttons respectively.
\membersection{wxMouseEvent::GetClickCount}\label{wxmouseeventgetclickcount}
\constfunc{int}{GetClickCount}{\void}
Returns the number of mouse clicks for this event: $1$ for a simple click, $2$
for a double-click, $3$ for a triple-click and so on.
Currently this function is implemented only in wxMac and returns $-1$ for the
other platforms (you can still distinguish simple clicks from double-clicks as
they generate different kinds of events however).
\newsince{2.9.0}
\membersection{wxMouseEvent::GetPosition}\label{wxmouseeventgetposition} \membersection{wxMouseEvent::GetPosition}\label{wxmouseeventgetposition}
\constfunc{wxPoint}{GetPosition}{\void} \constfunc{wxPoint}{GetPosition}{\void}

View File

@@ -777,6 +777,10 @@ public:
// True if the mouse is just leaving the window // True if the mouse is just leaving the window
bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); } bool Leaving() const { return (m_eventType == wxEVT_LEAVE_WINDOW); }
// Returns the number of mouse clicks associated with this event.
int GetClickCount() const { return m_clickCount; }
// Find the position of the event // Find the position of the event
void GetPosition(wxCoord *xpos, wxCoord *ypos) const void GetPosition(wxCoord *xpos, wxCoord *ypos) const
{ {
@@ -850,6 +854,8 @@ public:
bool m_altDown; bool m_altDown;
bool m_metaDown; bool m_metaDown;
int m_clickCount;
int m_wheelAxis; int m_wheelAxis;
int m_wheelRotation; int m_wheelRotation;
int m_wheelDelta; int m_wheelDelta;

View File

@@ -518,17 +518,23 @@ wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType,
wxMouseEvent::wxMouseEvent(wxEventType commandType) wxMouseEvent::wxMouseEvent(wxEventType commandType)
{ {
m_eventType = commandType; m_eventType = commandType;
m_metaDown = false;
m_altDown = false;
m_controlDown = false;
m_shiftDown = false;
m_leftDown = false;
m_rightDown = false;
m_middleDown = false;
m_aux1Down = false;
m_aux2Down = false;
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;
m_leftDown = false;
m_middleDown = false;
m_rightDown = false;
m_aux1Down = false;
m_aux2Down = false;
m_controlDown = false;
m_shiftDown = false;
m_altDown = false;
m_metaDown = false;
m_clickCount = -1;
m_wheelRotation = 0; m_wheelRotation = 0;
m_wheelDelta = 0; m_wheelDelta = 0;
m_linesPerAction = 0; m_linesPerAction = 0;

View File

@@ -272,6 +272,7 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
wxevent.m_controlDown = modifiers & controlKey; wxevent.m_controlDown = modifiers & controlKey;
wxevent.m_altDown = modifiers & optionKey; wxevent.m_altDown = modifiers & optionKey;
wxevent.m_metaDown = modifiers & cmdKey; wxevent.m_metaDown = modifiers & cmdKey;
wxevent.m_clickCount = clickCount;
wxevent.SetTimestamp( cEvent.GetTicks() ) ; wxevent.SetTimestamp( cEvent.GetTicks() ) ;
// a control click is interpreted as a right click // a control click is interpreted as a right click