• Main Page
  • Classes
  • Files
  • File List
  • File Members

keypad.h

Go to the documentation of this file.
00001 //
00002 // begin license header
00003 //  
00004 // This file is part of Terk and TerkOS.
00005 //
00006 // All Terk and TerkOS source code is provided under the terms of the 
00007 // GNU General Public License v2 (http://www.gnu.org/licenses/gpl-2.0.html).  
00008 // Those wishing to use Terk and TerkOS source code, software and/or
00009 // technologies under different licensing terms should contact us at 
00010 // [email protected]. Such licensing terms are available for
00011 // all portions of the Terk and TerkOS codebase presented here.
00012 //
00013 // end license header
00014 //
00015 
00016 #ifndef _KEYPAD_H
00017 #define _KEYPAD_H
00018 
00019 #include "singleton.h"
00020 #include "9302hw.h"
00021 
00022 #define KP_KEY_OK      0x0002
00023 #define KP_KEY_CANCEL  0x0004
00024 #define KP_KEY_RIGHT   0x0008
00025 #define KP_KEY_LEFT    0x0010
00026 #define KP_KEY_UP      0x0020
00027 #define KP_KEY_DOWN    0x0040
00028 
00045 class CKeypad
00046 {
00047 public:
00054   SINGLETON(CKeypad);
00055 
00056   static const unsigned int KEY_OK;
00057   static const unsigned int KEY_CANCEL;
00058   static const unsigned int KEY_RIGHT;
00059   static const unsigned int KEY_LEFT;
00060   static const unsigned int KEY_UP;
00061   static const unsigned int KEY_DOWN;
00062    
00072   const unsigned int GetKey(bool wait = true);
00073 
00074 
00079   void KeyRelease();
00080 
00084   inline bool KeyOk()
00085   {
00086     return GetKey(false) & KEY_OK;
00087   }
00088 
00092   inline bool KeyCancel()
00093   {
00094     return GetKey(false) & KEY_CANCEL;
00095   }
00096 
00100   inline bool KeyUp()
00101   {
00102     return GetKey(false) & KEY_UP;
00103   }
00104 
00108   inline bool KeyDown()
00109   {
00110     return GetKey(false) & KEY_DOWN;
00111   }
00112 
00116   inline bool KeyLeft()
00117   {
00118     return GetKey(false) & KEY_LEFT;
00119   }
00120 
00124   inline bool KeyRight()
00125   {
00126     return GetKey(false) & KEY_RIGHT;
00127   }
00128 
00129 private:
00130   CKeypad();
00131   ~CKeypad();
00132 
00133   C9302Hardware *m_p9302hw;
00134 };
00135 
00136 #endif

Generated on Mon Oct 3 2011 15:36:31 for libqwerk by  doxygen 1.7.1