15 #ifndef EVENTHANDLER_H 16 #define EVENTHANDLER_H 18 #include "pandabase.h" 44 typedef void EventFunction(
const Event *);
45 typedef void EventCallbackFunction(
const Event *,
void *);
50 void process_events();
52 virtual void dispatch_event(
const Event *);
54 void write(ostream &out)
const;
59 bool add_hook(
const string &event_name, EventFunction *
function);
60 bool add_hook(
const string &event_name, EventCallbackFunction *
function,
62 bool has_hook(
const string &event_name)
const;
63 bool remove_hook(
const string &event_name, EventFunction *
function);
64 bool remove_hook(
const string &event_name, EventCallbackFunction *
function,
67 bool remove_hooks(
const string &event_name);
68 bool remove_hooks_with(
void *data);
70 void remove_all_hooks();
76 typedef pair<EventCallbackFunction*, void*> CallbackFunction;
81 CallbackHooks _cbhooks;
85 static void make_global_event_handler();
88 void write_hook(ostream &out,
const Hooks::value_type &hook)
const;
89 void write_cbhook(ostream &out,
const CallbackHooks::value_type &hook)
const;
98 register_type(_type_handle,
"EventHandler",
99 TypedObject::get_class_type());
102 return get_class_type();
110 #include "eventHandler.I" static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
A class to monitor events from the C++ side of things.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
A queue of pending events.
A named event, possibly with parameters.
This is our own Panda specialization on the default STL set.
TypeHandle is the identifier used to differentiate C++ class types.