Top |
Functions
Properties
gchar * | alignment | Read / Write |
gchar * | anchor | Read / Write |
gchar * | compass | Read / Write |
guint | id | Read / Write |
gboolean | invisible | Read / Write |
gboolean | is-position-manual | Read / Write |
gchar * | manual-size | Read / Write |
gchar * | position | Read / Write |
Signals
void | changed | Run Last |
void | child-added | Run Last |
void | child-name-changed | Run Last |
void | child-removed | Run Last |
void | children-reordered | Run Last |
void | name-changed | Run Last |
void | update-editor | Run Last |
Types and Values
#define | GOG_PARAM_FORCE_SAVE |
#define | GOG_PARAM_POSITION |
enum | GogManualSizeMode |
GogObject | |
GogObjectClass | |
enum | GogObjectNamingConv |
GogObjectRole | |
enum | GogObjectPosition |
Object Hierarchy
GBoxed ╰── GogObjectRole GObject ╰── GogObject ├── Gog3DBox ├── GogStyledObject ╰── GogPlot
Description
Abstract base class that objects in the graph hierarchy are based on. This class handles manipulation of the object hierarchy, and positioning of objects in the graph.
Every object has a name that is unique in the graph. It can have a parent and a list of children in specific roles (see GogObjectRole). There can generally be several children in each role.
If built with GTK+ support, each object also knows how to populate a widget that allows one to manipulate the attributes of that object. This can be used by GOEditor to present a widget that allows manipulation of the whole graph.
Functions
gog_object_add_by_name ()
GogObject * gog_object_add_by_name (GogObject *parent
,char const *role
,GogObject *child
);
gog_object_add_by_role ()
GogObject * gog_object_add_by_role (GogObject *parent
,GogObjectRole const *role
,GogObject *child
);
Absorb a ref to child
if it is non-NULL.
gog_object_can_reorder ()
void gog_object_can_reorder (GogObject const *obj
,gboolean *inc_ok
,gboolean *dec_ok
);
If obj
can move forward or backward in its parents child list
gog_object_clear_parent ()
gboolean
gog_object_clear_parent (GogObject *obj
);
Does _not_ unref the child, which in effect adds a ref by freeing up the ref previously associated with the parent.
gog_object_dup ()
GogObject * gog_object_dup (GogObject const *src
,GogObject *new_parent
,GogDataDuplicator datadup
);
Create a deep copy of obj
using new_parent
as its parent.
gog_object_find_role_by_name ()
GogObjectRole const * gog_object_find_role_by_name (GogObject const *obj
,char const *role
);
gog_object_get_child_by_name ()
GogObject * gog_object_get_child_by_name (GogObject const *obj
,char const *name
);
A convenience routine to find a unique child with role == name
gog_object_get_child_by_role ()
GogObject * gog_object_get_child_by_role (GogObject const *obj
,GogObjectRole const *role
);
A convenience routine to find a unique child with role
.
gog_object_get_children ()
GSList * gog_object_get_children (GogObject const *obj
,GogObjectRole const *filter
);
gog_object_get_editor ()
gpointer gog_object_get_editor (GogObject *obj
,GogDataAllocator *dalloc
,GOCmdContext *cc
);
Builds an object property editor, by calling GogObject::populate_editor virtual functions.
gog_object_get_manual_allocation ()
GogViewAllocation gog_object_get_manual_allocation (GogObject *gobj
,GogViewAllocation const *parent_allocation
,GogViewRequisition const *requisition
);
gog_object_get_manual_position ()
void gog_object_get_manual_position (GogObject *obj
,GogViewAllocation *pos
);
FIXME
gog_object_get_manual_size_mode ()
GogManualSizeMode
gog_object_get_manual_size_mode (GogObject *obj
);
gog_object_get_name ()
char const *
gog_object_get_name (GogObject const *obj
);
No need to free the result
gog_object_get_parent_typed ()
GogObject * gog_object_get_parent_typed (GogObject const *obj
,GType t
);
gog_object_get_position_flags ()
GogObjectPosition gog_object_get_position_flags (GogObject const *obj
,GogObjectPosition mask
);
gog_object_is_default_position_flags ()
gboolean gog_object_is_default_position_flags (GogObject const *obj
,char const *name
);
gog_object_new_view ()
GogView * gog_object_new_view (GogObject const *obj
,GogView *parent
);
Creates a new GogView associated to obj
, and sets its parent to parent
.
gog_object_register_roles ()
void gog_object_register_roles (GogObjectClass *klass
,GogObjectRole const *roles
,unsigned int n_roles
);
gog_object_reorder ()
GogObject * gog_object_reorder (GogObject const *obj
,gboolean inc
,gboolean goto_max
);
gog_object_request_editor_update ()
void
gog_object_request_editor_update (GogObject *obj
);
Emits a update-editor signal. This signal should be used by object editors in order to refresh their states.
gog_object_set_manual_position ()
void gog_object_set_manual_position (GogObject *obj
,GogViewAllocation const *pos
);
set manual position of given object, in points.
gog_object_set_name ()
void gog_object_set_name (GogObject *obj
,char *name
,GError **err
);
Assign the new name and signals that it has changed.
NOTE : it _absorbs_ name
rather than copying it, and generates a new name
if name
== NULL
gog_object_set_parent ()
gboolean gog_object_set_parent (GogObject *child
,GogObject *parent
,GogObjectRole const *role
,unsigned int id
);
Absorbs a ref to child
gog_object_set_position_flags ()
gboolean gog_object_set_position_flags (GogObject *obj
,GogObjectPosition flags
,GogObjectPosition mask
);
Attempts to set the position flags of obj
to flags
.
Types and Values
GOG_PARAM_FORCE_SAVE
#define GOG_PARAM_FORCE_SAVE (1 << (G_PARAM_USER_SHIFT+1)) /* even if the value == default */
GOG_PARAM_POSITION
#define GOG_PARAM_POSITION (1 << (G_PARAM_USER_SHIFT+2)) /* position parameters */
GogObjectClass
typedef struct { GObjectClass base; GHashTable *roles; GType view_type; unsigned int use_parent_as_proxy : 1; /* when we change, pretend it was our parent */ unsigned int roles_allocated:1; /* Virtuals */ void (*update) (GogObject *obj); void (*parent_changed) (GogObject *obj, gboolean was_set); char const *(*type_name) (GogObject const *obj); void (*populate_editor) (GogObject *obj, GOEditor *editor, GogDataAllocator *dalloc, GOCmdContext *cc); void (*document_changed)(GogObject *obj, GODoc *doc); GogManualSizeMode (*get_manual_size_mode) (GogObject *obj); /* signals */ void (*changed) (GogObject *obj, gboolean size); void (*name_changed) (GogObject *obj); void (*possible_additions_changed) (GogObject const *obj); void (*child_added) (GogObject *parent, GogObject *child); void (*child_removed) (GogObject *parent, GogObject *child); void (*child_name_changed) (GogObject const *obj, GogObject const *child); void (*children_reordered) (GogObject *obj); void (*update_editor) (GogObject *obj); } GogObjectClass;
Members
base class. |
||
roles for the class. |
||
view type. |
||
updates the object. |
||
called when parent changed. |
||
gets the type public name. |
||
populates the editor. |
||
the document changed. |
||
resize mode. |
||
implements the "changed" signal. |
||
implements the "name-changed" signal. |
||
implements the "possible-additions-changed" signal. |
||
implements the "child-added" signal. |
||
implements the "child-removed" signal. |
||
implements the "child-name-changed" signal. |
||
implements the "children-reordered" signal. |
||
implements the "update-editor" signal. |
GogObjectRole
typedef struct { char const *id; /* for persistence */ char const *is_a_typename; unsigned int priority; guint32 allowable_positions; GogObjectPosition default_position; GogObjectNamingConv naming_conv; gboolean (*can_add) (GogObject const *parent); gboolean (*can_remove) (GogObject const *child); GogObject *(*allocate) (GogObject *parent); void (*post_add) (GogObject *parent, GogObject *child); void (*pre_remove) (GogObject *parent, GogObject *child); void (*post_remove) (GogObject *parent, GogObject *child); union { /* allow people to tack some useful tidbits on the end */ int i; gpointer p; } user; } GogObjectRole;
Describes allowable children for a GogObject.
Members
id for persistence. |
||
type name. |
||
allowed positions inside parent. |
||
GogObjectPosition |
default position. |
|
GogObjectNamingConv |
naming convention. |
|
return |
||
return |
||
optional allocator, |
||
called after adding the child. |
||
called before removing the child. |
||
called after removing the child. |
enum GogObjectPosition
Members
automatic. |
||
north, might be combined with east or west. |
||
south, might be combined with east or west. |
||
east. |
||
west. |
||
mask of the four previous positions. |
||
fills. |
||
start. |
||
end. |
||
centered. |
||
mask for start or end. |
||
special. |
||
manual. |
||
whether the x position is absolute or relative. |
||
whether the y position is absolute or relative. |
||
x position relative to start or end. |
||
y position relative to start or end. |
||
anchored north-west. |
||
anchored north. |
||
anchored north-east. |
||
anchored east. |
||
anchored south-east. |
||
anchored south. |
||
anchored south-west. |
||
anchored west. |
||
anchored at center. |
||
mask for anchors. |
||
mask for all manual positions |
||
padding. |
||
relative width. |
||
absolute width. |
||
relative height. |
||
absolute height. |
||
mask for manual sizes. |
||
expands in the horizontal direction. |
||
expands in the vertical direction. |
||
expands in either direction. |
Property Details
The “alignment”
property
“alignment” gchar *
Alignment flag.
Owner: GogObject
Flags: Read / Write
Default value: "fill"
The “anchor”
property
“anchor” gchar *
Anchor for manual position.
Owner: GogObject
Flags: Read / Write
Default value: "top-left"
The “compass”
property
“compass” gchar *
Compass auto position flags.
Owner: GogObject
Flags: Read / Write
Default value: "top"
The “id”
property
“id” guint
Object numerical ID.
Owner: GogObject
Flags: Read / Write
Allowed values: <= G_MAXINT
Default value: 0
The “invisible”
property
“invisible” gboolean
Should the object be hidden.
Owner: GogObject
Flags: Read / Write
Default value: FALSE
The “is-position-manual”
property
“is-position-manual” gboolean
Is position manual.
Owner: GogObject
Flags: Read / Write
Default value: FALSE
The “manual-size”
property
“manual-size” gchar *
Whether the height or width are manually set.
Owner: GogObject
Flags: Read / Write
Default value: "none"
Signal Details
The “changed”
signal
void user_function (GogObject *gogobject, gboolean arg1, gpointer user_data)
Flags: Run Last
The “child-added”
signal
void user_function (GogObject *object, GObject *child, gpointer user_data)
The ::child-added signal is emitted AFTER the child has been added and AFTER the parent-changed signal has been called for it.
Parameters
object |
the object on which the signal is emitted |
|
child |
The new GogObject whose parent is |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “child-name-changed”
signal
void user_function (GogObject *gogobject, GObject *arg1, gpointer user_data)
Flags: Run Last
The “child-removed”
signal
void user_function (GogObject *object, GObject *child, gpointer user_data)
The ::child-removed signal is emitted BEFORE the child has been added and BEFORE the parent-changed signal has been called for it.
Parameters
object |
the object on which the signal is emitted |
|
child |
The new GogObject whose parent is |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
The “children-reordered”
signal
void user_function (GogObject *gogobject, gpointer user_data)
Flags: Run Last
The “name-changed”
signal
void user_function (GogObject *gogobject, gpointer user_data)
Flags: Run Last
The “update-editor”
signal
void user_function (GogObject *gogobject, gpointer user_data)
Flags: Run Last