buttonEventList.I 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. // Function: ButtonEventList::Constructor
  16. // Access: Public
  17. // Description:
  18. ////////////////////////////////////////////////////////////////////
  19. INLINE ButtonEventList::
  20. ButtonEventList() {
  21. }
  22. ////////////////////////////////////////////////////////////////////
  23. // Function: ButtonEventList::Copy Constructor
  24. // Access: Public
  25. // Description:
  26. ////////////////////////////////////////////////////////////////////
  27. INLINE ButtonEventList::
  28. ButtonEventList(const ButtonEventList &copy) :
  29. _events(copy._events)
  30. {
  31. }
  32. ////////////////////////////////////////////////////////////////////
  33. // Function: ButtonEventList::Copy Assignment Operator
  34. // Access: Public
  35. // Description:
  36. ////////////////////////////////////////////////////////////////////
  37. INLINE void ButtonEventList::
  38. operator = (const ButtonEventList &copy) {
  39. _events = copy._events;
  40. }
  41. ////////////////////////////////////////////////////////////////////
  42. // Function: ButtonEventList::add_event
  43. // Access: Public
  44. // Description: Adds a new event to the end of the list.
  45. ////////////////////////////////////////////////////////////////////
  46. INLINE void ButtonEventList::
  47. add_event(ButtonEvent event) {
  48. _events.push_back(event);
  49. }
  50. ////////////////////////////////////////////////////////////////////
  51. // Function: ButtonEventList::get_num_events
  52. // Access: Public
  53. // Description: Returns the number of events in the list.
  54. ////////////////////////////////////////////////////////////////////
  55. INLINE int ButtonEventList::
  56. get_num_events() const {
  57. return _events.size();
  58. }
  59. ////////////////////////////////////////////////////////////////////
  60. // Function: ButtonEventList::get_event
  61. // Access: Public
  62. // Description: Returns the nth event in the list. This does not
  63. // remove the event from the list; the only way to
  64. // remove events is to empty the whole list with
  65. // clear().
  66. ////////////////////////////////////////////////////////////////////
  67. INLINE const ButtonEvent &ButtonEventList::
  68. get_event(int n) const {
  69. #ifndef NDEBUG
  70. static ButtonEvent empty_event;
  71. nassertr(n >= 0 && n < (int)_events.size(), empty_event);
  72. #endif // NDEBUG
  73. return _events[n];
  74. }
  75. ////////////////////////////////////////////////////////////////////
  76. // Function: ButtonEventList::clear
  77. // Access: Public
  78. // Description: Empties all the events from the list.
  79. ////////////////////////////////////////////////////////////////////
  80. INLINE void ButtonEventList::
  81. clear() {
  82. _events.clear();
  83. }