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,2005 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.21 2005/01/16 16:06:06 fox Exp $ * 00023 ********************************************************************************/ 00024 #ifndef FXACCELTABLE_H 00025 #define FXACCELTABLE_H 00026 00027 #ifndef FXOBJECT_H 00028 #include "FXObject.h" 00029 #endif 00030 00031 namespace FX { 00032 00033 00034 /** 00035 * The accelerator table sends a message to a specific 00036 * target object when the indicated key and modifier combination 00037 * is pressed. 00038 */ 00039 class FXAPI FXAccelTable : public FXObject { 00040 FXDECLARE(FXAccelTable) 00041 protected: 00042 struct FXAccelKey { 00043 FXObject *target; // Target object of message 00044 FXSelector messagedn; // Message being sent 00045 FXSelector messageup; // Message being sent 00046 FXHotKey code; // Keysym and modifier mask to match 00047 }; 00048 private: 00049 FXAccelKey *key; // Accelerator table 00050 FXuint max; // Largest table index 00051 FXuint num; // Number of entries 00052 private: 00053 void resize(FXuint m); 00054 private: 00055 FXAccelTable(const FXAccelTable&); 00056 FXAccelTable &operator=(const FXAccelTable&); 00057 public: 00058 long onKeyPress(FXObject*,FXSelector,void*); 00059 long onKeyRelease(FXObject*,FXSelector,void*); 00060 public: 00061 00062 /// Construct empty accelerator table 00063 FXAccelTable(); 00064 00065 /// Add an accelerator into the table 00066 void addAccel(FXHotKey hotkey,FXObject* target=NULL,FXSelector seldn=0,FXSelector selup=0); 00067 00068 /// Remove an accelerator from the table 00069 void removeAccel(FXHotKey hotkey); 00070 00071 /// Return true if accelerator specified 00072 FXbool hasAccel(FXHotKey hotkey) const; 00073 00074 /// Return target object of the given accelerator 00075 FXObject* targetOfAccel(FXHotKey hotkey) const; 00076 00077 /// Save table to a stream 00078 virtual void save(FXStream& store) const; 00079 00080 /// Load table from a stream 00081 virtual void load(FXStream& store); 00082 00083 /// Destructor 00084 virtual ~FXAccelTable(); 00085 }; 00086 00087 00088 } 00089 00090 #endif
Copyright © 1997-2005 Jeroen van der Zijp |