Panda3D
|
00001 // Filename: buttonEventList.I 00002 // Created by: drose (12Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ButtonEventList::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE ButtonEventList:: 00022 ButtonEventList() { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: ButtonEventList::Copy Constructor 00027 // Access: Public 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE ButtonEventList:: 00031 ButtonEventList(const ButtonEventList ©) : 00032 _events(copy._events) 00033 { 00034 } 00035 00036 //////////////////////////////////////////////////////////////////// 00037 // Function: ButtonEventList::Copy Assignment Operator 00038 // Access: Public 00039 // Description: 00040 //////////////////////////////////////////////////////////////////// 00041 INLINE void ButtonEventList:: 00042 operator = (const ButtonEventList ©) { 00043 _events = copy._events; 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function: ButtonEventList::add_event 00048 // Access: Public 00049 // Description: Adds a new event to the end of the list. 00050 //////////////////////////////////////////////////////////////////// 00051 INLINE void ButtonEventList:: 00052 add_event(ButtonEvent event) { 00053 _events.push_back(event); 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: ButtonEventList::get_num_events 00058 // Access: Public 00059 // Description: Returns the number of events in the list. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE int ButtonEventList:: 00062 get_num_events() const { 00063 return _events.size(); 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ButtonEventList::get_event 00068 // Access: Public 00069 // Description: Returns the nth event in the list. This does not 00070 // remove the event from the list; the only way to 00071 // remove events is to empty the whole list with 00072 // clear(). 00073 //////////////////////////////////////////////////////////////////// 00074 INLINE const ButtonEvent &ButtonEventList:: 00075 get_event(int n) const { 00076 #ifndef NDEBUG 00077 static ButtonEvent empty_event; 00078 nassertr(n >= 0 && n < (int)_events.size(), empty_event); 00079 #endif // NDEBUG 00080 return _events[n]; 00081 } 00082 00083 //////////////////////////////////////////////////////////////////// 00084 // Function: ButtonEventList::clear 00085 // Access: Public 00086 // Description: Empties all the events from the list. 00087 //////////////////////////////////////////////////////////////////// 00088 INLINE void ButtonEventList:: 00089 clear() { 00090 _events.clear(); 00091 }