arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

keyEvent.h

Go to the documentation of this file.
00001 ///////////////////////////////////////////////////////////////////////////
00002 //              _____________  ______________________    __   __  _____
00003 //             /  ________  |  |   ___   ________   /   |  \ /  \   |
00004 //            |  |       |  |_ |  |_ |  |       /  /    \__  |      |
00005 //            |  |  ___  |  || |  || |  |      /  /        | |      |
00006 //            |  | |   \ |  || |  || |  |     /  /      \__/ \__/ __|__
00007 //            |  | |_@  ||  || |  || |  |    /  /          Institute
00008 //            |  |___/  ||  ||_|  || |  |   /  /_____________________
00009 //             \_______/  \______/ | |__|  /___________________________
00010 //                        |  |__|  |
00011 //                         \______/
00012 //                    University of Utah       
00013 //                           2003
00014 ///////////////////////////////////////////////////////////////////////////
00015 
00016 //keyEvent.h
00017 
00018 #ifndef __GUTZ_KEY_EVENT_DOT_H
00019 #define __GUTZ_KEY_EVENT_DOT_H
00020 
00021 #include "renderEvent.h"
00022 #include "mouseEvent.h"
00023 
00024 namespace gutz {
00025 
00026 /// KeyEvent, a key was pressed.
00027 ///  This object is a MouseEvent since the mouse position at the time of the
00028 ///  click might be of importantce.  A MouseEvent is a CameraEvent since we 
00029 ///  need the camera for the the mouse position to make sence.
00030 class KeyEvent :  public MouseEvent {
00031 public:
00032    KeyEvent(unsigned int key, const gutz::vec3f &pos, bool down, unsigned int button,
00033             const CameraSP &cam, const ManipSP &manip)
00034             : MouseEvent(pos,down,button,cam,manip), _key(key) 
00035    {}
00036    KeyEvent(unsigned int key, const MouseEvent &me)
00037       : MouseEvent(me), _key(key)
00038    {}
00039    KeyEvent(const KeyEvent &ke)
00040       : MouseEvent(ke), _key(ke._key)
00041    {}
00042    virtual ~KeyEvent() {}
00043 
00044    ///@name get/set Key 
00045    ///@{
00046    
00047    char getAsci() const { return char( _key & (unsigned int)255 ); }
00048    void setAsci(char k) { _key = ( _key & (~(unsigned int)255) ) | k; }
00049 
00050    unsigned int getKey() const         { return _key; }
00051    void         setKey(unsigned int k) {_key = k;}
00052 
00053    ///@}
00054 
00055 
00056 protected:
00057    unsigned int _key;
00058 
00059 };
00060 
00061 } //< end namespace gutz
00062 
00063 #endif
00064 

Send questions, comments, and bug reports to:
jmk