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

FXAccelTable.h
1 /********************************************************************************
2 * *
3 * A c c e l e r a t o r T a b l e C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXACCELTABLE_H
22 #define FXACCELTABLE_H
23 
24 #ifndef FXOBJECT_H
25 #include "FXObject.h"
26 #endif
27 
28 namespace FX {
29 
30 
36 class FXAPI FXAccelTable : public FXObject {
37  FXDECLARE(FXAccelTable)
38 protected:
39  struct FXAccelKey {
40  FXObject *target; // Target object of message
41  FXSelector messagedn; // Message being sent
42  FXSelector messageup; // Message being sent
43  FXHotKey code; // Keysym and modifier mask to match
44  };
45 private:
46  FXAccelKey *key; // Accelerator table
47  FXuint max; // Largest table index
48  FXuint num; // Number of entries
49 private:
50  void resize(FXuint m);
51 private:
52  FXAccelTable(const FXAccelTable&);
53  FXAccelTable &operator=(const FXAccelTable&);
54 public:
55  long onKeyPress(FXObject*,FXSelector,void*);
56  long onKeyRelease(FXObject*,FXSelector,void*);
57 public:
58 
60  FXAccelTable();
61 
63  void addAccel(FXHotKey hotkey,FXObject* target=NULL,FXSelector seldn=0,FXSelector selup=0);
64 
66  void removeAccel(FXHotKey hotkey);
67 
69  FXbool hasAccel(FXHotKey hotkey) const;
70 
72  FXObject* targetOfAccel(FXHotKey hotkey) const;
73 
75  virtual void save(FXStream& store) const;
76 
78  virtual void load(FXStream& store);
79 
81  virtual ~FXAccelTable();
82  };
83 
84 
110 extern FXAPI FXHotKey parseAccel(const FXString& string);
111 
118 extern FXAPI FXString unparseAccel(FXHotKey key);
119 
126 extern FXAPI FXHotKey parseHotKey(const FXString& string);
127 
134 extern FXAPI FXint findHotKey(const FXString& string);
135 
141 extern FXAPI FXString stripHotKey(const FXString& string);
142 
143 }
144 
145 #endif

Copyright © 1997-2016 Jeroen van der Zijp