AdgModel

AdgModel — The base class of the ADG model infrastructure

Synopsis

void                (*AdgDependencyFunc)                (AdgModel *model,
                                                         AdgEntity *entity,
                                                         gpointer user_data);
void                (*AdgNamedPairFunc)                 (AdgModel *model,
                                                         const gchar *name,
                                                         AdgPair *pair,
                                                         gpointer user_data);
                    AdgModel;
void                adg_model_add_dependency            (AdgModel *model,
                                                         AdgEntity *entity);
void                adg_model_remove_dependency         (AdgModel *model,
                                                         AdgEntity *entity);
const GSList *      adg_model_get_dependencies          (AdgModel *model);
void                adg_model_foreach_dependency        (AdgModel *model,
                                                         AdgDependencyFunc callback,
                                                         gpointer user_data);
void                adg_model_set_named_pair            (AdgModel *model,
                                                         const gchar *name,
                                                         const AdgPair *pair);
void                adg_model_set_named_pair_explicit   (AdgModel *model,
                                                         const gchar *name,
                                                         gdouble x,
                                                         gdouble y);
const AdgPair *     adg_model_get_named_pair            (AdgModel *model,
                                                         const gchar *name);
void                adg_model_foreach_named_pair        (AdgModel *model,
                                                         AdgNamedPairFunc callback,
                                                         gpointer user_data);
void                adg_model_clear                     (AdgModel *model);
void                adg_model_reset                     (AdgModel *model);
void                adg_model_changed                   (AdgModel *model);

Object Hierarchy

  GObject
   +----AdgModel
         +----AdgTrail

Properties

  "dependency"               AdgEntity*            : Write

Signals

  "add-dependency"                                 : Run First
  "changed"                                        : Run Last / No Recursion
  "clear"                                          : Run Last / No Recursion
  "remove-dependency"                              : Run First
  "reset"                                          : Run Last / No Recursion
  "set-named-pair"                                 : Run First

Description

A model is a conceptual representation of something. From an ADG user point of view, it is a collection of data and rules that defines how an object should be represented on a drawing.

Because AdgModel instances are only a conceptual idea, they are not renderable (that is, AdgModel is not derived from AdgEntity). Instead, it must be passed as subject to entities such as AdgStroke or AdgHatch.

Details

AdgDependencyFunc ()

void                (*AdgDependencyFunc)                (AdgModel *model,
                                                         AdgEntity *entity,
                                                         gpointer user_data);

Callback used by adg_model_foreach_dependency().

model :

the AdgModel

entity :

the AdgEntity dependent on model

user_data :

a general purpose pointer

AdgNamedPairFunc ()

void                (*AdgNamedPairFunc)                 (AdgModel *model,
                                                         const gchar *name,
                                                         AdgPair *pair,
                                                         gpointer user_data);

Callback used by adg_model_foreach_named_pair().

model :

the AdgModel

name :

the name of the named pair

pair :

an AdgPair

user_data :

a general purpose pointer

AdgModel

typedef struct _AdgModel AdgModel;

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


adg_model_add_dependency ()

void                adg_model_add_dependency            (AdgModel *model,
                                                         AdgEntity *entity);

Note

This function is only useful in entity implementations.

Emits a "add-dependency" signal on model passing entity as argument. This will add a reference to entity owned by model.

model :

an AdgModel

entity :

an AdgEntity

adg_model_remove_dependency ()

void                adg_model_remove_dependency         (AdgModel *model,
                                                         AdgEntity *entity);

Note

This function is only useful in entity implementations.

Emits a "remove-dependency" signal on model passing entity as argument. entity must be inside model.

Note that model will own a reference to entity and it may be the last reference held: this means removing an entity from the model can destroy it.

model :

an AdgModel

entity :

an AdgEntity

adg_model_get_dependencies ()

const GSList *      adg_model_get_dependencies          (AdgModel *model);

Gets the list of entities dependending on model. This list is owned by model and must not be modified or freed.

model :

an AdgModel

Returns :

a GSList of dependencies or NULL on error

adg_model_foreach_dependency ()

void                adg_model_foreach_dependency        (AdgModel *model,
                                                         AdgDependencyFunc callback,
                                                         gpointer user_data);

Invokes callback on each entity linked to model.

model :

an AdgModel

callback :

the entity callback

user_data :

general purpose user data passed "as is" to callback

adg_model_set_named_pair ()

void                adg_model_set_named_pair            (AdgModel *model,
                                                         const gchar *name,
                                                         const AdgPair *pair);

Note

This function is only useful in model definitions, such as inside an AdgTrailCallback function or while constructing an AdgPath instance.

Emits a "set-named-pair" signal on model passing name and pair as arguments.

model :

an AdgModel

name :

the name to associate to the pair

pair :

the AdgPair

adg_model_set_named_pair_explicit ()

void                adg_model_set_named_pair_explicit   (AdgModel *model,
                                                         const gchar *name,
                                                         gdouble x,
                                                         gdouble y);

Note

This function is only useful in model definitions, such as inside an AdgTrailCallback function or while constructing an AdgPath instance.

Convenient wrapper on adg_model_set_named_pair() that accepts explicit coordinates.

model :

an AdgModel

name :

the name to associate to the pair

x :

the x coordinate of the point

y :

the y coordinate of the point

adg_model_get_named_pair ()

const AdgPair *     adg_model_get_named_pair            (AdgModel *model,
                                                         const gchar *name);

Gets the name named pair associated to model. The returned pair is owned by model and must not be modified or freed.

model :

an AdgModel

name :

the name of the pair to get

Returns :

the requested AdgPair or NULL if not found

adg_model_foreach_named_pair ()

void                adg_model_foreach_named_pair        (AdgModel *model,
                                                         AdgNamedPairFunc callback,
                                                         gpointer user_data);

Invokes callback for each named pair set on model. This can be used, for example, to retrieve all the named pairs of a model or to duplicate a transformed version of every named pair.

model :

an AdgModel

callback :

the named pair callback

user_data :

general purpose user data passed "as is" to callback

adg_model_clear ()

void                adg_model_clear                     (AdgModel *model);

Note

This function is only useful new model implementations.

Emits the "clear" signal on model.

model :

an AdgModel

adg_model_reset ()

void                adg_model_reset                     (AdgModel *model);

Emits the "reset" signal on model.

model :

an AdgModel

adg_model_changed ()

void                adg_model_changed                   (AdgModel *model);

Note

This function is only useful in entity implementations.

Emits the "changed" signal on model.

model :

an AdgModel

Property Details

The "dependency" property

  "dependency"               AdgEntity*            : Write

Can be used to add a new dependency from this model (this entity will be invalidated on model changed).

Signal Details

The "add-dependency" signal

void                user_function                      (AdgModel  *model,
                                                        AdgEntity *entity,
                                                        gpointer   user_data)      : Run First

Adds entity to model. After that entity will depend on model, that is "changed" on model will invalidate entity.

model :

an AdgModel

entity :

an AdgEntity that depends on model

user_data :

user data set when the signal handler was connected.

The "changed" signal

void                user_function                      (AdgModel *model,
                                                        gpointer  user_data)      : Run Last / No Recursion

Notificates that the model has changed. By default, all the dependent entities are invalidated.

model :

an AdgModel

user_data :

user data set when the signal handler was connected.

The "clear" signal

void                user_function                      (AdgModel *model,
                                                        gpointer  user_data)      : Run Last / No Recursion

Note

This signal is only useful in model implementations.

Removes any information from model cached by the implementation code. Useful to force a recomputation of the cache when something in the model has changed.

model :

an AdgModel

user_data :

user data set when the signal handler was connected.

The "remove-dependency" signal

void                user_function                      (AdgModel  *model,
                                                        AdgEntity *entity,
                                                        gpointer   user_data)      : Run First

Removes the entity from model, that is entity will not depend on model anymore.

model :

an AdgModel

entity :

the AdgEntity that does not depend on model anymore

user_data :

user data set when the signal handler was connected.

The "reset" signal

void                user_function                      (AdgModel *model,
                                                        gpointer  user_data)      : Run Last / No Recursion

Resets the state of model by destroying any named pair associated to it. This step also involves the emission of the AdgModel:clear signal.

This signal is intended to be used while redefining the model. A typical usage would be on these terms:

adg_model_reset(model);
// Definition of model. This also requires the redefinition of
// the named pairs because the old ones have been destroyed.
...
adg_model_changed(model);

model :

an AdgModel

user_data :

user data set when the signal handler was connected.

The "set-named-pair" signal

void                user_function                      (AdgModel *model,
                                                        gchar    *name,
                                                        gpointer  pair,
                                                        gpointer  user_data)      : Run First

Adds, updates or deletes a named pair, accordling to the given parameters.

If pair is NULL, the name named pair is searched and deleted. If it is not found, a warning is raised.

Otherwise, the name named pair is searched: if it is found, its data are updated with pair. If it is not found, a new named pair is created using name and pair.

model :

an AdgModel

name :

an arbitrary name

pair :

an AdgPair

user_data :

user data set when the signal handler was connected.
AdgModel was last modified by gtk-doc on Sat 24 Jul 2010 09:35:28 AM CEST
Hosted by Get Automatic Drawing Generation at SourceForge.net. Fast, secure and Free Open Source software downloads
Search on this domain