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

HardKeyManager.h

Go to the documentation of this file.
00001 /*********************************************************************************
00002  *
00003  * Razor! Engine - A modular C++ presentation engine
00004  *
00005  * $Id$
00006  *
00007  * Copyright (c) 2000 Tilo Christ. All Rights Reserved.
00008  *
00009  * This library is free software; you can redistribute it and/or
00010  * modify it under the terms of the GNU Lesser General Public
00011  * License as published by the Free Software Foundation; either
00012  * version 2.1 of the License, or (at your option) any later version.
00013  *
00014  * This library is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017  * Lesser General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU Lesser General Public
00020  * License along with this library; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00022  *
00023  **********************************************************************************/
00024 
00025 
00026 #ifndef HARDKEYMANAGER_H
00027 #define HARDKEYMANAGER_H
00028 
00029 #include <PalmOS.h>
00030 
00031 
00032 /**
00033  * HardKeyManager manages the hard keys (Up/Down, Calendar, Address Book, etc.) of the device.
00034  * It can prevent them from switching apps, it can modify their repeat rate, and it can poll their state.
00035  */
00036 class HardKeyManager
00037 {
00038     public: 
00039 
00040     
00041     /**
00042      * Prepare the hard keys for polling (i.e. turn off event generation). Idempotent.
00043      */
00044     static void captureHardKeys();
00045     
00046 
00047     /**
00048      * Return the hard keys to event generation mode. Idempotent.
00049      */
00050     static void releaseHardKeys();
00051         
00052 
00053     /**
00054      * Get the current state of the hard keys.
00055      * The result will be identical to that from
00056      * the KeyCurrentState() PalmOS call.
00057      *
00058      * @return the currently pressed keys. Use the keyXXX constants from KeyMgr.h to decipher it.
00059      */
00060     static UInt32 getCurrentState();
00061     
00062 
00063     /**
00064      * Express your interest in the keys specified by the mask.
00065      *
00066      * @param the keys you want to listen to. Use the keyXXX constants from KeyMgr.h.
00067      */
00068     static void setMask(UInt32 mask);
00069 
00070 
00071     private:
00072 
00073     // HardKeyManager cannot be instantiated or destroyed.
00074     HardKeyManager() {}
00075     ~HardKeyManager() {}
00076 
00077 
00078     /**
00079      * Prepare the HardKeyManager for use.
00080      */
00081     static void init();
00082     
00083     
00084     /**
00085      * Release the hard keys and all other resources.
00086      */
00087     static void destroy();
00088 
00089 
00090     // Constants
00091     static const UInt32 keysAllowedMask = (keyBitHard1 | keyBitHard2 | keyBitHard3 | keyBitHard4 | keyBitPageUp | keyBitPageDown );
00092     
00093     // Current key settings
00094     static UInt32 mask;
00095 
00096     // Original key settings
00097     static UInt16 oldInitDelay;
00098     static UInt16 oldPeriod;
00099     static UInt16 oldDoubleTapDelay;
00100     static Boolean oldQueueAhead;
00101 
00102     friend class Presentation;
00103 };
00104 
00105 
00106 #endif

Razor! Engine Developer's Guide. Copyright © by Tilo Christ. All Rights Reserved. Last updated: 4 Nov 2000