2 * dselect - Debian package maintenance user interface
3 * bindings.h - keybindings class header file
5 * Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
25 struct interpretation;
38 const char *action, *desc;
44 const struct interpretation *interp;
49 static const keyname keynames[];
50 static const description descriptions[];
53 const description *iterate;
54 const interpretation *interps;
56 bool bind(int key, const char *action);
59 int name2key(const char *name);
60 const char *key2name(int key);
62 bool bind(const char *name, const char *action)
63 { return bind(name2key(name), action); }
64 const interpretation *operator()(int key);
65 const char *find(const char *action);
67 void describestart() { iterate=descriptions; }
68 const char **describenext();
69 //... returns array, null-term, first element is description, rest are key strings
70 // caller must delete[] the array. Null means end.
72 keybindings(const interpretation *ints, const orgbinding *orgbindings);
79 struct keybindings::interpretation {
81 void (methodlist::*mfn)();
82 void (packagelist::*pfn)();
86 extern const keybindings::interpretation packagelist_kinterps[];
87 extern const keybindings::orgbinding packagelist_korgbindings[];
89 extern const keybindings::interpretation methodlist_kinterps[];
90 extern const keybindings::orgbinding methodlist_korgbindings[];
93 #define CTRL(x) ((x) - 'a' + 1)
96 #endif /* BINDINGS_H */