Panda3D

Loading...
Searching...
No Matches
throw_event.I
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file throw_event.I
10 * @author drose
11 * @date 1999-02-08
12 */
13
14INLINE void
15throw_event(const CPT_Event &event) {
16 EventQueue::get_global_event_queue()->queue_event(event);
17}
18
19INLINE void
20throw_event(const std::string &event_name) {
21 EventQueue::get_global_event_queue()->queue_event(new Event(event_name));
22}
23
24INLINE void
25throw_event(const std::string &event_name,
26 const EventParameter &p1) {
27 Event *event = new Event(event_name);
28 event->add_parameter(p1);
29 EventQueue::get_global_event_queue()->queue_event(event);
30}
31
32INLINE void
33throw_event(const std::string &event_name,
34 const EventParameter &p1,
35 const EventParameter &p2) {
36 Event *event = new Event(event_name);
37 event->add_parameter(p1);
38 event->add_parameter(p2);
39 EventQueue::get_global_event_queue()->queue_event(event);
40}
41
42INLINE void
43throw_event(const std::string &event_name,
44 const EventParameter &p1,
45 const EventParameter &p2,
46 const EventParameter &p3) {
47 Event *event = new Event(event_name);
48 event->add_parameter(p1);
49 event->add_parameter(p2);
50 event->add_parameter(p3);
51 EventQueue::get_global_event_queue()->queue_event(event);
52}
53
54INLINE void
55throw_event(const std::string &event_name,
56 const EventParameter &p1,
57 const EventParameter &p2,
58 const EventParameter &p3,
59 const EventParameter &p4) {
60 Event *event = new Event(event_name);
61 event->add_parameter(p1);
62 event->add_parameter(p2);
63 event->add_parameter(p3);
64 event->add_parameter(p4);
65 EventQueue::get_global_event_queue()->queue_event(event);
66}
67
68
69INLINE void
70throw_event_directly(EventHandler& handler,
71 const CPT_Event &event) {
72 handler.dispatch_event(event);
73}
74
75INLINE void
76throw_event_directly(EventHandler& handler,
77 const std::string &event_name) {
78 handler.dispatch_event(new Event(event_name));
79}
80
81INLINE void
82throw_event_directly(EventHandler& handler,
83 const std::string &event_name,
84 const EventParameter &p1) {
85 Event *event = new Event(event_name);
86 event->add_parameter(p1);
87 handler.dispatch_event(event);
88}
89
90INLINE void
91throw_event_directly(EventHandler& handler,
92 const std::string &event_name,
93 const EventParameter &p1,
94 const EventParameter &p2) {
95 Event *event = new Event(event_name);
96 event->add_parameter(p1);
97 event->add_parameter(p2);
98 handler.dispatch_event(event);
99}
100
101INLINE void
102throw_event_directly(EventHandler& handler,
103 const std::string &event_name,
104 const EventParameter &p1,
105 const EventParameter &p2,
106 const EventParameter &p3) {
107 Event *event = new Event(event_name);
108 event->add_parameter(p1);
109 event->add_parameter(p2);
110 event->add_parameter(p3);
111 handler.dispatch_event(event);
112}
EventHandler
A class to monitor events from the C++ side of things.
Definition eventHandler.h:37
EventHandler::dispatch_event
virtual void dispatch_event(const Event *event)
Calls the hooks assigned to the indicated single event.
Definition eventHandler.cxx:68
EventParameter
An optional parameter associated with an event.
Definition eventParameter.h:35
EventQueue::get_global_event_queue
static EventQueue * get_global_event_queue()
Returns a pointer to the one global EventQueue object.
Definition eventQueue.I:19
Event
A named event, possibly with parameters.
Definition event.h:33