Synopsis

#include <adg-1/adg.h>

AdgTableCell *      adg_table_cell_dup                  (const AdgTableCell *table_cell);
AdgTableCell *      adg_table_cell_new                  (AdgTableRow *table_row);
AdgTableCell *      adg_table_cell_new_before           (AdgTableCell *before_cell);
AdgTableCell *      adg_table_cell_new_with_width       (AdgTableRow *table_row,
                                                         gdouble width);
AdgTableCell *      adg_table_cell_new_full             (AdgTableRow *table_row,
                                                         gdouble width,
                                                         const gchar *name,
                                                         const gchar *title,
                                                         gboolean has_frame);
void                adg_table_cell_dispose              (AdgTableCell *table_cell);
void                adg_table_cell_free                 (AdgTableCell *table_cell);
AdgTableRow *       adg_table_cell_get_row              (AdgTableCell *table_cell);
AdgTable *          adg_table_cell_get_table            (AdgTableCell *table_cell);
void                adg_table_cell_set_title            (AdgTableCell *table_cell,
                                                         AdgEntity *title);
void                adg_table_cell_set_text_title       (AdgTableCell *table_cell,
                                                         const gchar *title);
AdgEntity *         adg_table_cell_title                (AdgTableCell *table_cell);
void                adg_table_cell_set_value            (AdgTableCell *table_cell,
                                                         AdgEntity *value);
void                adg_table_cell_set_text_value       (AdgTableCell *table_cell,
                                                         const gchar *value);
AdgEntity *         adg_table_cell_value                (AdgTableCell *table_cell);
void                adg_table_cell_set_value_pos        (AdgTableCell *table_cell,
                                                         const CpmlPair *from_factor,
                                                         const CpmlPair *to_factor);
void                adg_table_cell_set_value_pos_explicit
                                                        (AdgTableCell *table_cell,
                                                         gdouble from_x,
                                                         gdouble from_y,
                                                         gdouble to_x,
                                                         gdouble to_y);
void                adg_table_cell_set_width            (AdgTableCell *table_cell,
                                                         gdouble width);
gdouble             adg_table_cell_get_width            (AdgTableCell *table_cell);
void                adg_table_cell_switch_frame         (AdgTableCell *table_cell,
                                                         gboolean has_frame);
gboolean            adg_table_cell_has_frame            (AdgTableCell *table_cell);
const CpmlExtents * adg_table_cell_get_extents          (AdgTableCell *table_cell);
const CpmlPair *    adg_table_cell_size_request         (AdgTableCell *table_cell,
                                                         const CpmlExtents *row_extents);
const CpmlExtents * adg_table_cell_arrange              (AdgTableCell *table_cell,
                                                         const CpmlExtents *layout);

Description

The AdgTableCell is a boxed type, the basic component of an AdgTable entity. It must be added to an AdgTableRow that, in cascade, will be added to an AdgTable entity.

Any cell can be filled with a title and a value: the font to be used will be picked up from the AdgTableStyle got by resolving the "table-dress" property.

The default title is placed at the upper left corner of the cell while the value is centered up to the bottom edge of the cell. Anyway the text positioning can be customized by using the adg_table_cell_set_value_pos() method.

Some convenient functions to easily create title and value entities with plain text are provided: adg_table_cell_new_full(), adg_table_cell_set_text_title() and adg_table_cell_set_text_value(). When using these methods keep in mind the underlying AdgToyText entities will be displaced accordingly to the "cell-padding" value, not used when setting the entities throught other APIs.

Details

adg_table_cell_dup ()

AdgTableCell *      adg_table_cell_dup                  (const AdgTableCell *table_cell);

Duplicates table_cell. The returned duplicate should be freed with adg_table_cell_free() when no longer needed.

table_cell :

an AdgTableCell structure

Returns :

a duplicate of table_cell. [transfer full]

Since 1.0


adg_table_cell_new ()

AdgTableCell *      adg_table_cell_new                  (AdgTableRow *table_row);

Creates a new empty cell without a frame and appends it at the end of the cells yet present in table_row. You can add content to the cell by using adg_table_cell_set_title() and adg_table_cell_set_value() or enable the frame with adg_table_cell_switch_frame().

table_row :

a valid AdgTableRow

Returns :

the newly created cell or NULL on errors. [transfer full]

Since 1.0


adg_table_cell_new_before ()

AdgTableCell *      adg_table_cell_new_before           (AdgTableCell *before_cell);

Creates a new cell and inserts it rigthly before the table_cell cell.

before_cell :

a valid AdgTableCell

Returns :

the newly created cell or NULL on errors. [transfer full]

Since 1.0


adg_table_cell_new_with_width ()

AdgTableCell *      adg_table_cell_new_with_width       (AdgTableRow *table_row,
                                                         gdouble width);

A convenient wrapper to adg_table_cell_new() that allows to specify the width of table_row all at once.

table_row :

a valid AdgTableRow

width :

the cell width

Returns :

the newly created cell or NULL on errors. [transfer full]

Since 1.0


adg_table_cell_new_full ()

AdgTableCell *      adg_table_cell_new_full             (AdgTableRow *table_row,
                                                         gdouble width,
                                                         const gchar *name,
                                                         const gchar *title,
                                                         gboolean has_frame);

A convenient function to add a cell and specifies some common used properties at once.

If name is NULL, the created cell will not be a named cell. Check adg_table_set_cell() for further details on what a named cell is supposed to be..

title can be NULL, in which case no title entity will be created.

table_row :

a valid AdgTableRow

width :

the cell width

name :

the name to bound to this cell. [allow-none]

title :

the title text. [allow-none]

has_frame :

whether to draw or not the frame

Returns :

the newly created cell or NULL on errors. [transfer full]

Since 1.0


adg_table_cell_dispose ()

void                adg_table_cell_dispose              (AdgTableCell *table_cell);

Disposes table_cell.

table_cell :

a valid AdgTableCell struct

Since 1.0


adg_table_cell_free ()

void                adg_table_cell_free                 (AdgTableCell *table_cell);

Releases all the memory allocated by table_cell, itself included.

table_cell :

an AdgTableCell structure

Since 1.0


adg_table_cell_get_row ()

AdgTableRow *       adg_table_cell_get_row              (AdgTableCell *table_cell);

Gets the row container of table_cell. The returned AdgTableRow is owned by table_cell and must not be modified or freed.

table_cell :

a valid AdgTableCell

Returns :

the container row. [transfer none]

Since 1.0


adg_table_cell_get_table ()

AdgTable *          adg_table_cell_get_table            (AdgTableCell *table_cell);

A convenient function that gets the table that contains table_cell. The returned AdgTable is owned by table_cell and must not be modified or freed.

table_cell :

a valid AdgTableCell

Returns :

the container table. [transfer none]

Since 1.0


adg_table_cell_set_title ()

void                adg_table_cell_set_title            (AdgTableCell *table_cell,
                                                         AdgEntity *title);

Sets title as the new title entity of table_cell. The top left corner of the bounding box of title will be cohincident to the top left corner of the cell extents, taking into accounts eventual padding spaces specified by the table style.

The old internal entity is unrefenrenced while the title (if not NULL) is refenenced with g_object_ref_sink().

title can be NULL, in which case the old entity is removed.

table_cell :

a valid AdgTableCell

title :

the new title entity

Since 1.0


adg_table_cell_set_text_title ()

void                adg_table_cell_set_text_title       (AdgTableCell *table_cell,
                                                         const gchar *title);

Convenient function to set a the title of a cell using an AdgToyText entity with the font dress picked from "table-dress" with a call to adg_table_style_get_title_dress().

table_cell :

a valid AdgTableCell

title :

a text string

Since 1.0


adg_table_cell_title ()

AdgEntity *         adg_table_cell_title                (AdgTableCell *table_cell);

Gets the current title of table_cell. The returned string is owned by table_cell and must not be modified or freed.

table_cell :

a valid AdgTableCell

Returns :

the title entity or NULL for undefined title. [transfer none]

Since 1.0


adg_table_cell_set_value ()

void                adg_table_cell_set_value            (AdgTableCell *table_cell,
                                                         AdgEntity *value);

Sets value as the new value entity of table_cell. The bottom middle point of the bounding box of value will be cohincident to the bottom middle point of the cell extents, taking into accounts eventual padding spaces specified by the table style.

The old internal entity is unrefenrenced while the value (if not NULL) is refenenced with g_object_ref_sink().

value can be NULL, in which case the old entity is removed.

table_cell :

a valid AdgTableCell

value :

the new value entity

Since 1.0


adg_table_cell_set_text_value ()

void                adg_table_cell_set_text_value       (AdgTableCell *table_cell,
                                                         const gchar *value);

Convenient function to set a the value of a cell using an AdgToyText entity with a value font dress picked from "table-dress" with a call to adg_table_style_get_value_dress().

table_cell :

a valid AdgTableCell

value :

a text string

Since 1.0


adg_table_cell_value ()

AdgEntity *         adg_table_cell_value                (AdgTableCell *table_cell);

Gets the current value of table_cell. The returned string is owned by table_cell and must not be modified or freed.

table_cell :

a valid AdgTableCell

Returns :

the value entity or NULL for undefined value. [transfer none]

Since 1.0


adg_table_cell_set_value_pos ()

void                adg_table_cell_set_value_pos        (AdgTableCell *table_cell,
                                                         const CpmlPair *from_factor,
                                                         const CpmlPair *to_factor);

Sets a new custom position for the value entity of table_cell. The from_factor specifies the source point (as a fraction of the value extents) while the to_factor is the destination point (specified as a fraction of the cell extents) the source point must be moved to.

table_cell :

a valid AdgTableCell

from_factor :

the alignment factor on the value entity

to_factor :

the alignment factor on the cell

Since 1.0


adg_table_cell_set_value_pos_explicit ()

void                adg_table_cell_set_value_pos_explicit
                                                        (AdgTableCell *table_cell,
                                                         gdouble from_x,
                                                         gdouble from_y,
                                                         gdouble to_x,
                                                         gdouble to_y);

A convenient wrapper around adg_table_cell_set_value_pos() that uses explicit factors instead of CpmlPair.

table_cell :

a valid AdgTableCell

from_x :

the x alignment factor on the entity

from_y :

the y alignment factor on the entity

to_x :

the x alignment factor on the cell

to_y :

the y alignment factor on the cell

Since 1.0


adg_table_cell_set_width ()

void                adg_table_cell_set_width            (AdgTableCell *table_cell,
                                                         gdouble width);

Sets a new width on table_cell. The extents on the whole table will be invalidated, so will be recomputed in the next arrange() phase.

A positive width value specifies the width of this cell in global space: if the width of its content (that is, either the title or the value entity) will be greater than width, it will be rendered outside the cell boundary box, luckely overwriting the adiacent cells.

Using 0 as width means the width of the cell will be automatically adjusted to the maximum width of its content.

Negative width values are not allowed: this condition will raise a warning without any further processing.

table_cell :

a valid AdgTableCell

width :

the new width

Since 1.0


adg_table_cell_get_width ()

gdouble             adg_table_cell_get_width            (AdgTableCell *table_cell);

Gets the width of table_cell.

table_cell :

a valid AdgTableCell

Returns :

the requested width or 0 on errors

Since 1.0


adg_table_cell_switch_frame ()

void                adg_table_cell_switch_frame         (AdgTableCell *table_cell,
                                                         gboolean has_frame);

Sets the frame flag of table_cell: if has_frame is TRUE, a frame around table_cell will be rendered using the "cell-dress" dress of the table style.

table_cell :

a valid AdgTableCell

has_frame :

whether to draw or not the frame

Since 1.0


adg_table_cell_has_frame ()

gboolean            adg_table_cell_has_frame            (AdgTableCell *table_cell);

Gets the frame flag of table_cell.

table_cell :

a valid AdgTableCell

Returns :

the frame flag.

Since 1.0


adg_table_cell_get_extents ()

const CpmlExtents * adg_table_cell_get_extents          (AdgTableCell *table_cell);

Gets the extents of table_cell. This function is useful only after the arrange() phase as in the other situation the extents will likely be not up to date.

table_cell :

a valid AdgTableCell

Returns :

the extents of table_cell or NULL on errors

Since 1.0


adg_table_cell_size_request ()

const CpmlPair *    adg_table_cell_size_request         (AdgTableCell *table_cell,
                                                         const CpmlExtents *row_extents);

Computes the minimum space needed to properly render table_cell and updates the size component of the internal CpmlExtents struct, returning it to the caller. The returned CpmlPair is owned by table_cell and should not be modified or freed.

table_cell :

a valid AdgTableCell

row_extents :

the extents of the container AdgTableRow

Returns :

the minimum size required. [transfer none]

Since 1.0


adg_table_cell_arrange ()

const CpmlExtents * adg_table_cell_arrange              (AdgTableCell *table_cell,
                                                         const CpmlExtents *layout);

Rearranges the underlying AdgTableCell owned by table_cell using the new extents provided in layout. If the x or y size component of layout is negative, the value holded by the internal extents struct is not overriden.

Note

table_cell->extents must be up to date if layout->size.x or layout->size.y is negative in order to have a valid size.

table_cell :

an AdgTableCell

layout :

the new extents to use

Returns :

the extents of table_cell or NULL on errors

Since 1.0