Esempio n. 1
0
void TXT_DrawWindow(txt_window_t *window, int selected)
{
    txt_widget_t *widgets;

    TXT_LayoutWindow(window);
    
    // Draw the window

    TXT_DrawWindowFrame(window->title, 
                        window->window_x, window->window_y,
                        window->window_w, window->window_h);

    // Draw all widgets

    TXT_DrawWidget(window, selected);

    // Draw an action area, if we have one

    widgets = (txt_widget_t *) window;

    if (widgets->y + widgets->h < window->window_y + window->window_h - 1)
    {
        // Separator for action area

        TXT_DrawSeparator(window->window_x, widgets->y + widgets->h, 
                          window->window_w);

        // Action area at the window bottom

        DrawActionArea(window);
    }
}
Esempio n. 2
0
static void TXT_TableDrawer(TXT_UNCAST_ARG(table), int selected)
{
    TXT_CAST_ARG(txt_table_t, table);
    txt_widget_t *widget;
    int selected_cell;
    int i;
    
    // Check the table's current selection points at something valid before
    // drawing.

    CheckValidSelection(table);

    // Find the index of the currently-selected widget.

    selected_cell = table->selected_y * table->columns + table->selected_x;
    
    // Draw all cells
    
    for (i=0; i<table->num_widgets; ++i)
    {
        widget = table->widgets[i];

        if (widget != NULL)
        {
            TXT_GotoXY(widget->x, widget->y);
            TXT_DrawWidget(widget, selected && i == selected_cell);
        }
    }
}
Esempio n. 3
0
static void DrawActionArea(txt_window_t *window)
{
    int i;

    for (i=0; i<3; ++i)
    {
        if (window->actions[i] != NULL)
        {
            TXT_DrawWidget(window->actions[i]);
        }
    }
}
Esempio n. 4
0
static void TXT_FileSelectDrawer(TXT_UNCAST_ARG(fileselect))
{
    TXT_CAST_ARG(txt_fileselect_t, fileselect);

    // Input box widget inherits all the properties of the
    // file selector.

    fileselect->inputbox->widget.x = fileselect->widget.x;
    fileselect->inputbox->widget.y = fileselect->widget.y;
    fileselect->inputbox->widget.w = fileselect->widget.w;
    fileselect->inputbox->widget.h = fileselect->widget.h;

    TXT_DrawWidget(fileselect->inputbox);
}
Esempio n. 5
0
static void TXT_ScrollPaneDrawer(TXT_UNCAST_ARG(scrollpane))
{
    TXT_CAST_ARG(txt_scrollpane_t, scrollpane);
    int x1, y1, x2, y2;
    int scrollbars;

    // We set a clipping area of the scroll pane.

    x1 = scrollpane->widget.x,
    y1 = scrollpane->widget.y,
    x2 = x1 + scrollpane->w,
    y2 = y1 + scrollpane->h;

    scrollbars = NeedsScrollbars(scrollpane);

    if (scrollbars & SCROLLBAR_HORIZONTAL)
    {
        TXT_DrawHorizScrollbar(x1,
                               y1 + scrollpane->h,
                               scrollpane->w,
                               scrollpane->x,
                               FullWidth(scrollpane) - scrollpane->w);
    }

    if (scrollbars & SCROLLBAR_VERTICAL)
    {
        TXT_DrawVertScrollbar(x1 + scrollpane->w,
                              y1,
                              scrollpane->h,
                              scrollpane->y,
                              FullHeight(scrollpane) - scrollpane->h);
    }

    TXT_PushClipArea(x1, x2, y1, y2);

    // Draw the child widget

    if (scrollpane->child != NULL)
    {
        TXT_DrawWidget(scrollpane->child);
    }

    // Restore old clipping area.

    TXT_PopClipArea();
}
Esempio n. 6
0
void TXT_DrawWindow(txt_window_t *window)
{
    txt_widget_t *widgets;

    TXT_LayoutWindow(window);

    if (window->table.widget.focused)
    {
        TXT_BGColor(TXT_ACTIVE_WINDOW_BACKGROUND, 0);
    }
    else
    {
        TXT_BGColor(TXT_INACTIVE_WINDOW_BACKGROUND, 0);
    }

    TXT_FGColor(TXT_COLOR_BRIGHT_WHITE);

    // Draw the window

    TXT_DrawWindowFrame(window->title, 
                        window->window_x, window->window_y,
                        window->window_w, window->window_h);

    // Draw all widgets

    TXT_DrawWidget(window);

    // Draw an action area, if we have one

    widgets = (txt_widget_t *) window;

    if (widgets->y + widgets->h < window->window_y + window->window_h - 1)
    {
        // Separator for action area

        TXT_DrawSeparator(window->window_x, widgets->y + widgets->h, 
                          window->window_w);

        // Action area at the window bottom

        DrawActionArea(window);
    }
}
Esempio n. 7
0
static void TXT_TableDrawer(TXT_UNCAST_ARG(table))
{
    TXT_CAST_ARG(txt_table_t, table);
    txt_widget_t *widget;
    int i;

    // Check the table's current selection points at something valid before
    // drawing.

    CheckValidSelection(table);

    // Draw all cells

    for (i=0; i<table->num_widgets; ++i)
    {
        widget = table->widgets[i];

        if (IsActualWidget(widget))
        {
            TXT_GotoXY(widget->x, widget->y);
            TXT_DrawWidget(widget);
        }
    }
}