test: Generate the pkg-old.deb from controlled parts
[dpkg.git] / dselect / bindings.h
blob47ef838453bd0cf74806d9d51f66ec90d631bc8b
1 /*
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/>.
21 #ifndef BINDINGS_H
22 #define BINDINGS_H
24 struct keybindings {
25 struct interpretation;
27 struct orgbinding {
28 int key;
29 const char *action;
32 struct keyname {
33 int key;
34 const char *kname;
37 struct description {
38 const char *action, *desc;
41 struct binding {
42 binding *next;
43 int key;
44 const struct interpretation *interp;
45 const char *desc;
48 private:
49 static const keyname keynames[];
50 static const description descriptions[];
52 binding *bindings;
53 const description *iterate;
54 const interpretation *interps;
56 bool bind(int key, const char *action);
58 public:
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);
73 ~keybindings();
76 #include "pkglist.h"
77 #include "method.h"
79 struct keybindings::interpretation {
80 const char *action;
81 void (methodlist::*mfn)();
82 void (packagelist::*pfn)();
83 quitaction qa;
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[];
92 #ifndef CTRL
93 #define CTRL(x) ((x) - 'a' + 1)
94 #endif
96 #endif /* BINDINGS_H */