+
+#if !wxEVENTS_COMPATIBILITY_2_8
+ //
+ // Connect a function to an event:
+ //
+ template <typename EventType>
+ void Connect(int winid,
+ int lastId,
+ const EventType &eventType,
+ void (*func)(typename EventType::CorrespondingEvent&),
+ wxObject* userData = NULL)
+ {
+ wxEventFunctorFunction< EventType > *functor = wxNewEventFunctor( eventType, func );
+
+ Subscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename EventType>
+ void Connect( int winid,
+ const EventType &eventType,
+ void ( *func )( typename EventType::CorrespondingEvent & ),
+ wxObject* userData = NULL )
+ { Connect( winid, wxID_ANY, eventType, func, userData ); }
+
+ template <typename EventType>
+ void Connect( const EventType &eventType,
+ void ( *func )( typename EventType::CorrespondingEvent & ),
+ wxObject* userData = NULL )
+ { Connect( wxID_ANY, wxID_ANY, eventType, func, userData ); }
+
+ //
+ // Connect a method to an event:
+ //
+
+ template <typename EventType, typename Class>
+ void Connect( int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL )
+ {
+ wxEventFunctorMethod< EventType, Class, Class > *functor =
+ wxNewEventFunctor( eventType, func, static_cast< Class * const >( this ));
+
+ Subscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename EventType, typename Class>
+ void Connect( int winid,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL )
+ { Connect( winid, wxID_ANY, eventType, func, userData ); }
+
+ template <typename EventType, typename Class>
+ void Connect( const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL )
+ { Connect( wxID_ANY, wxID_ANY, eventType, func, userData ); }
+
+ template <typename EventType, typename Class, typename Derived>
+ void Connect( int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ {
+ wxEventFunctorMethod< EventType, Class, Derived > *functor =
+ wxNewEventFunctor( eventType, func, eventSink );
+
+ Subscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename EventType, typename Class, typename Derived>
+ void Connect( int winid,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { Connect( winid, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ template <typename EventType, typename Class, typename Derived>
+ void Connect( const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { Connect( wxID_ANY, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ template <typename Sender, typename EventType, typename Class, typename Derived>
+ static void Connect( Sender *sender,
+ int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ {
+ wxEventFunctorMethod< EventType, Class, Derived > *functor =
+ wxNewEventFunctor( eventType, func, eventSink );
+
+ sender->Subscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename Sender, typename EventType, typename Class, typename Derived>
+ static void Connect( Sender *sender,
+ int winid,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { Connect( sender, winid, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ template <typename Sender, typename EventType, typename Class, typename Derived>
+ static void Connect( Sender *sender,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { Connect( sender, wxID_ANY, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ //
+ // Connect an arbitrary functor to an event:
+ //
+
+ template <typename EventType, typename Functor>
+ void Connect( int winid,
+ int lastId,
+ const EventType &eventType,
+ Functor &functor,
+ wxObject* userData = NULL)
+ {
+ wxEventFunctorAdapter< EventType, Functor > *adapter =
+ wxNewEventFunctor( eventType, functor );
+
+ Subscribe( winid, lastId, eventType, adapter, userData );
+ }
+ template <typename EventType, typename Functor>
+ void Connect( int winid,
+ const EventType &eventType,
+ Functor &functor,
+ wxObject* userData = NULL)
+ { Connect( winid, wxID_ANY, eventType, functor, userData ); }
+
+ template <typename EventType, typename Functor>
+ void Connect( const EventType &eventType,
+ Functor &functor,
+ wxObject* userData = NULL)
+ { Connect( wxID_ANY, wxID_ANY, eventType, functor, userData ); }
+
+ //
+ // Disconnect a function from an event:
+ //
+
+ template <typename EventType>
+ bool Disconnect( int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( *func )( typename EventType::CorrespondingEvent & ),
+ wxObject* userData = NULL )
+ {
+ wxEventFunctorFunction< EventType > functor = wxConstructEventFunctor( eventType, func );
+
+ return Unsubscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename EventType>
+ bool Disconnect( int winid,
+ const EventType &eventType,
+ void ( *func )( typename EventType::CorrespondingEvent & ),
+ wxObject* userData = NULL )
+ { return Disconnect( winid, wxID_ANY, eventType, func, userData ); }
+
+ template <typename EventType>
+ bool Disconnect( const EventType &eventType,
+ void ( *func )( typename EventType::CorrespondingEvent & ),
+ wxObject* userData = NULL )
+ { return Disconnect( wxID_ANY, wxID_ANY, eventType, func, userData ); }
+
+ //
+ // Disconnect a method from an event:
+ //
+
+ template <typename EventType, typename Class>
+ bool Disconnect( int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL )
+ {
+ wxEventFunctorMethod< EventType, Class, Class > functor =
+ wxConstructEventFunctor( eventType, func, static_cast< Class * const >( this ));
+
+ return Unsubscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename EventType, typename Class>
+ bool Disconnect( int winid,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL )
+ { return Disconnect( winid, wxID_ANY, eventType, func, userData ); }
+
+ template <typename EventType, typename Class>
+ bool Disconnect( const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL )
+ { return Disconnect( wxID_ANY, wxID_ANY, eventType, func, userData ); }
+
+ template <typename EventType, typename Class, typename Derived>
+ bool Disconnect( int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ {
+ wxEventFunctorMethod< EventType, Class, Derived > functor =
+ wxConstructEventFunctor( eventType, func, eventSink );
+
+ return Unsubscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename EventType, typename Class, typename Derived>
+ bool Disconnect( int winid,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { return Disconnect( winid, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ template <typename EventType, typename Class, typename Derived>
+ bool Disconnect( const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { return Disconnect( wxID_ANY, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ template <typename Sender, typename EventType, typename Class, typename Derived>
+ static bool Disconnect( Sender *sender,
+ int winid,
+ int lastId,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ {
+ wxEventFunctorMethod< EventType, Class, Derived > functor =
+ wxConstructEventFunctor( eventType, func, eventSink );
+
+ return sender->Unsubscribe( winid, lastId, eventType, functor, userData );
+ }
+
+ template <typename Sender, typename EventType, typename Class, typename Derived>
+ static bool Disconnect( Sender *sender,
+ int winid,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { return Disconnect( sender, winid, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ template <typename Sender, typename EventType, typename Class, typename Derived>
+ static bool Disconnect( Sender *sender,
+ const EventType &eventType,
+ void ( Class::*func )( typename EventType::CorrespondingEvent & ),
+ wxObject *userData = NULL,
+ Derived *eventSink = NULL )
+ { return Disconnect( sender, wxID_ANY, wxID_ANY, eventType, func, userData, eventSink ); }
+
+ //
+ // Disconnect an arbitrary functor from an event:
+ //
+
+ template <typename EventType, typename Functor>
+ bool Disconnect( int winid,
+ int lastId,
+ const EventType &eventType,
+ Functor &functor,
+ wxObject* userData = NULL)
+ {
+ wxEventFunctorAdapter< EventType, Functor > adapter =
+ wxConstructEventFunctor( eventType, functor );
+
+ return Unsubscribe( winid, lastId, eventType, adapter, userData );
+ }
+
+ template <typename EventType, typename Functor>
+ bool Disconnect( int winid,
+ const EventType &eventType,
+ Functor &functor,
+ wxObject* userData = NULL)
+ { return Disconnect( winid, wxID_ANY, eventType, functor, userData ); }
+
+ template <typename EventType, typename Functor>
+ bool Disconnect( const EventType &eventType,
+ Functor &functor,
+ wxObject* userData = NULL)
+ { return Disconnect( wxID_ANY, wxID_ANY, eventType, functor, userData ); }
+
+#endif // !wxEVENTS_COMPATIBILITY_2_8
+
+