Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 101 lines (86 sloc) 3.271 kb
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 @lylejohnson Replaced e-mail address "lyle@users.sourceforge.net" with
lylejohnson authored
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
21 ***********************************************************************/
22
23 /**
24 * The accelerator table sends a message to a specific
25 * target object when the indicated key and modifier combination
26 * is pressed.
27 */
28
29 class FXAccelTable : public FXObject {
30 protected:
31 struct FXAccelKey {
32 FXObject *target; // Target object of message
33 FXSelector messagedn; // Message being sent
34 FXSelector messageup; // Message being sent
35 FXHotKey code; // Keysym and modifier mask to match
36 };
37 public:
38 long onKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
39 long onKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
40 public:
41 %extend {
42 /// Construct empty accelerator table
43 FXAccelTable(){
44 return new FXRbAccelTable();
45 }
46 }
47
48 /// Add an accelerator into the table
49 void addAccel(FXHotKey hotkey,FXObject* target=NULL,FXSelector seldn=0,FXSelector selup=0);
50
51 /// Remove an accelerator from the table
52 void removeAccel(FXHotKey hotkey);
53
54 /// Return true if accelerator specified
55 bool hasAccel(FXHotKey hotkey) const;
56
57 /// Return target object of the given accelerator
58 FXObject* targetOfAccel(FXHotKey hotkey) const;
59
60 /// Destructor
61 virtual ~FXAccelTable();
62 };
63
64 DECLARE_FXOBJECT_VIRTUALS(FXAccelTable)
65
66 /**
67 * Parse accelerator from string, yielding modifier and
68 * key code. For example, parseAccel("Ctl+Shift+X")
69 * yields MKUINT(KEY_X,CONTROLMASK|SHIFTMASK).
70 */
71 FXHotKey parseAccel(const FXString& string);
72
73 /**
74 * Unparse hot key comprising modifier and key code back
75 * into a string suitable for parsing with fxparseHotKey.
76 */
77 FXString unparseAccel(FXHotKey key);
78
79 /**
80 * Parse hot key from string, yielding modifier and
81 * key code. For example, parseHotKey(""Salt && &Pepper!"")
82 * yields MKUINT(KEY_p,ALTMASK).
83 */
84 FXHotKey parseHotKey(const FXString& string);
85
86 /**
87 * Obtain hot key offset in string, or -1 if not found.
88 * For example, findHotKey("Salt && &Pepper!") yields 7.
89 * Note that this is the byte-offset, not the character
90 * index!
91 */
92 FXint findHotKey(const FXString& string);
93
94 /**
95 * Strip hot key combination from the string.
96 * For example, stripHotKey("Salt && &Pepper") should
97 * yield "Salt & Pepper".
98 */
99 FXString stripHotKey(const FXString& string);
100
Something went wrong with that request. Please try again.