00001 // Filename: buttonEventList.I 00002 // Created by: drose (12Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 00020 //////////////////////////////////////////////////////////////////// 00021 // Function: ButtonEventList::Constructor 00022 // Access: Public 00023 // Description: 00024 //////////////////////////////////////////////////////////////////// 00025 INLINE ButtonEventList:: 00026 ButtonEventList() { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: ButtonEventList::add_event 00031 // Access: Public 00032 // Description: Adds a new event to the end of the list. 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE void ButtonEventList:: 00035 add_event(ButtonEvent event) { 00036 _events.push_back(event); 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function: ButtonEventList::get_num_events 00041 // Access: Public 00042 // Description: Returns the number of events in the list. 00043 //////////////////////////////////////////////////////////////////// 00044 INLINE int ButtonEventList:: 00045 get_num_events() const { 00046 return _events.size(); 00047 } 00048 00049 //////////////////////////////////////////////////////////////////// 00050 // Function: ButtonEventList::get_event 00051 // Access: Public 00052 // Description: Returns the nth event in the list. This does not 00053 // remove the event from the list; the only way to 00054 // remove events is to empty the whole list with 00055 // clear(). 00056 //////////////////////////////////////////////////////////////////// 00057 INLINE const ButtonEvent &ButtonEventList:: 00058 get_event(int n) const { 00059 #ifndef NDEBUG 00060 static ButtonEvent empty_event; 00061 nassertr(n >= 0 && n < (int)_events.size(), empty_event); 00062 #endif // NDEBUG 00063 return _events[n]; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: ButtonEventList::clear 00068 // Access: Public 00069 // Description: Empties all the events from the list. 00070 //////////////////////////////////////////////////////////////////// 00071 INLINE void ButtonEventList:: 00072 clear() { 00073 _events.clear(); 00074 }