Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/putil/buttonEventList.h

Go to the documentation of this file.
00001 // Filename: buttonEventList.h
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 #ifndef BUTTONEVENTLIST_H
00020 #define BUTTONEVENTLIST_H
00021 
00022 #include "pandabase.h"
00023 
00024 #include "buttonEvent.h"
00025 #include "typedReferenceCount.h"
00026 #include "eventParameter.h"
00027 #include "pvector.h"
00028 
00029 class ModifierButtons;
00030 
00031 ////////////////////////////////////////////////////////////////////
00032 //       Class : ButtonEventList
00033 // Description : Records a set of button events that happened
00034 //               recently.  This class is usually used only in the
00035 //               data graph, to transmit the recent button presses,
00036 //               but it may be used anywhere a list of ButtonEvents
00037 //               is desired.
00038 ////////////////////////////////////////////////////////////////////
00039 class EXPCL_PANDA ButtonEventList : public EventStoreValueBase {
00040 public:
00041   INLINE ButtonEventList();
00042 
00043   INLINE void add_event(ButtonEvent event);
00044   INLINE int get_num_events() const;
00045   INLINE const ButtonEvent &get_event(int n) const;
00046   INLINE void clear();
00047 
00048   void update_mods(ModifierButtons &mods) const;
00049 
00050   virtual void output(ostream &out) const;
00051   void write(ostream &out, int indent_level = 0) const;
00052 
00053 private:
00054   typedef pvector<ButtonEvent> Events;
00055   Events _events;
00056   
00057 public:
00058   static TypeHandle get_class_type() {
00059     return _type_handle;
00060   }
00061   static void init_type() {
00062     EventStoreValueBase::init_type();
00063     register_type(_type_handle, "ButtonEventList",
00064                   EventStoreValueBase::get_class_type());
00065   }
00066   virtual TypeHandle get_type() const {
00067     return get_class_type();
00068   }
00069   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00070 
00071 private:
00072   static TypeHandle _type_handle;
00073 };
00074 
00075 INLINE ostream &operator << (ostream &out, const ButtonEventList &list) {
00076   list.output(out);
00077   return out;
00078 }
00079 
00080 #include "buttonEventList.I"
00081 
00082 #endif
00083 

Generated on Fri May 2 00:43:33 2003 for Panda by doxygen1.3