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/>.
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 {
43 const struct helpmessage *msg;
66 column(): title(nullptr), x(0), width(0) {};
67 void blank() { title = nullptr; x = 0; width = 0; };
76 // Screen dimensions &c.
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];
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(column &col);
91 void draw_column_sep(column &col, int y);
92 void draw_column_item(column &col, int y, const char *item);
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.
101 void sigwinch_mask(int how);
102 void setupsigwinch();
104 static baselist *signallist;
105 static void sigwinchhandler(int);
107 int nitems, ldrawnstart, ldrawnend, showinfo;
108 int topofscreen, leftofscreen, cursorline;
109 int infotopofscreen, infolines;
111 char searchstring[128];
113 virtual void setheights();
116 void displayhelp(const struct helpmenuentry *menu, int key);
117 void displayerror(const char *str);
120 void redrawitemsrange(int start /*inclusive*/, int end /*exclusive*/);
121 void redraw1item(int index);
124 void refreshcolheads();
125 void setcursor(int index);
129 virtual void redraw1itemsel(int index, int selected) =0;
130 virtual void redrawcolheads() =0;
131 virtual void redrawthisstate() =0;
132 virtual void redrawinfo() =0;
133 virtual void redrawtitle() =0;
134 virtual void setwidths() =0;
135 virtual const char *itemname(int index) =0;
136 virtual const struct helpmenuentry *helpmenulist() =0;
138 virtual bool checksearch(char *str);
139 virtual bool matchsearch(int index);
140 void wordwrapinfo(int offset, const char *string);
144 keybindings *bindings;
150 void kd_scrollback();
152 void kd_scrollback1();
160 void kd_iscrollback();
161 void kd_iscrollon1();
162 void kd_iscrollback1();
164 void kd_searchagain();
170 baselist(keybindings *);
174 void displayhelp(const struct helpmenuentry *menu, int key);
176 void mywerase(WINDOW *win);
181 extern bool expertmode;
188 extern colordata color[];
190 /* Evil recommends flag variable. */
191 extern bool manual_install;
193 enum urqresult { urqr_normal, urqr_fail, urqr_quitmenu };
194 enum quitaction { qa_noquit, qa_quitchecksave, qa_quitnochecksave };
196 typedef urqresult urqfunction(void);
197 urqfunction urq_list, urq_quit, urq_menu;
198 urqfunction urq_setup, urq_update, urq_install, urq_config, urq_remove;
200 #endif /* DSELECT_H */