14 #ifndef EVENTHANDLER_H 15 #define EVENTHANDLER_H 40 typedef void EventFunction(
const Event *);
41 typedef void EventCallbackFunction(
const Event *,
void *);
47 AsyncFuture *get_future(
const std::string &event_name);
49 void process_events();
51 virtual void dispatch_event(
const Event *event);
53 void write(std::ostream &out)
const;
58 bool add_hook(
const std::string &event_name, EventFunction *
function);
59 bool add_hook(
const std::string &event_name, EventCallbackFunction *
function,
61 bool has_hook(
const std::string &event_name)
const;
62 bool has_hook(
const std::string &event_name, EventFunction *
function)
const;
63 bool has_hook(
const std::string &event_name, EventCallbackFunction *
function,
65 bool remove_hook(
const std::string &event_name, EventFunction *
function);
66 bool remove_hook(
const std::string &event_name, EventCallbackFunction *
function,
69 bool remove_hooks(
const std::string &event_name);
70 bool remove_hooks_with(
void *data);
72 void remove_all_hooks();
78 typedef std::pair<EventCallbackFunction*, void*> CallbackFunction;
89 static void make_global_event_handler();
92 void write_hook(std::ostream &out,
const Hooks::value_type &hook)
const;
93 void write_cbhook(std::ostream &out,
const CallbackHooks::value_type &hook)
const;
103 TypedObject::get_class_type());
106 return get_class_type();
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static void init_type()
This function is declared non-inline to work around a compiler bug in g++ 2.96.
This class represents a thread-safe handle to a promised future result of an asynchronous operation,...
A class to monitor events from the C++ side of things.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class that all classes which use TypeHandle, and also provide virtual functions t...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A queue of pending events.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A named event, possibly with parameters.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is our own Panda specialization on the default STL set.
TypeHandle is the identifier used to differentiate C++ class types.