Esempio n. 1
0
static cb_ret_t
tree_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WTree *tree = (WTree *) w;
    WDialog *h = w->owner;
    WButtonBar *b;

    switch (msg)
    {
    case MSG_DRAW:
        tree_frame (h, tree);
        show_tree (tree);
        if (widget_get_state (w, WST_FOCUSED))
        {
            b = find_buttonbar (h);
            widget_redraw (WIDGET (b));
        }
        return MSG_HANDLED;

    case MSG_FOCUS:
        b = find_buttonbar (h);
        buttonbar_set_label (b, 1, Q_ ("ButtonBar|Help"), tree_map, w);
        buttonbar_set_label (b, 2, Q_ ("ButtonBar|Rescan"), tree_map, w);
        buttonbar_set_label (b, 3, Q_ ("ButtonBar|Forget"), tree_map, w);
        buttonbar_set_label (b, 4, tree_navigation_flag ? Q_ ("ButtonBar|Static")
                             : Q_ ("ButtonBar|Dynamc"), tree_map, w);
        buttonbar_set_label (b, 5, Q_ ("ButtonBar|Copy"), tree_map, w);
        buttonbar_set_label (b, 6, Q_ ("ButtonBar|RenMov"), tree_map, w);
#if 0
        /* FIXME: mkdir is currently defunct */
        buttonbar_set_label (b, 7, Q_ ("ButtonBar|Mkdir"), tree_map, w);
#else
        buttonbar_clear_label (b, 7, w);
#endif
        buttonbar_set_label (b, 8, Q_ ("ButtonBar|Rmdir"), tree_map, w);

        return MSG_HANDLED;

    case MSG_UNFOCUS:
        tree->searching = 0;
        return MSG_HANDLED;

    case MSG_KEY:
        return tree_key (tree, parm);

    case MSG_ACTION:
        /* command from buttonbar */
        return tree_execute_cmd (tree, parm);

    case MSG_DESTROY:
        tree_destroy (tree);
        return MSG_HANDLED;

    default:
        return widget_default_callback (w, sender, msg, parm, data);
    }
}
Esempio n. 2
0
File: tree.c Progetto: ebichu/dd-wrt
static cb_ret_t
tree_callback (Widget *w, widget_msg_t msg, int parm)
{
    WTree *tree = (WTree *) w;
    Dlg_head *h = tree->widget.parent;

    switch (msg) {
    case WIDGET_DRAW:
	tree_frame (h, tree);
	show_tree (tree);
	return MSG_HANDLED;

    case WIDGET_KEY:
	return tree_key (tree, parm);

    case WIDGET_FOCUS:
	tree->active = 1;
	buttonbar_set_label (h, 1, _("Help"), tree_help_cmd);
	buttonbar_set_label_data (h, 2, _("Rescan"),
	    tree_rescan_command, tree);
	buttonbar_set_label_data (h, 3, _("Forget"), tree_forget_cmd, tree);
	buttonbar_set_label_data (h, 5, _("Copy"), tree_copy_cmd, tree);
	buttonbar_set_label_data (h, 6, _("RenMov"), tree_move_cmd, tree);
#if 0
	/* FIXME: mkdir is currently defunct */
	buttonbar_set_label_data (h, 7, _("Mkdir"), tree_mkdir_cmd, tree);
#else
	buttonbar_clear_label (h, 7);
#endif
	buttonbar_set_label_data (h, 8, _("Rmdir"), tree_rmdir_command, tree);
	set_navig_label (tree);
	buttonbar_redraw (h);


	/* FIXME: Should find a better way of only displaying the
	   currently selected item */
	show_tree (tree);
	return MSG_HANDLED;

	/* FIXME: Should find a better way of changing the color of the
	   selected item */

    case WIDGET_UNFOCUS:
	tree->active = 0;
	show_tree (tree);
	return MSG_HANDLED;

    case WIDGET_DESTROY:
	tree_destroy (tree);
	return MSG_HANDLED;

    default:
	return default_proc (msg, parm);
    }
}
Esempio n. 3
0
File: tree.c Progetto: ryanlee/mc
static cb_ret_t
tree_callback (Widget * w, widget_msg_t msg, int parm)
{
    WTree *tree = (WTree *) w;
    Dlg_head *h = tree->widget.owner;
    WButtonBar *b = find_buttonbar (h);

    switch (msg)
    {
    case WIDGET_DRAW:
        tree_frame (h, tree);
        show_tree (tree);
        return MSG_HANDLED;

    case WIDGET_FOCUS:
        tree->active = 1;
        buttonbar_set_label (b, 1, Q_ ("ButtonBar|Help"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 2, Q_ ("ButtonBar|Rescan"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 3, Q_ ("ButtonBar|Forget"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 4, tree_navigation_flag ? Q_ ("ButtonBar|Static")
                             : Q_ ("ButtonBar|Dynamc"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 5, Q_ ("ButtonBar|Copy"), tree_map, (Widget *) tree);
        buttonbar_set_label (b, 6, Q_ ("ButtonBar|RenMov"), tree_map, (Widget *) tree);
#if 0
        /* FIXME: mkdir is currently defunct */
        buttonbar_set_label (b, 7, Q_ ("ButtonBar|Mkdir"), tree_map, (Widget *) tree);
#else
        buttonbar_clear_label (b, 7, (Widget *) tree);
#endif
        buttonbar_set_label (b, 8, Q_ ("ButtonBar|Rmdir"), tree_map, (Widget *) tree);
        buttonbar_redraw (b);

        /* FIXME: Should find a better way of only displaying the
           currently selected item */
        show_tree (tree);
        return MSG_HANDLED;

        /* FIXME: Should find a better way of changing the color of the
           selected item */

    case WIDGET_UNFOCUS:
        tree->active = 0;
        tree->searching = 0;
        show_tree (tree);
        return MSG_HANDLED;

    case WIDGET_KEY:
        return tree_key (tree, parm);

    case WIDGET_COMMAND:
        /* command from buttonbar */
        return tree_execute_cmd (tree, parm);

    case WIDGET_DESTROY:
        tree_destroy (tree);
        return MSG_HANDLED;

    default:
        return default_proc (msg, parm);
    }
}