* dlg.h: Remove Dlg_head argument from callback_fn - it's
excessive and can be trivially derived from the widget. (default_proc): Remove Dlg_head argument. Change all callers. * widget.c (listbox_draw): Remove Dlg_head argument.
Этот коммит содержится в:
родитель
47ab84d950
Коммит
31f491b01e
@ -1,5 +1,10 @@
|
|||||||
2002-11-12 Pavel Roskin <proski@gnu.org>
|
2002-11-12 Pavel Roskin <proski@gnu.org>
|
||||||
|
|
||||||
|
* dlg.h: Remove Dlg_head argument from callback_fn - it's
|
||||||
|
excessive and can be trivially derived from the widget.
|
||||||
|
(default_proc): Remove Dlg_head argument. Change all callers.
|
||||||
|
* widget.c (listbox_draw): Remove Dlg_head argument.
|
||||||
|
|
||||||
* dlg.h: Define dlg_cb_fn - dialog callback function. Improve
|
* dlg.h: Define dlg_cb_fn - dialog callback function. Improve
|
||||||
typedefs for callbacks and use them everywhere. Clean up some
|
typedefs for callbacks and use them everywhere. Clean up some
|
||||||
unused defines.
|
unused defines.
|
||||||
|
@ -242,7 +242,7 @@ enter (WInput * cmdline)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
command_callback (Dlg_head * h, WInput * cmd, int msg, int par)
|
command_callback (WInput *cmd, int msg, int par)
|
||||||
{
|
{
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WIDGET_FOCUS:
|
case WIDGET_FOCUS:
|
||||||
@ -255,7 +255,7 @@ command_callback (Dlg_head * h, WInput * cmd, int msg, int par)
|
|||||||
return enter (cmd);
|
return enter (cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return input_callback (h, cmd, msg, par);
|
return input_callback (cmd, msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
WInput *
|
WInput *
|
||||||
|
12
src/dlg.c
12
src/dlg.c
@ -141,7 +141,7 @@ init_widget (Widget *w, int y, int x, int lines, int cols,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Default callback for widgets */
|
/* Default callback for widgets */
|
||||||
int default_proc (Dlg_head *h, int Msg, int Par)
|
int default_proc (int Msg, int Par)
|
||||||
{
|
{
|
||||||
switch (Msg){
|
switch (Msg){
|
||||||
|
|
||||||
@ -314,7 +314,7 @@ int add_widget (Dlg_head *where, void *what)
|
|||||||
|
|
||||||
int send_message (Dlg_head *h, Widget *w, int msg, int par)
|
int send_message (Dlg_head *h, Widget *w, int msg, int par)
|
||||||
{
|
{
|
||||||
return (*(w->callback))(h, w, msg, par);
|
return (*(w->callback))(w, msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* broadcast a message to all the widgets in a dialog that have
|
/* broadcast a message to all the widgets in a dialog that have
|
||||||
@ -514,7 +514,7 @@ void update_cursor (Dlg_head *h)
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (p->widget->options & W_WANT_CURSOR)
|
if (p->widget->options & W_WANT_CURSOR)
|
||||||
if ((*p->widget->callback)(h, p->widget, WIDGET_CURSOR, 0)){
|
if ((*p->widget->callback)(p->widget, WIDGET_CURSOR, 0)){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
p = p->next;
|
p = p->next;
|
||||||
@ -626,7 +626,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
|
|||||||
|
|
||||||
handled = 0;
|
handled = 0;
|
||||||
if (h->current->widget->options & W_WANT_HOTKEY)
|
if (h->current->widget->options & W_WANT_HOTKEY)
|
||||||
handled = callback (h) (h, h->current->widget, WIDGET_HOTKEY, d_key);
|
handled = callback (h) (h->current->widget, WIDGET_HOTKEY, d_key);
|
||||||
|
|
||||||
/* If not used, send hotkey to other widgets */
|
/* If not used, send hotkey to other widgets */
|
||||||
if (handled)
|
if (handled)
|
||||||
@ -638,7 +638,7 @@ static int dlg_try_hotkey (Dlg_head *h, int d_key)
|
|||||||
do {
|
do {
|
||||||
if (hot_cur->widget->options & W_WANT_HOTKEY)
|
if (hot_cur->widget->options & W_WANT_HOTKEY)
|
||||||
handled |= (*hot_cur->widget->callback)
|
handled |= (*hot_cur->widget->callback)
|
||||||
(h, hot_cur->widget, WIDGET_HOTKEY, d_key);
|
(hot_cur->widget, WIDGET_HOTKEY, d_key);
|
||||||
|
|
||||||
if (!handled)
|
if (!handled)
|
||||||
hot_cur = hot_cur->next;
|
hot_cur = hot_cur->next;
|
||||||
@ -687,7 +687,7 @@ dlg_key_event (Dlg_head * h, int d_key)
|
|||||||
/* not used - then try widget_callback */
|
/* not used - then try widget_callback */
|
||||||
if (!handled)
|
if (!handled)
|
||||||
handled |=
|
handled |=
|
||||||
callback (h) (h, h->current->widget, WIDGET_KEY, d_key);
|
callback (h) (h->current->widget, WIDGET_KEY, d_key);
|
||||||
|
|
||||||
/* not used- try to use the unhandled case */
|
/* not used- try to use the unhandled case */
|
||||||
if (!handled)
|
if (!handled)
|
||||||
|
@ -102,7 +102,7 @@ typedef struct Dlg_head {
|
|||||||
typedef void (*destroy_fn)(void *widget);
|
typedef void (*destroy_fn)(void *widget);
|
||||||
|
|
||||||
/* Widget callback */
|
/* Widget callback */
|
||||||
typedef int (*callback_fn)(Dlg_head *h, void *widget, int Msg, int Par);
|
typedef int (*callback_fn)(void *widget, int Msg, int Par);
|
||||||
|
|
||||||
/* Every Widget must have this as it's first element */
|
/* Every Widget must have this as it's first element */
|
||||||
typedef struct Widget {
|
typedef struct Widget {
|
||||||
@ -178,7 +178,7 @@ void init_widget (Widget *w, int y, int x, int lines, int cols,
|
|||||||
int default_dlg_callback (Dlg_head *h, int id, int msg);
|
int default_dlg_callback (Dlg_head *h, int id, int msg);
|
||||||
|
|
||||||
/* Default callback for widgets */
|
/* Default callback for widgets */
|
||||||
int default_proc (Dlg_head *h, int Msg, int Par);
|
int default_proc (int Msg, int Par);
|
||||||
|
|
||||||
/* Default paint routine for dialogs */
|
/* Default paint routine for dialogs */
|
||||||
void common_dialog_repaint (struct Dlg_head *h);
|
void common_dialog_repaint (struct Dlg_head *h);
|
||||||
|
@ -586,9 +586,9 @@ static void prev_node_cmd (Dlg_head *h)
|
|||||||
help_callback (h, 0, DLG_DRAW);
|
help_callback (h, 0, DLG_DRAW);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int md_callback (Dlg_head *h, Widget *w, int msg, int par)
|
static int md_callback (Widget *w, int msg, int par)
|
||||||
{
|
{
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Widget *mousedispatch_new (int y, int x, int yl, int xl)
|
static Widget *mousedispatch_new (int y, int x, int yl, int xl)
|
||||||
|
@ -229,7 +229,7 @@ static void info_destroy (WInfo *info)
|
|||||||
delete_hook (&select_file_hook, info_hook);
|
delete_hook (&select_file_hook, info_hook);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int info_callback (Dlg_head *h, WInfo *info, int msg, int par)
|
static int info_callback (WInfo *info, int msg, int par)
|
||||||
{
|
{
|
||||||
switch (msg){
|
switch (msg){
|
||||||
|
|
||||||
@ -246,7 +246,7 @@ static int info_callback (Dlg_head *h, WInfo *info, int msg, int par)
|
|||||||
case WIDGET_FOCUS:
|
case WIDGET_FOCUS:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
WInfo *info_new ()
|
WInfo *info_new ()
|
||||||
|
@ -343,7 +343,7 @@ static int menubar_handle_key (WMenu *menubar, int key)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int menubar_callback (Dlg_head *h, WMenu *menubar, int msg, int par)
|
static int menubar_callback (WMenu *menubar, int msg, int par)
|
||||||
{
|
{
|
||||||
switch (msg){
|
switch (msg){
|
||||||
/* We do not want the focus unless we have been activated */
|
/* We do not want the focus unless we have been activated */
|
||||||
@ -388,7 +388,7 @@ static int menubar_callback (Dlg_head *h, WMenu *menubar, int msg, int par)
|
|||||||
if (menubar_visible)
|
if (menubar_visible)
|
||||||
menubar_draw (menubar);
|
menubar_draw (menubar);
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
10
src/screen.c
10
src/screen.c
@ -106,7 +106,7 @@ int filetype_mode = 1;
|
|||||||
/* The hook list for the select file function */
|
/* The hook list for the select file function */
|
||||||
Hook *select_file_hook = 0;
|
Hook *select_file_hook = 0;
|
||||||
|
|
||||||
static int panel_callback (Dlg_head *h, WPanel *p, int Msg, int Par);
|
static int panel_callback (WPanel *p, int Msg, int Par);
|
||||||
static int panel_event (Gpm_Event *event, WPanel *panel);
|
static int panel_event (Gpm_Event *event, WPanel *panel);
|
||||||
static void paint_frame (WPanel *panel);
|
static void paint_frame (WPanel *panel);
|
||||||
static char *panel_format (WPanel *panel);
|
static char *panel_format (WPanel *panel);
|
||||||
@ -2155,8 +2155,10 @@ void user_file_menu_cmd (void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
panel_callback (Dlg_head *h, WPanel *panel, int msg, int par)
|
panel_callback (WPanel *panel, int msg, int par)
|
||||||
{
|
{
|
||||||
|
Dlg_head *h = panel->widget.parent;
|
||||||
|
|
||||||
switch (msg){
|
switch (msg){
|
||||||
case WIDGET_INIT:
|
case WIDGET_INIT:
|
||||||
return 1;
|
return 1;
|
||||||
@ -2188,7 +2190,7 @@ panel_callback (Dlg_head *h, WPanel *panel, int msg, int par)
|
|||||||
redraw_labels (h);
|
redraw_labels (h);
|
||||||
|
|
||||||
/* Chain behaviour */
|
/* Chain behaviour */
|
||||||
default_proc (h, WIDGET_FOCUS, par);
|
default_proc (WIDGET_FOCUS, par);
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case WIDGET_UNFOCUS:
|
case WIDGET_UNFOCUS:
|
||||||
@ -2206,7 +2208,7 @@ panel_callback (Dlg_head *h, WPanel *panel, int msg, int par)
|
|||||||
return panel_key (panel, par);
|
return panel_key (panel, par);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
16
src/tree.c
16
src/tree.c
@ -60,8 +60,7 @@ static int tree_navigation_flag;
|
|||||||
/* Forwards */
|
/* Forwards */
|
||||||
static void save_tree (WTree *tree);
|
static void save_tree (WTree *tree);
|
||||||
static void tree_rescan_cmd (WTree *tree);
|
static void tree_rescan_cmd (WTree *tree);
|
||||||
static int tree_callback (Dlg_head *h, WTree *tree, int msg, int par);
|
static int tree_callback (WTree *tree, int msg, int par);
|
||||||
#define tcallback (callback_fn) tree_callback
|
|
||||||
|
|
||||||
static tree_entry *back_ptr (tree_entry *ptr, int *count)
|
static tree_entry *back_ptr (tree_entry *ptr, int *count)
|
||||||
{
|
{
|
||||||
@ -1002,8 +1001,10 @@ tree_frame (Dlg_head *h, WTree *tree)
|
|||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tree_callback (Dlg_head *h, WTree *tree, int msg, int par)
|
tree_callback (WTree *tree, int msg, int par)
|
||||||
{
|
{
|
||||||
|
Dlg_head *h = tree->widget.parent;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WIDGET_DRAW:
|
case WIDGET_DRAW:
|
||||||
tree_frame (h, tree);
|
tree_frame (h, tree);
|
||||||
@ -1049,7 +1050,7 @@ tree_callback (Dlg_head *h, WTree *tree, int msg, int par)
|
|||||||
show_tree (tree);
|
show_tree (tree);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
WTree *
|
WTree *
|
||||||
@ -1057,15 +1058,16 @@ tree_new (int is_panel, int y, int x, int lines, int cols)
|
|||||||
{
|
{
|
||||||
WTree *tree = g_new (WTree, 1);
|
WTree *tree = g_new (WTree, 1);
|
||||||
|
|
||||||
init_widget (&tree->widget, y, x, lines, cols, tcallback,
|
init_widget (&tree->widget, y, x, lines, cols,
|
||||||
(destroy_fn) tree_destroy, (mouse_h) event_callback, NULL);
|
(callback_fn) tree_callback, (destroy_fn) tree_destroy,
|
||||||
|
(mouse_h) event_callback, NULL);
|
||||||
tree->is_panel = is_panel;
|
tree->is_panel = is_panel;
|
||||||
tree->selected_ptr = 0;
|
tree->selected_ptr = 0;
|
||||||
|
|
||||||
tree->store = tree_store_get ();
|
tree->store = tree_store_get ();
|
||||||
tree_store_add_entry_remove_hook (remove_callback, tree);
|
tree_store_add_entry_remove_hook (remove_callback, tree);
|
||||||
tree->tree_shown = 0;
|
tree->tree_shown = 0;
|
||||||
tree->search_buffer [0] = 0;
|
tree->search_buffer[0] = 0;
|
||||||
tree->topdiff = tree->widget.lines / 2;
|
tree->topdiff = tree->widget.lines / 2;
|
||||||
tree->searching = 0;
|
tree->searching = 0;
|
||||||
tree->done = 0;
|
tree->done = 0;
|
||||||
|
@ -107,7 +107,7 @@ int altered_nroff_flag = 0;
|
|||||||
static const char hex_char[] = "0123456789ABCDEF";
|
static const char hex_char[] = "0123456789ABCDEF";
|
||||||
|
|
||||||
/* Our callback */
|
/* Our callback */
|
||||||
static int view_callback (Dlg_head * h, WView * view, int msg, int par);
|
static int view_callback (WView *view, int msg, int par);
|
||||||
|
|
||||||
static int regexp_view_search (WView * view, char *pattern, char *string,
|
static int regexp_view_search (WView * view, char *pattern, char *string,
|
||||||
int match_type);
|
int match_type);
|
||||||
@ -2485,9 +2485,10 @@ view_hook (void *v)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
view_callback (Dlg_head *h, WView *view, int msg, int par)
|
view_callback (WView *view, int msg, int par)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
Dlg_head *h = view->widget.parent;
|
||||||
|
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case WIDGET_INIT:
|
case WIDGET_INIT:
|
||||||
@ -2531,7 +2532,7 @@ view_callback (Dlg_head *h, WView *view, int msg, int par)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
WView *
|
WView *
|
||||||
|
80
src/widget.c
80
src/widget.c
@ -48,11 +48,12 @@ static int button_event (Gpm_Event *event, WButton *b);
|
|||||||
int quote = 0;
|
int quote = 0;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
button_callback (WButton *b, int Msg, int Par)
|
||||||
{
|
{
|
||||||
char buf[BUF_SMALL];
|
char buf[BUF_SMALL];
|
||||||
int stop = 0;
|
int stop = 0;
|
||||||
int off = 0;
|
int off = 0;
|
||||||
|
Dlg_head *h = b->widget.parent;
|
||||||
|
|
||||||
switch (Msg){
|
switch (Msg){
|
||||||
case WIDGET_INIT:
|
case WIDGET_INIT:
|
||||||
@ -60,7 +61,7 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
|||||||
|
|
||||||
case WIDGET_HOTKEY:
|
case WIDGET_HOTKEY:
|
||||||
if (b->hotkey == Par || toupper(b->hotkey) == Par){
|
if (b->hotkey == Par || toupper(b->hotkey) == Par){
|
||||||
button_callback (h, b, WIDGET_KEY, ' '); /* to make action */
|
button_callback (b, WIDGET_KEY, ' '); /* to make action */
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
@ -140,7 +141,7 @@ button_callback (Dlg_head *h, WButton *b, int Msg, int Par)
|
|||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return default_proc (h, Msg, Par);
|
return default_proc (Msg, Par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -150,7 +151,7 @@ button_event (Gpm_Event *event, WButton *b)
|
|||||||
Dlg_head *h=b->widget.parent;
|
Dlg_head *h=b->widget.parent;
|
||||||
dlg_select_widget (h, b);
|
dlg_select_widget (h, b);
|
||||||
if (event->type & GPM_UP){
|
if (event->type & GPM_UP){
|
||||||
button_callback (h, b, WIDGET_KEY, ' ');
|
button_callback (b, WIDGET_KEY, ' ');
|
||||||
(*h->callback) (h, ' ', DLG_POST_KEY);
|
(*h->callback) (h, ' ', DLG_POST_KEY);
|
||||||
return MOU_NORMAL;
|
return MOU_NORMAL;
|
||||||
}
|
}
|
||||||
@ -242,10 +243,11 @@ button_set_text (WButton *b, char *text)
|
|||||||
static int radio_event (Gpm_Event *event, WRadio *r);
|
static int radio_event (Gpm_Event *event, WRadio *r);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
radio_callback (WRadio *r, int Msg, int Par)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
Dlg_head *h = r->widget.parent;
|
||||||
|
|
||||||
switch (Msg) {
|
switch (Msg) {
|
||||||
case WIDGET_INIT:
|
case WIDGET_INIT:
|
||||||
return 1;
|
return 1;
|
||||||
@ -263,7 +265,7 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||||||
if (c != lp)
|
if (c != lp)
|
||||||
continue;
|
continue;
|
||||||
r->pos = i;
|
r->pos = i;
|
||||||
radio_callback (h, r, WIDGET_KEY, ' '); /* Take action */
|
radio_callback (r, WIDGET_KEY, ' '); /* Take action */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -275,7 +277,7 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||||||
case ' ':
|
case ' ':
|
||||||
r->sel = r->pos;
|
r->sel = r->pos;
|
||||||
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
||||||
radio_callback (h, r, WIDGET_FOCUS, ' ');
|
radio_callback (r, WIDGET_FOCUS, ' ');
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case KEY_UP:
|
case KEY_UP:
|
||||||
@ -297,7 +299,7 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||||||
|
|
||||||
case WIDGET_CURSOR:
|
case WIDGET_CURSOR:
|
||||||
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
||||||
radio_callback (h, r, WIDGET_FOCUS, ' ');
|
radio_callback (r, WIDGET_FOCUS, ' ');
|
||||||
widget_move (&r->widget, r->pos, 1);
|
widget_move (&r->widget, r->pos, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -326,7 +328,7 @@ radio_callback (Dlg_head *h, WRadio *r, int Msg, int Par)
|
|||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return default_proc (h, Msg, Par);
|
return default_proc (Msg, Par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -338,8 +340,8 @@ radio_event (Gpm_Event *event, WRadio *r)
|
|||||||
r->pos = event->y - 1;
|
r->pos = event->y - 1;
|
||||||
dlg_select_widget (h, r);
|
dlg_select_widget (h, r);
|
||||||
if (event->type & GPM_UP){
|
if (event->type & GPM_UP){
|
||||||
radio_callback (h, r, WIDGET_KEY, ' ');
|
radio_callback (r, WIDGET_KEY, ' ');
|
||||||
radio_callback (h, r, WIDGET_FOCUS, 0);
|
radio_callback (r, WIDGET_FOCUS, 0);
|
||||||
(*h->callback) (h, ' ', DLG_POST_KEY);
|
(*h->callback) (h, ' ', DLG_POST_KEY);
|
||||||
return MOU_NORMAL;
|
return MOU_NORMAL;
|
||||||
}
|
}
|
||||||
@ -380,8 +382,10 @@ radio_new (int y, int x, int count, char **texts, int use_hotkey, char *tkname)
|
|||||||
static int check_event (Gpm_Event *event, WCheck *b);
|
static int check_event (Gpm_Event *event, WCheck *b);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
check_callback (WCheck *c, int Msg, int Par)
|
||||||
{
|
{
|
||||||
|
Dlg_head *h = c->widget.parent;
|
||||||
|
|
||||||
switch (Msg) {
|
switch (Msg) {
|
||||||
case WIDGET_INIT:
|
case WIDGET_INIT:
|
||||||
return 1;
|
return 1;
|
||||||
@ -389,7 +393,7 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
|||||||
case WIDGET_HOTKEY:
|
case WIDGET_HOTKEY:
|
||||||
if (c->hotkey==Par ||
|
if (c->hotkey==Par ||
|
||||||
(c->hotkey>='a' && c->hotkey<='z' && c->hotkey-32==Par)){
|
(c->hotkey>='a' && c->hotkey<='z' && c->hotkey-32==Par)){
|
||||||
check_callback (h, c, WIDGET_KEY, ' '); /* make action */
|
check_callback (c, WIDGET_KEY, ' '); /* make action */
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
@ -400,7 +404,7 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
|||||||
c->state ^= C_BOOL;
|
c->state ^= C_BOOL;
|
||||||
c->state ^= C_CHANGE;
|
c->state ^= C_CHANGE;
|
||||||
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
(*h->callback) (h, h->current->dlg_id, DLG_ACTION);
|
||||||
check_callback (h, c, WIDGET_FOCUS, ' ');
|
check_callback (c, WIDGET_FOCUS, ' ');
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
case WIDGET_CURSOR:
|
case WIDGET_CURSOR:
|
||||||
@ -421,7 +425,7 @@ check_callback (Dlg_head *h, WCheck *c, int Msg, int Par)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return default_proc (h, Msg, Par);
|
return default_proc (Msg, Par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -432,8 +436,8 @@ check_event (Gpm_Event *event, WCheck *c)
|
|||||||
|
|
||||||
dlg_select_widget (h, c);
|
dlg_select_widget (h, c);
|
||||||
if (event->type & GPM_UP){
|
if (event->type & GPM_UP){
|
||||||
check_callback (h, c, WIDGET_KEY, ' ');
|
check_callback (c, WIDGET_KEY, ' ');
|
||||||
check_callback (h, c, WIDGET_FOCUS, 0);
|
check_callback (c, WIDGET_FOCUS, 0);
|
||||||
(*h->callback) (h, ' ', DLG_POST_KEY);
|
(*h->callback) (h, ' ', DLG_POST_KEY);
|
||||||
return MOU_NORMAL;
|
return MOU_NORMAL;
|
||||||
}
|
}
|
||||||
@ -483,8 +487,10 @@ check_new (int y, int x, int state, char *text, char *tkname)
|
|||||||
/* Label widget */
|
/* Label widget */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
label_callback (Dlg_head *h, WLabel *l, int Msg, int Par)
|
label_callback (WLabel *l, int Msg, int Par)
|
||||||
{
|
{
|
||||||
|
Dlg_head *h = l->widget.parent;
|
||||||
|
|
||||||
if (Msg == WIDGET_INIT)
|
if (Msg == WIDGET_INIT)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
@ -519,7 +525,7 @@ label_callback (Dlg_head *h, WLabel *l, int Msg, int Par)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return default_proc (h, Msg, Par);
|
return default_proc (Msg, Par);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -544,7 +550,7 @@ label_set_text (WLabel *label, char *text)
|
|||||||
label->text = 0;
|
label->text = 0;
|
||||||
|
|
||||||
if (label->widget.parent)
|
if (label->widget.parent)
|
||||||
label_callback (label->widget.parent, label, WIDGET_DRAW, 0);
|
label_callback (label, WIDGET_DRAW, 0);
|
||||||
|
|
||||||
if (newcols < label->widget.cols)
|
if (newcols < label->widget.cols)
|
||||||
label->widget.cols = newcols;
|
label->widget.cols = newcols;
|
||||||
@ -586,8 +592,9 @@ label_new (int y, int x, const char *text, char *tkname)
|
|||||||
#define gauge_len 47
|
#define gauge_len 47
|
||||||
|
|
||||||
static int
|
static int
|
||||||
gauge_callback (Dlg_head *h, WGauge *g, int Msg, int Par)
|
gauge_callback (WGauge *g, int Msg, int Par)
|
||||||
{
|
{
|
||||||
|
Dlg_head *h = g->widget.parent;
|
||||||
|
|
||||||
if (Msg == WIDGET_INIT)
|
if (Msg == WIDGET_INIT)
|
||||||
return 1;
|
return 1;
|
||||||
@ -625,7 +632,7 @@ gauge_callback (Dlg_head *h, WGauge *g, int Msg, int Par)
|
|||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return default_proc (h, Msg, Par);
|
return default_proc (Msg, Par);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -638,7 +645,7 @@ gauge_set_value (WGauge *g, int max, int current)
|
|||||||
|
|
||||||
g->current = current;
|
g->current = current;
|
||||||
g->max = max;
|
g->max = max;
|
||||||
gauge_callback (g->widget.parent, g, WIDGET_DRAW, 0);
|
gauge_callback (g, WIDGET_DRAW, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -647,7 +654,7 @@ gauge_show (WGauge *g, int shown)
|
|||||||
if (g->shown == shown)
|
if (g->shown == shown)
|
||||||
return;
|
return;
|
||||||
g->shown = shown;
|
g->shown = shown;
|
||||||
gauge_callback (g->widget.parent, g, WIDGET_DRAW, 0);
|
gauge_callback (g, WIDGET_DRAW, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1516,8 +1523,10 @@ input_set_point (WInput *in, int pos)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
|
input_callback (WInput *in, int Msg, int Par)
|
||||||
{
|
{
|
||||||
|
Dlg_head *h = in->widget.parent;
|
||||||
|
|
||||||
switch (Msg){
|
switch (Msg){
|
||||||
case WIDGET_INIT:
|
case WIDGET_INIT:
|
||||||
return 1;
|
return 1;
|
||||||
@ -1552,7 +1561,7 @@ input_callback (Dlg_head *h, WInput *in, int Msg, int Par)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
return default_proc (h, Msg, Par);
|
return default_proc (Msg, Par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1674,11 +1683,12 @@ listbox_drawscroll (WListbox *l)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
listbox_draw (WListbox *l, Dlg_head *h, int focused)
|
listbox_draw (WListbox *l, int focused)
|
||||||
{
|
{
|
||||||
WLEntry *e;
|
WLEntry *e;
|
||||||
int i;
|
int i;
|
||||||
int sel_line;
|
int sel_line;
|
||||||
|
Dlg_head *h = l->widget.parent;
|
||||||
int normalc = NORMALC;
|
int normalc = NORMALC;
|
||||||
int selc;
|
int selc;
|
||||||
char *text;
|
char *text;
|
||||||
@ -1944,7 +1954,7 @@ listbox_key (WListbox *l, int key)
|
|||||||
|
|
||||||
static int listbox_event (Gpm_Event *event, WListbox *l);
|
static int listbox_event (Gpm_Event *event, WListbox *l);
|
||||||
static int
|
static int
|
||||||
listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
|
listbox_callback (WListbox *l, int msg, int par)
|
||||||
{
|
{
|
||||||
WLEntry *e;
|
WLEntry *e;
|
||||||
/* int selected_color; Never used */
|
/* int selected_color; Never used */
|
||||||
@ -1974,7 +1984,7 @@ listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
|
|||||||
|
|
||||||
case WIDGET_KEY:
|
case WIDGET_KEY:
|
||||||
if ((ret_code = listbox_key (l, par)))
|
if ((ret_code = listbox_key (l, par)))
|
||||||
listbox_draw (l, h, 1);
|
listbox_draw (l, 1);
|
||||||
return ret_code;
|
return ret_code;
|
||||||
|
|
||||||
case WIDGET_CURSOR:
|
case WIDGET_CURSOR:
|
||||||
@ -1984,10 +1994,10 @@ listbox_callback (Dlg_head *h, WListbox *l, int msg, int par)
|
|||||||
case WIDGET_FOCUS:
|
case WIDGET_FOCUS:
|
||||||
case WIDGET_UNFOCUS:
|
case WIDGET_UNFOCUS:
|
||||||
case WIDGET_DRAW:
|
case WIDGET_DRAW:
|
||||||
listbox_draw (l, h, msg != WIDGET_UNFOCUS);
|
listbox_draw (l, msg != WIDGET_UNFOCUS);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2017,7 +2027,7 @@ listbox_event (Gpm_Event *event, WListbox *l)
|
|||||||
|
|
||||||
/* We need to refresh ourselves since the dialog manager doesn't */
|
/* We need to refresh ourselves since the dialog manager doesn't */
|
||||||
/* know about this event */
|
/* know about this event */
|
||||||
listbox_callback (h, l, WIDGET_DRAW, 0);
|
listbox_callback (l, WIDGET_DRAW, 0);
|
||||||
mc_refresh ();
|
mc_refresh ();
|
||||||
return MOU_REPEAT;
|
return MOU_REPEAT;
|
||||||
}
|
}
|
||||||
@ -2191,7 +2201,7 @@ listbox_get_current (WListbox *l, char **string, char **extra)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
buttonbar_callback (Dlg_head *h, WButtonBar *bb, int msg, int par)
|
buttonbar_callback (WButtonBar *bb, int msg, int par)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -2229,7 +2239,7 @@ buttonbar_callback (Dlg_head *h, WButtonBar *bb, int msg, int par)
|
|||||||
attrset (SELECTED_COLOR);
|
attrset (SELECTED_COLOR);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return default_proc (h, msg, par);
|
return default_proc (msg, par);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -164,7 +164,7 @@ void input_enable_update (WInput *in);
|
|||||||
void input_set_point (WInput *in, int pos);
|
void input_set_point (WInput *in, int pos);
|
||||||
void input_show_cursor (WInput *in);
|
void input_show_cursor (WInput *in);
|
||||||
void assign_text (WInput *in, char *text);
|
void assign_text (WInput *in, char *text);
|
||||||
int input_callback (Dlg_head *h, WInput *in, int Msg, int Par);
|
int input_callback (WInput *in, int Msg, int Par);
|
||||||
|
|
||||||
/* Labels */
|
/* Labels */
|
||||||
void label_set_text (WLabel *label, char *text);
|
void label_set_text (WLabel *label, char *text);
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user