17 #define PROMPT_AWAR_PREFIX "tmp/prompt/"
19 #define AWAR_PROMPT_TEXT PROMPT_AWAR_PREFIX "text"
20 #define AWAR_PROMPT_INPUT PROMPT_AWAR_PREFIX "input"
21 #define AWAR_PROMPT_BUTTON PROMPT_AWAR_PREFIX "button"
22 #define AWAR_PROMPT_ERROR PROMPT_AWAR_PREFIX "error"
29 PromptData(
const ResultHandler& handler_) : handler(handler_), helpfile(
NULp) {}
62 void AWT_activate_prompt(
const char *
title,
const char *prompt,
const char *defaultResult,
const char *button,
const ResultHandler& handle_result,
const char *helpfile,
const char *srt) {
79 static AW_window_simple *aws =
NULp;
92 aws =
new AW_window_simple;
93 aws->init(awr,
"PROMPT",
"Prompt");
96 const int IF_YSIZE = 32;
97 const int TX_YSIZE = 18;
98 const int BT_YSIZE = 22;
101 aws->auto_space(PAD/2, PAD/2);
103 aws->at_attach_to(
true,
false, -PAD, TX_YSIZE);
109 WindowCallback ok_cb = makeWindowCallback(
ok_pressed, &pdata);
111 aws->at_attach_to(
true,
false, -PAD, IF_YSIZE);
112 aws->d_callback(ok_cb);
116 aws->at_shift(300, 0);
120 aws->button_length(8);
122 aws->callback(ok_cb);
126 int xb1 = aws->get_at_xposition();
129 aws->create_button(
"CANCEL",
"Cancel");
131 int xb2 = aws->get_at_xposition();
132 int bwidth = xb2 - xb1 - PAD;
134 aws->at_attach(-bwidth-PAD, 0);
135 aws->at_attach_to(
true,
false, -PAD, BT_YSIZE);
137 aws->create_button(
"CLEAR",
"Clear");
139 aws->at_attach(2*(-bwidth-PAD), 0);
140 aws->at_attach_to(
true,
false, -bwidth-2*PAD, BT_YSIZE);
141 aws->callback(makeWindowCallback(
run_help_cb, &pdata));
142 aws->create_button(
"HELP",
"Help");
148 const int ERR_YSIZE = 2*TX_YSIZE;
149 aws->at_shift(0, ERR_YSIZE);
150 aws->at_shift(0, -ERR_YSIZE);
152 aws->at_attach_to(
true,
true, -PAD, -PAD);
163 aws->set_window_title(title);
AW_awar * set_srt(const char *srt)
#define AWAR_PROMPT_BUTTON
void AW_POPDOWN(AW_window *window)
PromptData(const ResultHandler &handler_)
#define AWAR_PROMPT_ERROR
static AW_root * SINGLETON
static GB_ERROR hidden_ok_pressed()
static void error(const char *msg)
void set_active(Widget w, bool active)
char * read_string() const
AW_awar * awar(const char *awar)
#define AWAR_PROMPT_INPUT
static void run_help_cb(AW_window *aww, const PromptData *pdata)
static void ok_pressed(AW_window *aww, PromptData *pdata)
void AW_help_popup(UNFIXED, const char *help_file)
GB_ERROR write_string(const char *aw_string)
static void clear_input_cb(AW_window *aww)
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
struct _WidgetRec * Widget
void AWT_activate_prompt(const char *title, const char *prompt, const char *defaultResult, const char *button, const ResultHandler &handle_result, const char *helpfile, const char *srt)