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

commandQt.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     6-17-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 //commandQt.h
00019 
00020 #ifndef __COMMAND_QT_DOT_H
00021 #define __COMMAND_QT_DOT_H
00022 
00023 #include <smartptr.h>
00024 
00025 ///////////////////////////////////////////////////////////////////////////
00026 /// Base command class, need to override the exec() function.
00027 ///////////////////////////////////////////////////////////////////////////
00028 template<class T>
00029 class commandQt {
00030 public:
00031    commandQt():_caller(0){}
00032    virtual ~commandQt(){}
00033 
00034    //////////////////////////////
00035    /// override this function to
00036    /// specify behavior
00037    virtual int exec() = 0;
00038 
00039    //////////////////////////////
00040    /// to be set by caller
00041    void setCaller(T *caller) {_caller = caller;}
00042 protected:
00043    T *_caller;
00044 };
00045 
00046 ///////////////////////////////////////////////////////////////////////////
00047 /// Key Event Command
00048 ///////////////////////////////////////////////////////////////////////////
00049 template<class T>
00050 class KeyCmdQt : public commandQt<T>, public gutz::Counted {
00051 public:
00052    KeyCmdQt():_key(0){}
00053    virtual ~KeyCmdQt(){}
00054 
00055    //////////////////////////////
00056    /// to be set by caller
00057    void setKeyEvent(QKeyEvent *e){_key = e;}
00058 protected:
00059    QKeyEvent *_key;
00060 };
00061 
00062 struct ltchar
00063 {
00064    bool operator()(char k1, char k2) const
00065    { 
00066       return (k1 < k2);
00067    }
00068 };
00069 
00070 #endif

Send questions, comments, and bug reports to:
jmk