Panda3D
 All Classes Functions Variables Enumerations
buttonEventList.I
1 // Filename: buttonEventList.I
2 // Created by: drose (12Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ButtonEventList::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE ButtonEventList::
22 ButtonEventList() {
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: ButtonEventList::Copy Constructor
27 // Access: Public
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 INLINE ButtonEventList::
31 ButtonEventList(const ButtonEventList &copy) :
32  _events(copy._events)
33 {
34 }
35 
36 ////////////////////////////////////////////////////////////////////
37 // Function: ButtonEventList::Copy Assignment Operator
38 // Access: Public
39 // Description:
40 ////////////////////////////////////////////////////////////////////
41 INLINE void ButtonEventList::
42 operator = (const ButtonEventList &copy) {
43  _events = copy._events;
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: ButtonEventList::add_event
48 // Access: Public
49 // Description: Adds a new event to the end of the list.
50 ////////////////////////////////////////////////////////////////////
51 INLINE void ButtonEventList::
53  _events.push_back(event);
54 }
55 
56 ////////////////////////////////////////////////////////////////////
57 // Function: ButtonEventList::get_num_events
58 // Access: Public
59 // Description: Returns the number of events in the list.
60 ////////////////////////////////////////////////////////////////////
61 INLINE int ButtonEventList::
62 get_num_events() const {
63  return _events.size();
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function: ButtonEventList::get_event
68 // Access: Public
69 // Description: Returns the nth event in the list. This does not
70 // remove the event from the list; the only way to
71 // remove events is to empty the whole list with
72 // clear().
73 ////////////////////////////////////////////////////////////////////
74 INLINE const ButtonEvent &ButtonEventList::
75 get_event(int n) const {
76 #ifndef NDEBUG
77  static ButtonEvent empty_event;
78  nassertr(n >= 0 && n < (int)_events.size(), empty_event);
79 #endif // NDEBUG
80  return _events[n];
81 }
82 
83 ////////////////////////////////////////////////////////////////////
84 // Function: ButtonEventList::clear
85 // Access: Public
86 // Description: Empties all the events from the list.
87 ////////////////////////////////////////////////////////////////////
88 INLINE void ButtonEventList::
89 clear() {
90  _events.clear();
91 }
void add_event(ButtonEvent event)
Adds a new event to the end of the list.
Records a button event of some kind.
Definition: buttonEvent.h:53
Records a set of button events that happened recently.
const ButtonEvent & get_event(int n) const
Returns the nth event in the list.
int get_num_events() const
Returns the number of events in the list.
void clear()
Empties all the events from the list.