]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
updated copyright year, s/wxWindows/wxWidgets/
[wxWidgets.git] / src / common / event.cpp
index 6da2424443fd3dc654650f555e38a7888c45e379..043eafa8699211c28d83049141f569e1659c2b2b 100644 (file)
     #pragma hdrstop
 #endif
 
+#include "wx/event.h"
+
 #ifndef WX_PRECOMP
-    #include "wx/app.h"
     #include "wx/list.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/stopwatch.h"
+    #include "wx/module.h"
 
     #if wxUSE_GUI
         #include "wx/control.h"
-        #include "wx/utils.h"
         #include "wx/dc.h"
         #include "wx/textctrl.h"
+        #include "wx/validate.h"
     #endif // wxUSE_GUI
 #endif
 
-#include "wx/event.h"
-#include "wx/module.h"
-
-#if wxUSE_GUI
-    #include "wx/validate.h"
-#if wxUSE_STOPWATCH
-    #include "wx/stopwatch.h"
-#endif
-#endif // wxUSE_GUI
-
 // ----------------------------------------------------------------------------
 // wxWin macros
 // ----------------------------------------------------------------------------
@@ -91,6 +86,8 @@
     IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureChangedEvent, wxEvent)
+    IMPLEMENT_DYNAMIC_CLASS(wxMouseCaptureLostEvent, wxEvent)
+    IMPLEMENT_DYNAMIC_CLASS(wxClipboardTextEvent, wxCommandEvent)
 #endif // wxUSE_GUI
 
 #if wxUSE_BASE
@@ -263,6 +260,7 @@ DEFINE_EVENT_TYPE(wxEVT_SHOW)
 DEFINE_EVENT_TYPE(wxEVT_ICONIZE)
 DEFINE_EVENT_TYPE(wxEVT_MAXIMIZE)
 DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_MOUSE_CAPTURE_LOST)
 DEFINE_EVENT_TYPE(wxEVT_PAINT)
 DEFINE_EVENT_TYPE(wxEVT_ERASE_BACKGROUND)
 DEFINE_EVENT_TYPE(wxEVT_NC_PAINT)
@@ -287,6 +285,11 @@ DEFINE_EVENT_TYPE(wxEVT_COMPARE_ITEM)
 DEFINE_EVENT_TYPE(wxEVT_INIT_DIALOG)
 DEFINE_EVENT_TYPE(wxEVT_UPDATE_UI)
 
+// Clipboard events
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_COPY)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_CUT)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_TEXT_PASTE)
+
 // Generic command events
 // Note: a click is a higher-level event than button down/up
 DEFINE_EVENT_TYPE(wxEVT_COMMAND_LEFT_CLICK)
@@ -736,10 +739,12 @@ wxKeyEvent::wxKeyEvent(const wxKeyEvent& evt)
 #endif
 }
 
+#if WXWIN_COMPATIBILITY_2_6
 long wxKeyEvent::KeyCode() const
 {
     return m_keyCode;
 }
+#endif // WXWIN_COMPATIBILITY_2_6
 
 wxWindowCreateEvent::wxWindowCreateEvent(wxWindow *win)
 {
@@ -759,6 +764,23 @@ wxChildFocusEvent::wxChildFocusEvent(wxWindow *win)
     SetEventObject(win);
 }
 
+// ----------------------------------------------------------------------------
+// wxHelpEvent
+// ----------------------------------------------------------------------------
+
+/* static */
+wxHelpEvent::Origin wxHelpEvent::GuessOrigin(Origin origin)
+{
+    if ( origin == Origin_Unknown )
+    {
+        // assume that the event comes from the help button if it's not from
+        // keyboard and that pressing F1 always results in the help event
+        origin = wxGetKeyState(WXK_F1) ? Origin_Keyboard : Origin_HelpButton;
+    }
+
+    return origin;
+}
+
 #endif // wxUSE_GUI
 
 
@@ -1344,6 +1366,10 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
         wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData();
 #endif // WXWIN_COMPATIBILITY_EVENT_TYPES/!WXWIN_COMPATIBILITY_EVENT_TYPES
 
+        // get next node before (maybe) calling the event handler as it could
+        // call Disconnect() invalidating the current node
+        node = node->GetNext();
+
         if ((event.GetEventType() == entry->m_eventType) && (entry->m_fn != 0))
         {
             wxEvtHandler *handler =
@@ -1358,8 +1384,6 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
                 return true;
             }
         }
-
-        node = node->GetNext();
     }
 
     return false;