po: Update German man pages translation
[dpkg.git] / dselect / dselect.h
blob2a25a2498a1cfcd97024434d33d304ffba92de99
1 /*
2 * dselect - Debian package maintenance user interface
3 * dselect.h - external definitions for this program
5 * Copyright © 1994,1995 Ian Jackson <ijackson@chiark.greenend.org.uk>
6 * Copyright © 2001 Wichert Akkerman <wakkerma@debian.org>
8 * This is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This 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 General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <https://www.gnu.org/licenses/>.
22 #ifndef DSELECT_H
23 #define DSELECT_H
25 #include <signal.h>
27 #include <algorithm>
29 using std::min;
30 using std::max;
32 #include <dpkg/debug.h>
34 #include "dselect-curses.h"
36 #define DSELECT "dselect"
38 #define TOTAL_LIST_WIDTH 180
39 #define MAX_DISPLAY_INFO 120
41 struct helpmenuentry {
42 char key;
43 const struct helpmessage *msg;
46 struct keybindings;
48 enum screenparts {
49 background,
50 list,
51 listsel,
52 title,
53 thisstate,
54 selstate,
55 selstatesel,
56 colheads,
57 query,
58 info_body,
59 info_head,
60 whatinfo,
61 helpscreen,
62 numscreenparts,
65 struct column {
66 column(): title(nullptr), x(0), width(0) {}
67 void blank() { title = nullptr; x = 0; width = 0; }
69 const char *title;
70 int x;
71 int width;
74 class baselist {
75 protected:
76 // Screen dimensions &c.
77 int xmax, ymax;
78 int title_height, colheads_height, list_height;
79 int thisstate_height, info_height, whatinfo_height;
80 int colheads_row, thisstate_row, info_row, whatinfo_row, list_row;
82 int part_attr[numscreenparts];
84 int gap_width;
85 int col_cur_x;
86 int total_width;
88 void add_column(column &col, const char *title, int width);
89 void end_column(column &col, const char *title);
90 void draw_column_head(const column &col);
91 void draw_column_sep(const column &col, int y);
92 void draw_column_item(const column &col, int y, const char *item);
94 // (n)curses stuff
95 WINDOW *listpad, *infopad, *colheadspad, *thisstatepad;
96 WINDOW *titlewin, *whatinfowin, *querywin;
97 // If listpad is null, then we have not started to display yet, and
98 // so none of the auto-displaying update routines need to display.
100 // Window resize handling (via SIGWINCH).
101 void resize_window();
103 int nitems, ldrawnstart, ldrawnend, showinfo;
104 int topofscreen, leftofscreen, cursorline;
105 int infotopofscreen, infolines;
106 varbuf whatinfovb;
107 char searchstring[128];
109 virtual void setheights();
110 void unsizes();
111 void dosearch();
112 void displayhelp(const struct helpmenuentry *menu, int key);
113 void displayerror(const char *str);
115 void redrawall();
116 void redrawitemsrange(int start /*inclusive*/, int end /*exclusive*/);
117 void redraw1item(int index);
118 void refreshlist();
119 void refreshinfo();
120 void refreshcolheads();
121 void setcursor(int index);
123 void itd_keys();
125 virtual void redraw1itemsel(int index, int selected) =0;
126 virtual void redrawcolheads() =0;
127 virtual void redrawthisstate() =0;
128 virtual void redrawinfo() =0;
129 virtual void redrawtitle() =0;
130 virtual void setwidths() =0;
131 virtual const char *itemname(int index) =0;
132 virtual const struct helpmenuentry *helpmenulist() =0;
134 virtual bool checksearch(char *str);
135 virtual bool matchsearch(int index);
136 void wordwrapinfo(int offset, const char *string);
138 public:
140 keybindings *bindings;
142 void kd_up();
143 void kd_down();
144 void kd_redraw();
145 void kd_scrollon();
146 void kd_scrollback();
147 void kd_scrollon1();
148 void kd_scrollback1();
149 void kd_panon();
150 void kd_panback();
151 void kd_panon1();
152 void kd_panback1();
153 void kd_top();
154 void kd_bottom();
155 void kd_iscrollon();
156 void kd_iscrollback();
157 void kd_iscrollon1();
158 void kd_iscrollback1();
159 void kd_search();
160 void kd_searchagain();
161 void kd_help();
163 void startdisplay();
164 void enddisplay();
166 explicit baselist(keybindings *);
167 virtual ~baselist();
170 void displayhelp(const struct helpmenuentry *menu, int key);
172 void mywerase(WINDOW *win);
174 void curseson();
175 void cursesoff();
177 extern bool expertmode;
179 struct colordata {
180 int fore;
181 int back;
182 int attr;
184 extern colordata color[];
186 /* Evil recommends flag variable. */
187 extern bool manual_install;
189 enum urqresult {
190 urqr_normal,
191 urqr_fail,
192 urqr_quitmenu,
194 enum quitaction {
195 qa_noquit,
196 qa_quitchecksave,
197 qa_quitnochecksave,
200 typedef urqresult urqfunction(void);
201 urqfunction urq_list, urq_quit, urq_menu;
202 urqfunction urq_setup, urq_update, urq_install, urq_config, urq_remove;
204 #endif /* DSELECT_H */