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

/home/jeroen/FOX/fox/fox-1.7.33/include/FXAccelTable.h
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,2012 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (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                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 ********************************************************************************/
00021 #ifndef FXACCELTABLE_H
00022 #define FXACCELTABLE_H
00023 
00024 #ifndef FXOBJECT_H
00025 #include "FXObject.h"
00026 #endif
00027 
00028 namespace FX {
00029 
00030 
00036 class FXAPI FXAccelTable : public FXObject {
00037   FXDECLARE(FXAccelTable)
00038 protected:
00039   struct FXAccelKey {
00040     FXObject    *target;    // Target object of message
00041     FXSelector   messagedn; // Message being sent
00042     FXSelector   messageup; // Message being sent
00043     FXHotKey     code;      // Keysym and modifier mask to match
00044     };
00045 private:
00046   FXAccelKey *key;          // Accelerator table
00047   FXuint      max;          // Largest table index
00048   FXuint      num;          // Number of entries
00049 private:
00050   void resize(FXuint m);
00051 private:
00052   FXAccelTable(const FXAccelTable&);
00053   FXAccelTable &operator=(const FXAccelTable&);
00054 public:
00055   long onKeyPress(FXObject*,FXSelector,void*);
00056   long onKeyRelease(FXObject*,FXSelector,void*);
00057 public:
00058 
00060   FXAccelTable();
00061 
00063   void addAccel(FXHotKey hotkey,FXObject* target=NULL,FXSelector seldn=0,FXSelector selup=0);
00064 
00066   void removeAccel(FXHotKey hotkey);
00067 
00069   FXbool hasAccel(FXHotKey hotkey) const;
00070 
00072   FXObject* targetOfAccel(FXHotKey hotkey) const;
00073 
00075   virtual void save(FXStream& store) const;
00076 
00078   virtual void load(FXStream& store);
00079 
00081   virtual ~FXAccelTable();
00082   };
00083 
00084 
00090 extern FXAPI FXHotKey parseAccel(const FXString& string);
00091 
00096 extern FXAPI FXString unparseAccel(FXHotKey key);
00097 
00103 extern FXAPI FXHotKey parseHotKey(const FXString& string);
00104 
00111 extern FXAPI FXint findHotKey(const FXString& string);
00112 
00118 extern FXAPI FXString stripHotKey(const FXString& string);
00119 
00120 }
00121 
00122 #endif

Copyright © 1997-2011 Jeroen van der Zijp