static int
display_callback (struct Dlg_head *h, int id, int Msg)
{
#ifndef HAVE_X
    switch (Msg){
    case DLG_DRAW:
	attrset (COLOR_NORMAL);
	dlg_erase (h);
	draw_box (h, 1, 2, h->lines - 2, h->cols - 4);

	attrset (COLOR_HOT_NORMAL);
	dlg_move (h, 1, (h->cols - strlen(display_title))/2);
	addstr (display_title);
	attrset (COLOR_NORMAL);
	break;

    case DLG_UNFOCUS:
	if((WRadio *) h->current->widget == my_radio){
	    assign_text (status, displays_status [my_radio->sel]);
	    input_set_point (status, 0);
	}
	break;
	
    case DLG_KEY:
	if (id == '\n'){
	    if((WRadio *) h->current->widget == my_radio){
		assign_text (status, displays_status [my_radio->sel]);
		dlg_stop (h);
		break;
	    }
	    
	    if ((WInput *) h->current->widget == user){
		h->ret_value = B_USER + 6;
		dlg_stop (h);
		break;
	    }
	
	    if ((WInput *) h->current->widget == status){
		h->ret_value = B_USER + 7;
		dlg_stop (h);
		break;
	    }
	}

	if (tolower(id) == user_hotkey && h->current->widget != (Widget *) user
	    && h->current->widget != (Widget *) status){
	    my_radio->sel = 3;
	    dlg_select_widget (h, my_radio); /* force redraw */
	    dlg_select_widget (h, user);
	    return MSG_HANDLED;
	}
    }
#endif    
    return MSG_NOT_HANDLED;
}
示例#2
0
void
history_cmd (void)
{
    Listbox *listbox;
    GList *current;

    if (cmdline->need_push) {
	if (push_history (cmdline, cmdline->buffer) == 2)
	    cmdline->need_push = 0;
    }
    if (!cmdline->history) {
	message (1, MSG_ERROR, _(" The command history is empty "));
	return;
    }
    current = g_list_first (cmdline->history);
    listbox = create_listbox_window (60, 10, _(" Command history "),
				     "[Command Menu]");
    while (current) {
	LISTBOX_APPEND_TEXT (listbox, 0, (char *) current->data, current);
	current = g_list_next(current);
    }
    run_dlg (listbox->dlg);
    if (listbox->dlg->ret_value == B_CANCEL)
	current = NULL;
    else
	current = listbox->list->current->data;
    destroy_dlg (listbox->dlg);
    g_free (listbox);

    if (!current)
	return;
    cmdline->history = current;
    assign_text (cmdline, (char *) current->data);
    update_input (cmdline, 1);
}
示例#3
0
static cb_ret_t
display_callback (struct Dlg_head *h, dlg_msg_t msg, int parm)
{
    switch (msg) {
    case DLG_UNFOCUS:
	if (dlg_widget_active (my_radio)) {
	    assign_text (status, displays_status[my_radio->sel]);
	    input_set_point (status, 0);
	}
	return MSG_HANDLED;

    case DLG_KEY:
	if (parm == '\n') {
	    if (dlg_widget_active (my_radio)) {
		assign_text (status, displays_status[my_radio->sel]);
		dlg_stop (h);
		return MSG_HANDLED;
	    }

	    if (dlg_widget_active (user)) {
		h->ret_value = B_USER + 6;
		dlg_stop (h);
		return MSG_HANDLED;
	    }

	    if (dlg_widget_active (status)) {
		h->ret_value = B_USER + 7;
		dlg_stop (h);
		return MSG_HANDLED;
	    }
	}

	if (tolower (parm) == user_hotkey && dlg_widget_active (user)
	    && dlg_widget_active (status)) {
	    my_radio->sel = 3;
	    dlg_select_widget (h, my_radio);	/* force redraw */
	    dlg_select_widget (h, user);
	    return MSG_HANDLED;
	}
	return MSG_NOT_HANDLED;

    default:
	return default_dlg_callback (h, msg, parm);
    }
}
示例#4
0
文件: panelize.c 项目: ebichu/dd-wrt
static void
update_command (void)
{
    if (l_panelize->pos != last_listitem) {
    	last_listitem = l_panelize->pos;
        assign_text (pname, 
            ((struct panelize *) l_panelize->current->data)->command);
	pname->point = 0;
        update_input (pname, 1);
    }
}