示例#1
0
文件: groupbox.c 项目: idispatch/mc
static cb_ret_t
groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WGroupbox *g = GROUPBOX (w);

    switch (msg)
    {
    case MSG_DRAW:
        {
            WDialog *h = w->owner;

            gboolean disabled;

            disabled = widget_get_state (w, WST_DISABLED);
            tty_setcolor (disabled ? DISABLED_COLOR : h->color[DLG_COLOR_NORMAL]);
            tty_draw_box (w->y, w->x, w->lines, w->cols, TRUE);

            if (g->title != NULL)
            {
                tty_setcolor (disabled ? DISABLED_COLOR : h->color[DLG_COLOR_TITLE]);
                widget_move (w, 0, 1);
                tty_print_string (g->title);
            }
            return MSG_HANDLED;
        }

    case MSG_DESTROY:
        g_free (g->title);
        return MSG_HANDLED;

    default:
        return widget_default_callback (w, sender, msg, parm, data);
    }
}
示例#2
0
static void
tree_frame (WDialog * h, WTree * tree)
{
    Widget *w = WIDGET (tree);

    (void) h;

    tty_setcolor (NORMAL_COLOR);
    widget_erase (w);
    if (tree->is_panel)
    {
        const char *title = _("Directory tree");
        const int len = str_term_width1 (title);

        tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE);

        widget_move (w, 0, (w->cols - len - 2) / 2);
        tty_printf (" %s ", title);

        if (panels_options.show_mini_info)
        {
            int y;

            y = w->lines - 3;
            widget_move (w, y, 0);
            tty_print_alt_char (ACS_LTEE, FALSE);
            widget_move (w, y, w->cols - 1);
            tty_print_alt_char (ACS_RTEE, FALSE);
            tty_draw_hline (w->y + y, w->x + 1, ACS_HLINE, w->cols - 2);
        }
    }
}
示例#3
0
文件: display.c 项目: artzub/mc
void
mcview_display_clean (mcview_t * view)
{
    tty_setcolor (NORMAL_COLOR);
    widget_erase ((Widget *) view);
    if (view->dpy_frame_size != 0)
        tty_draw_box (view->widget.y, view->widget.x, view->widget.lines, view->widget.cols, FALSE);
}
示例#4
0
文件: display.c 项目: Acidburn0zzz/mc
void
mcview_display_clean (WView * view)
{
    Widget *w = WIDGET (view);

    tty_setcolor (VIEW_NORMAL_COLOR);
    widget_erase (w);
    if (view->dpy_frame_size != 0)
        tty_draw_box (w->y, w->x, w->lines, w->cols, FALSE);
}
示例#5
0
文件: editdraw.c 项目: TomyLobo/mc
static inline void
edit_draw_frame (const WEdit * edit, int color, gboolean active)
{
    const Widget *w = (const Widget *) edit;

    /* draw a frame around edit area */
    tty_setcolor (color);
    /* draw double frame for active window if skin supports that */
    tty_draw_box (w->y, w->x, w->lines, w->cols, !active);
    /* draw a drag marker */
    if (edit->drag_state == MCEDIT_DRAG_NORMAL)
    {
        tty_setcolor (EDITOR_FRAME_DRAG);
        widget_move (w, w->lines - 1, w->cols - 1);
        tty_print_alt_char (ACS_LRCORNER, TRUE);
    }
}
示例#6
0
文件: menu.c 项目: BpArCuCTeMbI/mc
static void
menubar_draw_drop (WMenuBar * menubar)
{
    Widget *w = WIDGET (menubar);
    const menu_t *menu = MENU (g_list_nth_data (menubar->menu, menubar->selected));
    const unsigned int count = g_list_length (menu->entries);
    int column = menu->start_x - 1;
    unsigned int i;

    if (column + menu->max_entry_len + 5 > (gsize) w->cols)
        column = w->cols - menu->max_entry_len - 5;

    tty_setcolor (MENU_ENTRY_COLOR);
    tty_draw_box (w->y + 1, w->x + column, count + 2, menu->max_entry_len + 5, FALSE);

    for (i = 0; i < count; i++)
        menubar_paint_idx (menubar, i,
                           i == menu->selected ? MENU_SELECTED_COLOR : MENU_ENTRY_COLOR);
}
示例#7
0
static cb_ret_t
groupbox_callback (Widget * w, Widget * sender, widget_msg_t msg, int parm, void *data)
{
    WGroupbox *g = GROUPBOX (w);

    switch (msg)
    {
    case MSG_INIT:
        return MSG_HANDLED;

    case MSG_FOCUS:
        return MSG_NOT_HANDLED;

    case MSG_DRAW:
        {
            gboolean disabled;

            disabled = (w->options & W_DISABLED) != 0;
            tty_setcolor (disabled ? DISABLED_COLOR : COLOR_NORMAL);
            tty_draw_box (w->y, w->x, w->lines, w->cols, TRUE);

            if (g->title != NULL)
            {
                Widget *wo = WIDGET (w->owner);

                tty_setcolor (disabled ? DISABLED_COLOR : COLOR_TITLE);
                widget_move (wo, w->y - wo->y, w->x - wo->x + 1);
                tty_print_string (g->title);
            }
            return MSG_HANDLED;
        }

    case MSG_DESTROY:
        g_free (g->title);
        return MSG_HANDLED;

    default:
        return widget_default_callback (w, sender, msg, parm, data);
    }
}
示例#8
0
/** Clean the dialog area, draw the frame and the title */
void
dlg_default_repaint (WDialog * h)
{
    Widget *wh = WIDGET (h);

    int space;

    if (h->state != DLG_ACTIVE)
        return;

    space = (h->flags & DLG_COMPACT) ? 0 : 1;

    tty_setcolor (h->color[DLG_COLOR_NORMAL]);
    dlg_erase (h);
    tty_draw_box (wh->y + space, wh->x + space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE);

    if (h->title != NULL)
    {
        tty_setcolor (h->color[DLG_COLOR_TITLE]);
        widget_move (h, space, (wh->cols - str_term_width1 (h->title)) / 2);
        tty_print_string (h->title);
    }
}
示例#9
0
/** Clean the dialog area, draw the frame and the title */
void
dlg_default_repaint (WDialog * h)
{
    Widget *wh = WIDGET (h);

    int space;

    if (!widget_get_state (wh, WST_ACTIVE))
        return;

    space = h->compact ? 0 : 1;

    tty_setcolor (h->color[DLG_COLOR_NORMAL]);
    dlg_erase (h);
    tty_draw_box (wh->y + space, wh->x + space, wh->lines - 2 * space, wh->cols - 2 * space, FALSE);

    if (h->title != NULL)
    {
        /* TODO: truncate long title */
        tty_setcolor (h->color[DLG_COLOR_TITLE]);
        widget_move (h, space, (wh->cols - str_term_width1 (h->title)) / 2);
        tty_print_string (h->title);
    }
}
示例#10
0
文件: dialog.c 项目: ryanlee/mc
/** draw box in window */
void
draw_box (Dlg_head * h, int y, int x, int ys, int xs, gboolean single)
{
    tty_draw_box (h->y + y, h->x + x, ys, xs, single);
}