Panda3D
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 
14 INLINE void
15 throw_event(const CPT_Event &event) {
16  EventQueue::get_global_event_queue()->queue_event(event);
17 }
18 
19 INLINE void
20 throw_event(const std::string &event_name) {
21  EventQueue::get_global_event_queue()->queue_event(new Event(event_name));
22 }
23 
24 INLINE void
25 throw_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 
32 INLINE void
33 throw_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 
42 INLINE void
43 throw_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 
54 INLINE void
55 throw_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 
69 INLINE void
70 throw_event_directly(EventHandler& handler,
71  const CPT_Event &event) {
72  handler.dispatch_event(event);
73 }
74 
75 INLINE void
76 throw_event_directly(EventHandler& handler,
77  const std::string &event_name) {
78  handler.dispatch_event(new Event(event_name));
79 }
80 
81 INLINE void
82 throw_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 
90 INLINE void
91 throw_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 
101 INLINE void
102 throw_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 }
A class to monitor events from the C++ side of things.
Definition: eventHandler.h:37
An optional parameter associated with an event.
static EventQueue * get_global_event_queue()
Returns a pointer to the one global EventQueue object.
Definition: eventQueue.I:19
virtual void dispatch_event(const Event *event)
Calls the hooks assigned to the indicated single event.
A named event, possibly with parameters.
Definition: event.h:33
A ConstPointerTo is similar to a PointerTo, except it keeps a const pointer to the thing.
Definition: pointerTo.h:144