![]() |
![]() |
![]() |
adg-1 reference manual |
![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties | Signals |
struct AdgGtkArea; struct AdgGtkAreaClass;void adg_gtk_area_canvas_changed (AdgGtkArea *area
,AdgCanvas *old_canvas
);void adg_gtk_area_extents_changed (AdgGtkArea *area
,const
); AdgCanvas * adg_gtk_area_get_canvas (CpmlExtents *old_extentsAdgGtkArea *area
); constCpmlExtents * adg_gtk_area_get_extents (AdgGtkArea *area
);gdouble adg_gtk_area_get_factor (AdgGtkArea *area
); const AdgMatrix * adg_gtk_area_get_render_map (AdgGtkArea *area
);gdouble adg_gtk_area_get_zoom (AdgGtkArea *area
);gboolean adg_gtk_area_has_autozoom (AdgGtkArea *area
);GtkWidget * adg_gtk_area_new (void
);GtkWidget * adg_gtk_area_new_with_canvas (AdgCanvas *canvas
);void adg_gtk_area_set_canvas (AdgGtkArea *area
,AdgCanvas *canvas
);void adg_gtk_area_set_factor (AdgGtkArea *area
,);
gdouble factorvoid adg_gtk_area_set_render_map (AdgGtkArea *area
,const AdgMatrix *map
);void adg_gtk_area_switch_autozoom (AdgGtkArea *area
,);
gboolean statevoid adg_gtk_area_transform_render_map (AdgGtkArea *area
,const AdgMatrix *transformation
,AdgTransformMode mode
);
GObject +----GInitiallyUnowned +----GtkWidget +----GtkDrawingArea +----AdgGtkArea +----AdgGtkLayout
"autozoom"gboolean : Read / Write "canvas" AdgCanvas* : Read / Write / Construct "factor"gdouble : Read / Write "render-map" AdgMatrix* : Read / Write
This is a adg_gtk_area_new_with_canvas()
constructor
function or by using adg_gtk_area_set_canvas()
.
The minimum size of the widget will depend on the canvas content.
The default implementation reacts to some mouse events: if you drag
the mouse keeping the wheel pressed, the canvas will be translated
(in local space by default and in global space if SHIFT
SHIFT
adg_gtk_area_get_zoom()
method could be used to retrieve the current zoom coefficient.
A new transformation layer is present between the global space and the rendering: the "render-map" matrix. This transformation is applied just before the rendering and it is used to align and/or apply the zoom coefficient to the canvas without affecting the other layers. Local transformations, instead, are directly applied to the local matrix of the canvas.
struct AdgGtkArea;
All fields are private and should not be used directly. Use its public methods instead.
Since 1.0
struct AdgGtkAreaClass { /* Virtual Table */ void (*canvas_changed) (AdgGtkArea *area, AdgCanvas *old_canvas); void (*extents_changed) (AdgGtkArea *area, const CpmlExtents *old_extents); };
void adg_gtk_area_canvas_changed (AdgGtkArea *area
,AdgCanvas *old_canvas
);
Emits the "canvas-changed" signal on area
.
|
an AdgGtkArea |
|
the old canvas bound to area |
Since 1.0
void adg_gtk_area_extents_changed (AdgGtkArea *area
,const
);CpmlExtents *old_extents
Emits the "extents-changed" signal on area
.
|
an AdgGtkArea |
|
the old extents of area |
Since 1.0
AdgCanvas * adg_gtk_area_get_canvas (AdgGtkArea *area
);
Gets the canvas associated to area
. The returned canvas
is owned by area
and should not be modified or freed.
|
an AdgGtkArea |
Returns : |
the requested AdgCanvas object or
NULL |
Since 1.0
constCpmlExtents * adg_gtk_area_get_extents (AdgGtkArea *area
);
Gets the extents of the canvas bound to area
. The returned
struct is owned by area
and should not modified or freed.
The extents of an AdgGtkArea instance are the extents of
its canvas (as returned by adg_entity_get_extents()
) with
the margins added to it and the "render-map"
transformation applied.
If area
does not have any canvas associated to it or the
canvas is invalid or empty, an undefined
The canvas will be updated, meaning adg_entity_arrange()
is called before the extents computation.
|
an AdgGtkArea |
Returns : |
the extents of the area canvas or NULL |
Since 1.0
gdouble adg_gtk_area_get_factor (AdgGtkArea *area
);
Gets the zoom factor associated to area
. The zoom factor is
directly used to zoom in (that is, the default zoom factor of
1.05 will zoom of 5% every iteration) and it is reversed while
zooming out (that is, the default factor will be 1/1.05).
|
an AdgGtkArea |
Returns : |
the requested zoom factor or 0 on error |
Since 1.0
const AdgMatrix * adg_gtk_area_get_render_map (AdgGtkArea *area
);
Gets the render map.
|
an AdgGtkArea object |
Returns : |
the requested map or NULL |
Since 1.0
gdouble adg_gtk_area_get_zoom (AdgGtkArea *area
);
Gets the last zoom coefficient applied on the canvas of area
.
If the "autozoom" property is FALSE
1
|
an AdgGtkArea |
Returns : |
the current zoom coefficient |
Since 1.0
gboolean adg_gtk_area_has_autozoom (AdgGtkArea *area
);
Gets the current state of the "autozoom" property on
the area
object.
|
an AdgGtkArea |
Returns : |
the current autozoom state |
Since 1.0
GtkWidget * adg_gtk_area_new (void
);
Creates a new empty AdgGtkArea. The widget is useful only after
an AdgCanvas has been added either using the "canvas"
property or with adg_gtk_area_set_canvas()
.
Returns : |
the newly created widget |
Since 1.0
GtkWidget * adg_gtk_area_new_with_canvas (AdgCanvas *canvas
);
Creates a new AdgGtkArea and sets the "canvas" property
to canvas
.
|
the AdgCanvas shown by this widget |
Returns : |
the newly created widget |
Since 1.0
void adg_gtk_area_set_canvas (AdgGtkArea *area
,AdgCanvas *canvas
);
Sets a new canvas on area
. The old canvas, if presents, is
unreferenced.
|
an AdgGtkArea |
|
the new AdgCanvas |
Since 1.0
void adg_gtk_area_set_factor (AdgGtkArea *area
,);
gdouble factor
Sets a new zoom factor to area
. If the factor is less than
1, it will be clamped to 1.
|
an AdgGtkArea |
|
the new zoom factor |
Since 1.0
void adg_gtk_area_set_render_map (AdgGtkArea *area
,const AdgMatrix *map
);
Sets the new render transformation of area
to map
:
the old map is discarded. If map
is NULL
The render map is an implementation detail and this function is expected to be used only by AdgGtkArea derived objects.
|
an AdgGtkArea object |
|
the new map |
Since 1.0
void adg_gtk_area_switch_autozoom (AdgGtkArea *area
,);
gboolean state
Sets the "autozoom" property of area
to state
. When the
autozoom feature is enabled, area
reacts to any size allocation
by adjusting its zoom coefficient in global space. This means the
drawing will fill the available space (keeping its aspect ratio)
when resizing the window.
|
an AdgGtkArea |
|
the new autozoom state |
Since 1.0
void adg_gtk_area_transform_render_map (AdgGtkArea *area
,const AdgMatrix *transformation
,AdgTransformMode mode
);
Convenient function to change the render map of area
by
applying tranformation
using the mode
operator. This is
logically equivalent to the following:
AdgMatrix map; adg_matrix_copy(&map, adg_gtk_area_get_render_map(area)); adg_matrix_transform(&map, transformation, mode); adg_gtk_area_set_render_map(area, &map);
The render map is an implementation detail and this function is expected to be used only by AdgGtkArea derived objects.
|
an AdgGtkArea object |
|
the transformation to apply |
|
how transformation should be applied |
Since 1.0
"autozoom"
property"autozoom"gboolean : Read / Write
When enabled, automatically adjust the zoom in global space at every size allocation.
Default value: FALSE
"factor"
property"factor"gdouble : Read / Write
The factor to use while zooming in and out (usually with the mouse wheel).
Allowed values: >= 1
Default value: 1.05
"render-map"
property"render-map" AdgMatrix* : Read / Write
The transformation to be applied on the canvas before rendering it.
"canvas-changed"
signalvoid user_function (AdgGtkArea *area, AdgCanvas *old_canvas,gpointer user_data) :No Recursion
Emitted when the AdgGtkArea has a new canvas. If the new canvas is the same as the old one, the signal is not emitted.
|
an AdgGtkArea |
|
the old AdgCanvas object |
|
user data set when the signal handler was connected. |
Since 1.0
"extents-changed"
signalvoid user_function (AdgGtkArea *area,gpointer old_extents,gpointer user_data) :No Recursion
Emitted when the extents of area
have been changed.
The old extents are always compared to the new ones,
so when the extents are recalculated but the result
is the same the signal is not emitted.
The extents of AdgGtkArea are subject to the render map, so changing the "render-map" property will emit this signal too.
|
an AdgGtkArea |
|
the old |
|
user data set when the signal handler was connected. |
Since 1.0