1998-02-27 07:54:42 +03:00
|
|
|
#ifndef __WTOOLS_H
|
|
|
|
#define __WTOOLS_H
|
|
|
|
|
2002-11-14 10:25:18 +03:00
|
|
|
struct Dlg_head;
|
2002-11-11 09:23:59 +03:00
|
|
|
struct WListbox;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Listbox utility functions */
|
|
|
|
typedef struct {
|
2002-11-14 10:25:18 +03:00
|
|
|
struct Dlg_head *dlg;
|
2002-11-11 09:23:59 +03:00
|
|
|
struct WListbox *list;
|
1998-02-27 07:54:42 +03:00
|
|
|
} Listbox;
|
|
|
|
|
|
|
|
Listbox *create_listbox_window (int cols, int lines, char *title, char *help);
|
|
|
|
#define LISTBOX_APPEND_TEXT(l,h,t,d) \
|
|
|
|
listbox_add_item (l->list, 0, h, t, d);
|
|
|
|
|
|
|
|
int run_listbox (Listbox *l);
|
|
|
|
|
|
|
|
/* Quick Widgets */
|
|
|
|
enum {
|
|
|
|
quick_end, quick_checkbox,
|
|
|
|
quick_button, quick_input,
|
|
|
|
quick_label, quick_radio
|
|
|
|
} /* quick_t */;
|
|
|
|
|
|
|
|
/* The widget is placed on relative_?/divisions_? of the parent widget */
|
|
|
|
/* Please note that the contents of the fields in the union are just */
|
|
|
|
/* used for setting up the dialog. They are a convenient place to put */
|
|
|
|
/* the values for a widget */
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int widget_type;
|
|
|
|
int relative_x;
|
|
|
|
int x_divisions;
|
|
|
|
int relative_y;
|
|
|
|
int y_divisions;
|
|
|
|
|
|
|
|
char *text; /* Text */
|
|
|
|
int hotkey_pos; /* the hotkey position */
|
|
|
|
int value; /* Buttons only: value of button */
|
|
|
|
int *result; /* Checkbutton: where to store result */
|
|
|
|
char **str_result; /* Input lines: destination */
|
2003-09-01 04:18:37 +04:00
|
|
|
char *histname; /* Name of the section for saving history */
|
1998-02-27 07:54:42 +03:00
|
|
|
} QuickWidget;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
int xlen, ylen;
|
|
|
|
int xpos, ypos; /* if -1, then center the dialog */
|
|
|
|
char *title;
|
|
|
|
char *help;
|
|
|
|
QuickWidget *widgets;
|
1998-03-25 08:16:00 +03:00
|
|
|
int i18n; /* If true, internationalization has happened */
|
1998-02-27 07:54:42 +03:00
|
|
|
} QuickDialog;
|
|
|
|
|
|
|
|
int quick_dialog (QuickDialog *qd);
|
|
|
|
int quick_dialog_skip (QuickDialog *qd, int nskip);
|
|
|
|
|
|
|
|
/* The input dialogs */
|
2002-09-03 21:36:27 +04:00
|
|
|
|
|
|
|
/* Pass this as def_text to request a password */
|
|
|
|
#define INPUT_PASSWORD ((char *) -1)
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
char *input_dialog (char *header, char *text, char *def_text);
|
|
|
|
char *input_dialog_help (char *header, char *text, char *help, char *def_text);
|
|
|
|
char *input_expand_dialog (char *header, char *text, char *def_text);
|
|
|
|
|
|
|
|
void query_set_sel (int new_sel);
|
2002-11-14 10:25:18 +03:00
|
|
|
|
2003-10-26 03:58:14 +03:00
|
|
|
/* Create message box but don't dismiss it yet, not background safe */
|
2003-10-26 01:12:05 +04:00
|
|
|
struct Dlg_head *create_message (int flags, const char *title,
|
|
|
|
const char *text, ...)
|
|
|
|
__attribute__ ((format (printf, 3, 4)));
|
2003-10-26 03:58:14 +03:00
|
|
|
|
|
|
|
/* Show message box, background safe */
|
2003-10-26 07:47:20 +03:00
|
|
|
void message (int flags, const char *title, const char *text, ...)
|
2003-10-26 03:58:14 +03:00
|
|
|
__attribute__ ((format (printf, 3, 4)));
|
|
|
|
|
|
|
|
|
2002-11-14 10:25:18 +03:00
|
|
|
/* Use this as header for message() - it expands to "Error" */
|
|
|
|
#define MSG_ERROR ((char *) -1)
|
|
|
|
|
2003-10-26 01:12:05 +04:00
|
|
|
int query_dialog (const char *header, const char *text, int flags, int count, ...);
|
2002-11-14 10:25:18 +03:00
|
|
|
|
|
|
|
/* flags for message() and query_dialog() */
|
|
|
|
enum {
|
|
|
|
D_NORMAL = 0,
|
|
|
|
D_ERROR = 1,
|
|
|
|
} /* dialog options */;
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif /* __WTOOLS_H */
|