]> git.saurik.com Git - wxWidgets.git/commitdiff
add wxMouseEvent::GetClickCount() and implement it for wxMac
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 29 Oct 2007 22:31:18 +0000 (22:31 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 29 Oct 2007 22:31:18 +0000 (22:31 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49528 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
docs/latex/wx/mouseevt.tex
include/wx/event.h
src/common/event.cpp
src/mac/carbon/toplevel.cpp

index ceac161dafb41f18de98410228a0267a15f9acfd..7fd09acf4e48bb29e7d6148ecca82caac01e7e4c 100644 (file)
@@ -189,6 +189,7 @@ All (GUI):
 - Added support for drop down toolbar buttons (Tim Kosse).
 - Added support for labels for toolbar controls (Vince Harron).
 - Added wxMessageDialog::SetMessage() and SetExtendedMessage().
+- Added wxMouseEvent::GetClickCount() (Julian Scheid)
 - Added wxBG_STYLE_TRANSPARENT background style (Julian Scheid)
 - Added XRCSIZERITEM() macro for obtaining sizers from XRC (Brian Vanderburg II)
 - New and improved wxFileCtrl (Diaa Sami and Marcin Wojdyr)
index f7f87bf4b9378cc60b82614b2ebff407e7ad5a95..8a6cfb7898ab76150526850a61158cb0cf7d5e96 100644 (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.
 
 
+\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}
 
 \constfunc{wxPoint}{GetPosition}{\void}
index 4fc87804d0570de059a6dde21f021e58b83930bb..d63a1140eea4a8a7f352a0fa3e1f63a5e4731876 100644 (file)
@@ -694,7 +694,7 @@ class WXDLLIMPEXP_CORE wxMouseEvent : public wxEvent
 {
 public:
     wxMouseEvent(wxEventType mouseType = wxEVT_NULL);
-    wxMouseEvent(const wxMouseEvent& event)    : wxEvent(event)
+    wxMouseEvent(const wxMouseEvent& event) : wxEvent(event)
         { Assign(event); }
 
     // Was it a button event? (*doesn't* mean: is any button *down*?)
@@ -777,6 +777,10 @@ public:
     // True if the mouse is just leaving the 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
     void GetPosition(wxCoord *xpos, wxCoord *ypos) const
     {
@@ -850,6 +854,8 @@ public:
     bool          m_altDown;
     bool          m_metaDown;
 
+    int           m_clickCount;
+
     int           m_wheelAxis;
     int           m_wheelRotation;
     int           m_wheelDelta;
index c1a2440e9ef7413e55031f89bb81ce939d46126c..5654a132fbae6b9382200e6b45a36b12f970d309 100644 (file)
@@ -518,17 +518,23 @@ wxScrollWinEvent::wxScrollWinEvent(wxEventType commandType,
 wxMouseEvent::wxMouseEvent(wxEventType commandType)
 {
     m_eventType = commandType;
-    m_metaDown = false;
-    m_altDown = false;
-    m_controlDown = false;
-    m_shiftDown = false;
+
+    m_x = 0;
+    m_y = 0;
+
     m_leftDown = false;
-    m_rightDown = false;
     m_middleDown = false;
+    m_rightDown = false;
     m_aux1Down = false;
     m_aux2Down = false;
-    m_x = 0;
-    m_y = 0;
+
+    m_controlDown = false;
+    m_shiftDown = false;
+    m_altDown = false;
+    m_metaDown = false;
+
+    m_clickCount = -1;
+
     m_wheelRotation = 0;
     m_wheelDelta = 0;
     m_linesPerAction = 0;
index dec65979568fc26c3b53f84b6c4646c520f6caf7..48ffe45bb315834c7d5ca3d9f479f61ede4329ed 100644 (file)
@@ -272,6 +272,7 @@ void SetupMouseEvent( wxMouseEvent &wxevent , wxMacCarbonEvent &cEvent )
     wxevent.m_controlDown = modifiers & controlKey;
     wxevent.m_altDown = modifiers & optionKey;
     wxevent.m_metaDown = modifiers & cmdKey;
+    wxevent.m_clickCount = clickCount;
     wxevent.SetTimestamp( cEvent.GetTicks() ) ;
 
     // a control click is interpreted as a right click