![]() |
Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members
![]() |
00001 /******************************************************************************** 00002 * * 00003 * A c c e l e r a t o r T a b l e C l a s s * 00004 * * 00005 ********************************************************************************* 00006 * Copyright (C) 1998,2002 by Jeroen van der Zijp. All Rights Reserved. * 00007 ********************************************************************************* 00008 * This library is free software; you can redistribute it and/or * 00009 * modify it under the terms of the GNU Lesser General Public * 00010 * License as published by the Free Software Foundation; either * 00011 * version 2.1 of the License, or (at your option) any later version. * 00012 * * 00013 * This library is distributed in the hope that it will be useful, * 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00016 * Lesser General Public License for more details. * 00017 * * 00018 * You should have received a copy of the GNU Lesser General Public * 00019 * License along with this library; if not, write to the Free Software * 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * 00021 ********************************************************************************* 00022 * $Id: FXAccelTable.h,v 1.11 2002/01/18 22:46:41 jeroen Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXACCELTABLE_H 00025 #define FXACCELTABLE_H 00026 00027 #ifndef FXOBJECT_H 00028 #include "FXObject.h" 00029 #endif 00030 00031 00032 00033 struct FXAccelKey; 00034 00035 00036 /** 00037 * The accelerator table sends a message to a specific 00038 * target object when the indicated key and modifier combination 00039 * is pressed. 00040 */ 00041 class FXAPI FXAccelTable : public FXObject { 00042 FXDECLARE(FXAccelTable) 00043 private: 00044 FXAccelKey *key; // Accelerator table 00045 FXuint nkey; // Accelerator table size 00046 FXuint num; // Number of entries 00047 private: 00048 void grow(); 00049 private: 00050 FXAccelTable(const FXAccelTable&); 00051 FXAccelTable &operator=(const FXAccelTable&); 00052 public: 00053 long onKeyPress(FXObject*,FXSelector,void*); 00054 long onKeyRelease(FXObject*,FXSelector,void*); 00055 public: 00056 00057 /// Construct empty accelerator table 00058 FXAccelTable(); 00059 00060 /// Add an accelerator to the table 00061 void addAccel(FXHotKey hotkey,FXObject* target=NULL,FXSelector seldn=0,FXSelector selup=0); 00062 00063 /// Return true if accelerator specified 00064 FXbool hasAccel(FXHotKey hotkey) const; 00065 00066 /// Return target object of the given accelerator 00067 FXObject* targetOfAccel(FXHotKey hotkey) const; 00068 00069 /// Remove mapping for specified hot key 00070 void removeAccel(FXHotKey hotkey); 00071 00072 /// Save table to a stream 00073 virtual void save(FXStream& store) const; 00074 00075 /// Load table from a stream 00076 virtual void load(FXStream& store); 00077 00078 /// Destructor 00079 virtual ~FXAccelTable(); 00080 }; 00081 00082 00083 #endif