Synopsis

#include <adg-1/adg.h>

struct              AdgAlignment;
struct              AdgAlignmentClass;
AdgAlignment *      adg_alignment_new                   (const CpmlPair *factor);
AdgAlignment *      adg_alignment_new_explicit          (gdouble x_factor,
                                                         gdouble y_factor);
void                adg_alignment_set_factor            (AdgAlignment *alignment,
                                                         const CpmlPair *factor);
void                adg_alignment_set_factor_explicit   (AdgAlignment *alignment,
                                                         gdouble x_factor,
                                                         gdouble y_factor);
const CpmlPair *    adg_alignment_get_factor            (AdgAlignment *alignment);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----AdgEntity
               +----AdgContainer
                     +----AdgAlignment

Properties

  "factor"                   CpmlPair*             : Read / Write

Description

The AdgAlignment is an entity that can contains more sub-entities, much in the same way as the AdgContainer does, but allowing the displacement of its content with an arbitrary fraction dependent on the content itself.

This shift is computed by multiplying the "factor" property with the extents of the bare content, with "bare" meaning the children entities as they are rendered on the global matrix *without* rotation components.

To specify the alignment fraction, use adg_alignment_set_factor() and related methods or directly set the "factor" property. For example, to center the children either in x and y, you can call adg_alignment_set_factor_explicit(alignment, 0.5, 0.5). To align them on the right, specify a (0, 1) factor.

Details

struct AdgAlignment

struct AdgAlignment;

All fields are private and should not be used directly. Use its public methods instead.

Since 1.0


struct AdgAlignmentClass

struct AdgAlignmentClass {
};

adg_alignment_new ()

AdgAlignment *      adg_alignment_new                   (const CpmlPair *factor);

Creates a new alignment container with the specified factor.

factor :

the alignment factor

Returns :

the newly created alignment or NULL on errors

Since 1.0


adg_alignment_new_explicit ()

AdgAlignment *      adg_alignment_new_explicit          (gdouble x_factor,
                                                         gdouble y_factor);

Convenient function that creates a new alignment accepting explicit factor values.

x_factor :

x component of the factor

y_factor :

y component of the factor

Returns :

the newly created alignment

Since 1.0


adg_alignment_set_factor ()

void                adg_alignment_set_factor            (AdgAlignment *alignment,
                                                         const CpmlPair *factor);

Sets a the "factor" property to factor on alignment. The factor is applied to the alignment extents to compute the displacement of the content, providing a way to for instance center the content either vertically or horizontally. A pair factor of (0.5, 0) means the content will be centered horizontally in reference to the normal flow without alignment.

alignment :

an AdgAlignment container

factor :

the new factor

Since 1.0


adg_alignment_set_factor_explicit ()

void                adg_alignment_set_factor_explicit   (AdgAlignment *alignment,
                                                         gdouble x_factor,
                                                         gdouble y_factor);

Convenient wrapper around adg_alignment_set_factor() that accepts explicit factors instead of an CpmlPair value.

alignment :

an AdgAlignment container

x_factor :

x component of the factor

y_factor :

y component of the factor

Since 1.0


adg_alignment_get_factor ()

const CpmlPair *    adg_alignment_get_factor            (AdgAlignment *alignment);

Gets the value of the "factor" property. The returned pair is owned by alignment and must not be modified or freed.

alignment :

an AdgAlignment container

Returns :

the factor pair

Since 1.0

Property Details

The "factor" property

  "factor"                   CpmlPair*             : Read / Write

Portion of extents, either in x and y, the content will be displaced: a (0.5, 0.5) factor means the origin is the middle point of the extents.