Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

ButtonGroup.h

Go to the documentation of this file.
00001 
00003 //
00004 //  Copyright (c) 2002, Perry L. Miller IV
00005 //  All rights reserved.
00006 //  BSD License: http://www.opensource.org/licenses/bsd-license.html
00007 //
00009 
00011 //
00012 //  Wrapper class for a multiple button device.
00013 //
00015 
00016 #ifndef _VRJGA_BUTTON_DEVICES_GROUP_H_
00017 #define _VRJGA_BUTTON_DEVICES_GROUP_H_
00018 
00019 #include "vrjGA/ButtonDevice.h"
00020 
00021 #include <vector>
00022 
00023 
00024 namespace vrjGA {
00025 
00026 
00027 class VRJ_GA_EXPORT ButtonGroup : public Referenced
00028 {
00029 public:
00030 
00031   // Useful typedefs.
00032   typedef Referenced BaseClass;
00033 
00035   VRJGA_DECLARE_POINTER ( ButtonGroup );
00036 
00037   // Constructor.
00038   ButtonGroup();
00039 
00040   // Add a button device.
00041   void            add ( ButtonDevice * );
00042 
00043   // Return bitmask of buttons that are down.
00044   unsigned long   down() const { return _down; }
00045 
00046   // Return bitmask of buttons just pressed.
00047   unsigned long   pressed() const { return _pressed; }
00048 
00049   // Return bitmask of buttons just released.
00050   unsigned long   released() const { return _released; }
00051 
00052   // Update the internal state.
00053   void            update();
00054 
00055 protected:
00056 
00057   virtual ~ButtonGroup();
00058 
00059 private:
00060 
00061   // Not copyable.
00062   ButtonGroup ( const ButtonGroup & );
00063   ButtonGroup& operator = ( const ButtonGroup & );
00064 
00065   typedef std::vector<ButtonDevice::Ptr> Buttons;
00066   Buttons _buttons;
00067   unsigned long _down;
00068   unsigned long _pressed;
00069   unsigned long _released;
00070 };
00071 
00072 
00073 }; // namespace vrjGA
00074 
00075 
00076 #endif // _VRJGA_BUTTON_DEVICES_GROUP_H_

Generated on Thu Aug 12 16:42:14 2004 for vrjGA by doxygen 1.3.5