void dlg_init (WDialog * h) { if (top_dlg != NULL && DIALOG (top_dlg->data)->modal) h->modal = TRUE; /* add dialog to the stack */ top_dlg = g_list_prepend (top_dlg, h); /* Initialize dialog manager and widgets */ if (h->state == DLG_CONSTRUCT) { if (!h->modal) dialog_switch_add (h); send_message (h, NULL, MSG_INIT, 0, NULL); dlg_broadcast_msg (h, MSG_INIT); dlg_read_history (h); } h->state = DLG_ACTIVE; /* Select the first widget that takes focus */ while (h->current != NULL && !dlg_focus (h)) h->current = dlg_widget_next (h, h->current); dlg_redraw (h); h->ret_value = 0; }
void init_dlg (Dlg_head * h) { if ((top_dlg != NULL) && ((Dlg_head *) top_dlg->data)->modal) h->modal = TRUE; /* add dialog to the stack */ top_dlg = g_list_prepend (top_dlg, h); /* Initialize dialog manager and widgets */ if (h->state == DLG_CONSTRUCT) { if (!h->modal) dialog_switch_add (h); h->callback (h, NULL, DLG_INIT, 0, NULL); dlg_broadcast_msg (h, WIDGET_INIT, FALSE); dlg_read_history (h); } h->state = DLG_ACTIVE; /* Select the first widget that takes focus */ while (h->current != NULL && !dlg_focus (h)) h->current = dlg_widget_next (h, h->current); dlg_redraw (h); h->ret_value = 0; }
void dlg_init (WDialog * h) { Widget *wh = WIDGET (h); if (top_dlg != NULL && widget_get_state (WIDGET (top_dlg->data), WST_MODAL)) widget_set_state (wh, WST_MODAL, TRUE); /* add dialog to the stack */ top_dlg = g_list_prepend (top_dlg, h); /* Initialize dialog manager and widgets */ if (widget_get_state (wh, WST_CONSTRUCT)) { if (!widget_get_state (wh, WST_MODAL)) dialog_switch_add (h); send_message (h, NULL, MSG_INIT, 0, NULL); dlg_broadcast_msg (h, MSG_INIT); dlg_read_history (h); } /* Select the first widget that takes focus */ while (h->current != NULL && !widget_get_options (WIDGET (h->current->data), WOP_SELECTABLE) && !widget_get_state (WIDGET (h->current->data), WST_DISABLED)) dlg_set_current_widget_next (h); widget_set_state (wh, WST_ACTIVE, TRUE); dlg_redraw (h); /* focus found widget */ if (h->current != NULL) widget_set_state (WIDGET (h->current->data), WST_FOCUSED, TRUE); h->ret_value = 0; }
void dlg_destroy (WDialog * h) { /* if some widgets have history, save all history at one moment here */ dlg_save_history (h); dlg_broadcast_msg (h, MSG_DESTROY); g_list_free_full (h->widgets, g_free); mc_event_group_del (h->event_group); g_free (h->event_group); g_free (h->title); g_free (h); do_refresh (); }
void destroy_dlg (Dlg_head * h) { /* if some widgets have history, save all history at one moment here */ dlg_save_history (h); dlg_broadcast_msg (h, WIDGET_DESTROY, FALSE); g_list_foreach (h->widgets, (GFunc) g_free, NULL); g_list_free (h->widgets); mc_event_group_del (h->event_group); g_free (h->event_group); g_free (h->title); g_free (h); do_refresh (); }
void dlg_redraw (WDialog * h) { if (h->state != DLG_ACTIVE) return; if (h->winch_pending) { h->winch_pending = FALSE; send_message (h, NULL, MSG_RESIZE, 0, NULL); } send_message (h, NULL, MSG_DRAW, 0, NULL); dlg_broadcast_msg (h, MSG_DRAW); update_cursor (h); }
void dlg_redraw (Dlg_head * h) { if (h->state != DLG_ACTIVE) return; if (h->winch_pending) { h->winch_pending = FALSE; h->callback (h, NULL, DLG_RESIZE, 0, NULL); } h->callback (h, NULL, DLG_DRAW, 0, NULL); dlg_broadcast_msg (h, WIDGET_DRAW, (h->flags & DLG_REVERSE) != 0); update_cursor (h); }
void dlg_redraw (WDialog * h) { if (!widget_get_state (WIDGET (h), WST_ACTIVE)) return; if (h->winch_pending) { h->winch_pending = FALSE; send_message (h, NULL, MSG_RESIZE, 0, NULL); } send_message (h, NULL, MSG_DRAW, 0, NULL); dlg_broadcast_msg (h, MSG_DRAW); update_cursor (h); }
static cb_ret_t advanced_chown_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data) { WDialog *h = DIALOG (w); int i; int f_pos; unsigned long id; id = dlg_get_current_widget_id (h); for (i = 0; i < BUTTONS_PERM; i++) if (chown_advanced_but[i].id == id) break; f_pos = i; i = 0; switch (msg) { case MSG_DRAW: chown_refresh (); chown_info_update (); return MSG_HANDLED; case MSG_POST_KEY: if (f_pos < 3) b_setpos (f_pos); return MSG_HANDLED; case MSG_FOCUS: if (f_pos < 3) { if ((flag_pos / 3) != f_pos) flag_pos = f_pos * 3; b_setpos (f_pos); } else if (f_pos < BUTTONS_PERM) flag_pos = f_pos + 6; return MSG_HANDLED; case MSG_KEY: switch (parm) { case XCTRL ('b'): case KEY_LEFT: if (f_pos < BUTTONS_PERM) return (dec_flag_pos (f_pos)); break; case XCTRL ('f'): case KEY_RIGHT: if (f_pos < BUTTONS_PERM) return (inc_flag_pos (f_pos)); break; case ' ': if (f_pos < 3) return MSG_HANDLED; break; case '\n': case KEY_ENTER: if (f_pos <= 2 || f_pos >= BUTTONS_PERM) break; do_enter_key (h, f_pos); return MSG_HANDLED; case ALT ('x'): i++; case ALT ('w'): i++; case ALT ('r'): parm = i + 3; for (i = 0; i < 3; i++) ch_flags[i * 3 + parm - 3] = (x_toggle & (1 << parm)) ? '-' : '+'; x_toggle ^= (1 << parm); update_mode (h); dlg_broadcast_msg (h, MSG_DRAW); send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL); break; case XCTRL ('x'): i++; case XCTRL ('w'): i++; case XCTRL ('r'): parm = i; for (i = 0; i < 3; i++) ch_flags[i * 3 + parm] = (x_toggle & (1 << parm)) ? '-' : '+'; x_toggle ^= (1 << parm); update_mode (h); dlg_broadcast_msg (h, MSG_DRAW); send_message (h->current->data, NULL, MSG_FOCUS, 0, NULL); break; case 'x': i++; case 'w': i++; case 'r': if (f_pos > 2) break; flag_pos = f_pos * 3 + i; /* (strchr(ch_perm,parm)-ch_perm); */ if (BUTTON (h->current->data)->text.start[(flag_pos % 3)] == '-') ch_flags[flag_pos] = '+'; else ch_flags[flag_pos] = '-'; update_mode (h); break; case '4': i++; case '2': i++; case '1': if (f_pos <= 2) { flag_pos = i + f_pos * 3; ch_flags[flag_pos] = '='; update_mode (h); } break; case '-': if (f_pos > 2) break; case '*': if (parm == '*') parm = '='; case '=': case '+': if (f_pos <= 4) { ch_flags[flag_pos] = parm; update_mode (h); send_message (h, sender, MSG_KEY, KEY_RIGHT, NULL); if (flag_pos > 8 || (flag_pos % 3) == 0) dlg_one_down (h); } break; default: break; } return MSG_NOT_HANDLED; default: return dlg_default_callback (w, sender, msg, parm, data); } }
static cb_ret_t advanced_chown_callback (Dlg_head *h, dlg_msg_t msg, int parm) { int i = 0, f_pos = BUTTONS - h->current->dlg_id - single_set - 1; switch (msg) { case DLG_DRAW: chown_refresh (); chown_info_update (); return MSG_HANDLED; case DLG_POST_KEY: if (f_pos < 3) b_setpos (f_pos); return MSG_HANDLED; case DLG_FOCUS: if (f_pos < 3) { if ((flag_pos / 3) != f_pos) flag_pos = f_pos * 3; b_setpos (f_pos); } else if (f_pos < 5) flag_pos = f_pos + 6; return MSG_HANDLED; case DLG_KEY: switch (parm) { case XCTRL ('b'): case KEY_LEFT: if (f_pos < 5) return (dec_flag_pos (f_pos)); break; case XCTRL ('f'): case KEY_RIGHT: if (f_pos < 5) return (inc_flag_pos (f_pos)); break; case ' ': if (f_pos < 3) return MSG_HANDLED; break; case '\n': case KEY_ENTER: if (f_pos <= 2 || f_pos >= 5) break; do_enter_key (h, f_pos); return MSG_HANDLED; case ALT ('x'): i++; case ALT ('w'): i++; case ALT ('r'): parm = i + 3; for (i = 0; i < 3; i++) ch_flags[i * 3 + parm - 3] = (x_toggle & (1 << parm)) ? '-' : '+'; x_toggle ^= (1 << parm); update_mode (h); dlg_broadcast_msg (h, WIDGET_DRAW, 0); send_message (h->current, WIDGET_FOCUS, 0); break; case XCTRL ('x'): i++; case XCTRL ('w'): i++; case XCTRL ('r'): parm = i; for (i = 0; i < 3; i++) ch_flags[i * 3 + parm] = (x_toggle & (1 << parm)) ? '-' : '+'; x_toggle ^= (1 << parm); update_mode (h); dlg_broadcast_msg (h, WIDGET_DRAW, 0); send_message (h->current, WIDGET_FOCUS, 0); break; case 'x': i++; case 'w': i++; case 'r': if (f_pos > 2) break; flag_pos = f_pos * 3 + i; /* (strchr(ch_perm,parm)-ch_perm); */ if (((WButton *) h->current)->text.start[(flag_pos % 3)] == '-') ch_flags[flag_pos] = '+'; else ch_flags[flag_pos] = '-'; update_mode (h); break; case '4': i++; case '2': i++; case '1': if (f_pos > 2) break; flag_pos = i + f_pos * 3; ch_flags[flag_pos] = '='; update_mode (h); break; case '-': if (f_pos > 2) break; case '*': if (parm == '*') parm = '='; case '=': case '+': if (f_pos > 4) break; ch_flags[flag_pos] = parm; update_mode (h); advanced_chown_callback (h, DLG_KEY, KEY_RIGHT); if (flag_pos > 8 || !(flag_pos % 3)) dlg_one_down (h); break; } return MSG_NOT_HANDLED; default: return default_dlg_callback (h, msg, parm); } }