Panda3D
buttonEventList.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 buttonEventList.I
10  * @author drose
11  * @date 2002-03-12
12  */
13 
14 /**
15  *
16  */
17 INLINE ButtonEventList::
18 ButtonEventList() {
19 }
20 
21 /**
22  *
23  */
24 INLINE ButtonEventList::
25 ButtonEventList(const ButtonEventList &copy) :
26  _events(copy._events)
27 {
28 }
29 
30 /**
31  *
32  */
33 INLINE void ButtonEventList::
34 operator = (const ButtonEventList &copy) {
35  _events = copy._events;
36 }
37 
38 /**
39  * Adds a new event to the end of the list.
40  */
41 INLINE void ButtonEventList::
43  _events.push_back(event);
44 }
45 
46 /**
47  * Returns the number of events in the list.
48  */
49 INLINE int ButtonEventList::
50 get_num_events() const {
51  return _events.size();
52 }
53 
54 /**
55  * Returns the nth event in the list. This does not remove the event from the
56  * list; the only way to remove events is to empty the whole list with
57  * clear().
58  */
59 INLINE const ButtonEvent &ButtonEventList::
60 get_event(int n) const {
61 #ifndef NDEBUG
62  static ButtonEvent empty_event;
63  nassertr(n >= 0 && n < (int)_events.size(), empty_event);
64 #endif // NDEBUG
65  return _events[n];
66 }
67 
68 /**
69  * Empties all the events from the list.
70  */
71 INLINE void ButtonEventList::
72 clear() {
73  _events.clear();
74 }
void add_event(ButtonEvent event)
Adds a new event to the end of the list.
int get_num_events() const
Returns the number of events in the list.
Records a button event of some kind.
Definition: buttonEvent.h:46
Records a set of button events that happened recently.
void clear()
Empties all the events from the list.
const ButtonEvent & get_event(int n) const
Returns the nth event in the list.