Exemplo n.º 1
0
static guint32
gnc_table_get_fg_color_internal (Table *table, VirtualLocation virt_loc)
{
    TableGetFGColorHandler fg_color_handler;
    const char *handler_name;

    if (!table || !table->model)
        return COLOR_UNKNOWN_FG;

    handler_name = gnc_table_get_cell_name (table, virt_loc);

    fg_color_handler = gnc_table_model_get_fg_color_handler (table->model,
                       handler_name);
    if (!fg_color_handler)
    {
        TableGetBGColorHandler bg_color_handler =
            gnc_table_model_get_bg_color_handler (table->model, handler_name);

        guint32 bg_color =
            bg_color_handler (virt_loc, NULL, table->model->handler_user_data);
        return bg_color + COLOR_UNKNOWN_FG;
    }

    return fg_color_handler (virt_loc, table->model->handler_user_data);
}
Exemplo n.º 2
0
const char *
gnc_table_get_current_cell_name (Table *table)
{
    if (table == NULL)
        return NULL;

    return gnc_table_get_cell_name (table, table->current_cursor_loc);
}
Exemplo n.º 3
0
gboolean
gnc_table_confirm_change (Table *table, VirtualLocation virt_loc)
{
    TableConfirmHandler confirm_handler;
    const char *cell_name;

    if (!table || !table->model)
        return TRUE;

    cell_name = gnc_table_get_cell_name (table, virt_loc);

    confirm_handler = gnc_table_model_get_confirm_handler (table->model,
                      cell_name);
    if (!confirm_handler)
        return TRUE;

    return confirm_handler (virt_loc, table->model->handler_user_data);
}
Exemplo n.º 4
0
void
gnc_table_get_borders (Table *table, VirtualLocation virt_loc,
                       PhysicalCellBorders *borders)
{
    TableGetCellBorderHandler cell_border_handler;
    const char *cell_name;

    if (!table || !table->model)
        return;

    cell_name = gnc_table_get_cell_name (table, virt_loc);

    cell_border_handler = gnc_table_model_get_cell_border_handler (table->model,
                          cell_name);
    if (!cell_border_handler)
        return;

    cell_border_handler (virt_loc, borders, table->model->handler_user_data);
}
Exemplo n.º 5
0
char *
gnc_table_get_help (Table *table)
{
    TableGetHelpHandler help_handler;
    VirtualLocation virt_loc;
    const char * cell_name;

    if (!table)
        return NULL;

    virt_loc = table->current_cursor_loc;

    cell_name = gnc_table_get_cell_name (table, virt_loc);

    help_handler = gnc_table_model_get_help_handler (table->model, cell_name);
    if (!help_handler)
        return NULL;

    return help_handler (virt_loc, table->model->handler_user_data);
}
Exemplo n.º 6
0
static const char *
gnc_table_get_entry_internal (Table *table, VirtualLocation virt_loc,
                              gboolean *conditionally_changed)
{
    TableGetEntryHandler entry_handler;
    const char *cell_name;
    const char *entry;

    cell_name = gnc_table_get_cell_name (table, virt_loc);

    entry_handler = gnc_table_model_get_entry_handler (table->model, cell_name);
    if (!entry_handler) return "";

    entry = entry_handler (virt_loc, FALSE,
                           conditionally_changed,
                           table->model->handler_user_data);
    if (!entry)
        entry = "";

    return entry;
}
Exemplo n.º 7
0
const char *
gnc_table_get_label (Table *table, VirtualLocation virt_loc)
{
    TableGetLabelHandler label_handler;
    const char *cell_name;
    const char *label;

    if (!table || !table->model)
        return "";

    cell_name = gnc_table_get_cell_name (table, virt_loc);

    label_handler = gnc_table_model_get_label_handler (table->model, cell_name);
    if (!label_handler)
        return "";

    label = label_handler (virt_loc, table->model->handler_user_data);
    if (!label)
        return "";

    return label;
}
Exemplo n.º 8
0
guint32
gnc_table_get_color (Table *table, VirtualLocation virt_loc,
                                 gboolean *hatching)
{
    TableGetCellColorHandler color_handler;
    const char *handler_name;

    if (hatching)
        *hatching = FALSE;

    if (!table || !table->model)
        return COLOR_UNDEFINED;

    handler_name = gnc_table_get_cell_name (table, virt_loc);

    color_handler = gnc_table_model_get_cell_color_handler (table->model,
                                                            handler_name);

    if (!color_handler)
        return COLOR_UNDEFINED;

    return color_handler (virt_loc, hatching,
                          table->model->handler_user_data);
}
Exemplo n.º 9
0
CellIOFlags
gnc_table_get_io_flags (Table *table, VirtualLocation virt_loc)
{
    TableGetCellIOFlagsHandler io_flags_handler;
    const char *cell_name;
    CellIOFlags flags;

    if (!table || !table->model)
        return XACC_CELL_ALLOW_NONE;

    cell_name = gnc_table_get_cell_name (table, virt_loc);

    io_flags_handler = gnc_table_model_get_io_flags_handler (table->model,
                       cell_name);
    if (!io_flags_handler)
        return XACC_CELL_ALLOW_NONE;

    flags = io_flags_handler (virt_loc, table->model->handler_user_data);

    if (gnc_table_model_read_only (table->model))
        flags &= XACC_CELL_ALLOW_SHADOW;

    return flags;
}
Exemplo n.º 10
0
static guint32
gnc_table_get_bg_color_internal (Table *table, VirtualLocation virt_loc,
                                 gboolean *hatching)
{
    TableGetBGColorHandler bg_color_handler;
    const char *handler_name;

    if (hatching)
        *hatching = FALSE;

    if (!table || !table->model)
        return COLOR_UNKNOWN_BG;

    handler_name = gnc_table_get_cell_name (table, virt_loc);

    bg_color_handler = gnc_table_model_get_bg_color_handler (table->model,
            handler_name);

    if (!bg_color_handler)
        return COLOR_UNKNOWN_BG;

    return bg_color_handler (virt_loc, hatching,
                             table->model->handler_user_data);
}