]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/event.h
subclass all updown controls in notebooks, not just the first one
[wxWidgets.git] / include / wx / event.h
index 884459101c20e70f07fe48fbd6617d9e8f2a2ed0..de4c15edeb2803c3da292c91bf1b9aabbdc56ec0 100644 (file)
@@ -273,6 +273,7 @@ BEGIN_DECLARE_EVENT_TYPES()
     DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
     DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
     DECLARE_EVENT_TYPE(wxEVT_MOVING, 442)
     DECLARE_EVENT_TYPE(wxEVT_UPDATE_UI, 440)
     DECLARE_EVENT_TYPE(wxEVT_SIZING, 441)
     DECLARE_EVENT_TYPE(wxEVT_MOVING, 442)
+    DECLARE_EVENT_TYPE(wxEVT_HIBERNATE, 443)
 
         // Generic command events
         // Note: a click is a higher-level event than button down/up
 
         // Generic command events
         // Note: a click is a higher-level event than button down/up
@@ -1288,6 +1289,7 @@ private:
 /*
  wxEVT_ACTIVATE
  wxEVT_ACTIVATE_APP
 /*
  wxEVT_ACTIVATE
  wxEVT_ACTIVATE_APP
+ wxEVT_HIBERNATE
  */
 
 class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
  */
 
 class WXDLLIMPEXP_CORE wxActivateEvent : public wxEvent
@@ -1387,7 +1389,15 @@ public:
         m_canVeto(event.m_canVeto) {}
 
     void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
         m_canVeto(event.m_canVeto) {}
 
     void SetLoggingOff(bool logOff) { m_loggingOff = logOff; }
-    bool GetLoggingOff() const { return m_loggingOff; }
+    bool GetLoggingOff() const
+    {
+        // m_loggingOff flag is only used by wxEVT_[QUERY_]END_SESSION, it
+        // doesn't make sense for wxEVT_CLOSE_WINDOW
+        wxASSERT_MSG( m_eventType != wxEVT_CLOSE_WINDOW,
+                      _T("this flag is for end session events only") );
+
+        return m_loggingOff;
+    }
 
     void Veto(bool veto = true)
     {
 
     void Veto(bool veto = true)
     {
@@ -1398,19 +1408,18 @@ public:
         m_veto = veto;
     }
     void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
         m_veto = veto;
     }
     void SetCanVeto(bool canVeto) { m_canVeto = canVeto; }
-    // No more asserts here please, the one you put here was wrong.
     bool CanVeto() const { return m_canVeto; }
     bool GetVeto() const { return m_canVeto && m_veto; }
 
     virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
 
 protected:
     bool CanVeto() const { return m_canVeto; }
     bool GetVeto() const { return m_canVeto && m_veto; }
 
     virtual wxEvent *Clone() const { return new wxCloseEvent(*this); }
 
 protected:
-    bool m_loggingOff;
-    bool m_veto, m_canVeto;
+    bool m_loggingOff,
+         m_veto,
+         m_canVeto;
 
 private:
     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
 
 private:
     DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxCloseEvent)
-
 };
 
 /*
 };
 
 /*
@@ -1859,7 +1868,7 @@ class WXDLLIMPEXP_CORE wxNavigationKeyEvent : public wxEvent
 public:
     wxNavigationKeyEvent()
         : wxEvent(0, wxEVT_NAVIGATION_KEY),
 public:
     wxNavigationKeyEvent()
         : wxEvent(0, wxEVT_NAVIGATION_KEY),
-          m_flags(IsForward),    // defaults are for TAB
+          m_flags(IsForward | FromTab),    // defaults are for TAB
           m_focus((wxWindow *)NULL)
         {
             m_propagationLevel = wxEVENT_PROPAGATE_NONE;
           m_focus((wxWindow *)NULL)
         {
             m_propagationLevel = wxEVENT_PROPAGATE_NONE;
@@ -1884,6 +1893,13 @@ public:
     void SetWindowChange(bool bIs)
         { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
 
     void SetWindowChange(bool bIs)
         { if ( bIs ) m_flags |= WinChange; else m_flags &= ~WinChange; }
 
+    // Set to true under MSW if the event was generated using the tab key.
+    // This is required for proper navogation over radio buttons
+    bool IsFromTab() const
+        { return (m_flags & FromTab) != 0; }
+    void SetFromTab(bool bIs)
+        { if ( bIs ) m_flags |= FromTab; else m_flags &= ~FromTab; }
+
     // the child which has the focus currently (may be NULL - use
     // wxWindow::FindFocus then)
     wxWindow* GetCurrentFocus() const { return m_focus; }
     // the child which has the focus currently (may be NULL - use
     // wxWindow::FindFocus then)
     wxWindow* GetCurrentFocus() const { return m_focus; }
@@ -1898,7 +1914,8 @@ public:
     {
         IsBackward = 0x0000,
         IsForward = 0x0001,
     {
         IsBackward = 0x0000,
         IsForward = 0x0001,
-        WinChange = 0x0002
+        WinChange = 0x0002,
+        FromTab = 0x0004
     };
 
     long m_flags;
     };
 
     long m_flags;
@@ -2097,7 +2114,10 @@ private:
 // event handler and related classes
 // ============================================================================
 
 // event handler and related classes
 // ============================================================================
 
-typedef void (wxEvtHandler::*wxObjectEventFunction)(wxEvent&);
+// for backwards compatibility and to prevent eVC 4 for ARM from crashing with
+// internal compiler error when compiling wx, we define wxObjectEventFunction
+// as a wxObject method even though it can only be a wxEvtHandler one
+typedef void (wxObject::*wxObjectEventFunction)(wxEvent&);
 
 // we can't have ctors nor base struct in backwards compatibility mode or
 // otherwise we won't be able to initialize the objects with an agregate, so
 
 // we can't have ctors nor base struct in backwards compatibility mode or
 // otherwise we won't be able to initialize the objects with an agregate, so
@@ -2342,6 +2362,11 @@ public:
                     wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
         { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
 
                     wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
         { return Disconnect(winid, wxID_ANY, eventType, func, userData, eventSink); }
 
+    bool Disconnect(wxEventType eventType,
+                    wxObjectEventFunction func,
+                    wxObject *userData = (wxObject *) NULL,
+                    wxEvtHandler *eventSink = (wxEvtHandler *) NULL)
+        { return Disconnect(wxID_ANY, eventType, func, userData, eventSink); }
 
     wxList* GetDynamicEventTable() const { return m_dynamicEvents ; }
 
 
     wxList* GetDynamicEventTable() const { return m_dynamicEvents ; }
 
@@ -2409,8 +2434,14 @@ protected:
 
 #if wxUSE_THREADS
 #if defined (__VISAGECPP__)
 
 #if wxUSE_THREADS
 #if defined (__VISAGECPP__)
+    const wxCriticalSection& Lock() const { return m_eventsLocker; }
+    wxCriticalSection& Lock() { return m_eventsLocker; }
+
     wxCriticalSection   m_eventsLocker;
 #  else
     wxCriticalSection   m_eventsLocker;
 #  else
+    const wxCriticalSection& Lock() const { return *m_eventsLocker; }
+    wxCriticalSection& Lock() { return *m_eventsLocker; }
+
     wxCriticalSection*  m_eventsLocker;
 #  endif
 #endif
     wxCriticalSection*  m_eventsLocker;
 #  endif
 #endif
@@ -2505,76 +2536,76 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC
 
 
 #define wxCommandEventHandler(func) \
 
 
 #define wxCommandEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCommandEventFunction, &func)
 #define wxScrollEventHandler(func) \
 #define wxScrollEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollEventFunction, &func)
 #define wxScrollWinEventHandler(func) \
 #define wxScrollWinEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxScrollWinEventFunction, &func)
 #define wxSizeEventHandler(func) \
 #define wxSizeEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSizeEventFunction, &func)
 #define wxMoveEventHandler(func) \
 #define wxMoveEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMoveEventFunction, &func)
 #define wxPaintEventHandler(func) \
 #define wxPaintEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaintEventFunction, &func)
 #define wxNcPaintEventHandler(func) \
 #define wxNcPaintEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNcPaintEventFunction, &func)
 #define wxEraseEventHandler(func) \
 #define wxEraseEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxEraseEventFunction, &func)
 #define wxMouseEventHandler(func) \
 #define wxMouseEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseEventFunction, &func)
 #define wxCharEventHandler(func) \
 #define wxCharEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxCharEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCharEventFunction, &func)
 #define wxKeyEventHandler(func) wxCharEventHandler(func)
 #define wxFocusEventHandler(func) \
 #define wxKeyEventHandler(func) wxCharEventHandler(func)
 #define wxFocusEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxFocusEventFunction, &func)
 #define wxChildFocusEventHandler(func) \
 #define wxChildFocusEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxChildFocusEventFunction, &func)
 #define wxActivateEventHandler(func) \
 #define wxActivateEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxActivateEventFunction, &func)
 #define wxMenuEventHandler(func) \
 #define wxMenuEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMenuEventFunction, &func)
 #define wxJoystickEventHandler(func) \
 #define wxJoystickEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxJoystickEventFunction, &func)
 #define wxDropFilesEventHandler(func) \
 #define wxDropFilesEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDropFilesEventFunction, &func)
 #define wxInitDialogEventHandler(func) \
 #define wxInitDialogEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxInitDialogEventFunction, &func)
 #define wxSysColourChangedEventHandler(func) \
 #define wxSysColourChangedEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSysColourChangedEventFunction, &func)
 #define wxDisplayChangedEventHandler(func) \
 #define wxDisplayChangedEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxDisplayChangedEventFunction, &func)
 #define wxUpdateUIEventHandler(func) \
 #define wxUpdateUIEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxUpdateUIEventFunction, &func)
 #define wxIdleEventHandler(func) \
 #define wxIdleEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIdleEventFunction, &func)
 #define wxCloseEventHandler(func) \
 #define wxCloseEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxCloseEventFunction, &func)
 #define wxShowEventHandler(func) \
 #define wxShowEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxShowEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxShowEventFunction, &func)
 #define wxIconizeEventHandler(func) \
 #define wxIconizeEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxIconizeEventFunction, &func)
 #define wxMaximizeEventHandler(func) \
 #define wxMaximizeEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMaximizeEventFunction, &func)
 #define wxNavigationKeyEventHandler(func) \
 #define wxNavigationKeyEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNavigationKeyEventFunction, &func)
 #define wxPaletteChangedEventHandler(func) \
 #define wxPaletteChangedEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxPaletteChangedEventFunction, &func)
 #define wxQueryNewPaletteEventHandler(func) \
 #define wxQueryNewPaletteEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxQueryNewPaletteEventFunction, &func)
 #define wxWindowCreateEventHandler(func) \
 #define wxWindowCreateEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowCreateEventFunction, &func)
 #define wxWindowDestroyEventHandler(func) \
 #define wxWindowDestroyEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxWindowDestroyEventFunction, &func)
 #define wxSetCursorEventHandler(func) \
 #define wxSetCursorEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSetCursorEventFunction, &func)
 #define wxNotifyEventHandler(func) \
 #define wxNotifyEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxNotifyEventFunction, &func)
 #define wxHelpEventHandler(func) \
 #define wxHelpEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxHelpEventFunction, &func)
 #define wxContextMenuEventHandler(func) \
 #define wxContextMenuEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxContextMenuEventFunction, &func)
 #define wxMouseCaptureChangedEventHandler(func) \
 #define wxMouseCaptureChangedEventHandler(func) \
-    (wxObjectEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func)
+    (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxMouseCaptureChangedEventFunction, &func)
 
 #endif // wxUSE_GUI
 
 
 #endif // wxUSE_GUI
 
@@ -2669,6 +2700,7 @@ typedef void (wxEvtHandler::*wxMouseCaptureChangedEventFunction)(wxMouseCaptureC
 #define EVT_CHILD_FOCUS(func)  wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
 #define EVT_ACTIVATE(func)  wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
 #define EVT_ACTIVATE_APP(func)  wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
 #define EVT_CHILD_FOCUS(func)  wx__DECLARE_EVT0(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(func))
 #define EVT_ACTIVATE(func)  wx__DECLARE_EVT0(wxEVT_ACTIVATE, wxActivateEventHandler(func))
 #define EVT_ACTIVATE_APP(func)  wx__DECLARE_EVT0(wxEVT_ACTIVATE_APP, wxActivateEventHandler(func))
+#define EVT_HIBERNATE(func)  wx__DECLARE_EVT0(wxEVT_HIBERNATE, wxActivateEventHandler(func))
 #define EVT_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
 #define EVT_QUERY_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
 #define EVT_DROP_FILES(func)  wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))
 #define EVT_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_END_SESSION, wxCloseEventHandler(func))
 #define EVT_QUERY_END_SESSION(func)  wx__DECLARE_EVT0(wxEVT_QUERY_END_SESSION, wxCloseEventHandler(func))
 #define EVT_DROP_FILES(func)  wx__DECLARE_EVT0(wxEVT_DROP_FILES, wxDropFilesEventHandler(func))