AdgGtkArea

AdgGtkArea — A GtkWidget specifically designed to contain an AdgCanvas entity

Synopsis

                    AdgGtkArea;
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);
AdgCanvas *         adg_gtk_area_get_canvas             (AdgGtkArea *area);
void                adg_gtk_area_set_factor             (AdgGtkArea *area,
                                                         gdouble factor);
gdouble             adg_gtk_area_get_factor             (AdgGtkArea *area);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkDrawingArea
                           +----AdgGtkArea

Implemented Interfaces

AdgGtkArea implements AtkImplementorIface and GtkBuildable.

Properties

  "canvas"                   AdgCanvas*            : Read / Write / Construct
  "factor"                   gdouble               : Read / Write

Signals

  "canvas-changed"                                 : Run Last / No Recursion

Description

This is a GtkDrawingArea derived object that provides an easy way to show an ADG based canvas. The associated canvas can be set directly with the adg_gtk_area_new_with_canvas() constructor function or by using adg_gtk_area_set_canvas().

The default minimum size of this widget will depend on the canvas content. The global matrix of the AdgCanvas will be adjusted to expose the drawing in the proper position. The empty space around the drawing can be changed by setting the "top-margin", "right-margin", "bottom-margin" and "left-margin" properties or by using the equivalent setter methods.

The default implementation reacts to some mouse events: if you drag the mouse keeping the wheel pressed the canvas will be translated; if the mouse wheel is rotated the canvas will be scaled up or down (accordingly to the wheel direction) by the factor specified in the "factor" property.

Details

AdgGtkArea

typedef struct _AdgGtkArea AdgGtkArea;

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


adg_gtk_area_new ()

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

adg_gtk_area_new_with_canvas ()

GtkWidget *         adg_gtk_area_new_with_canvas        (AdgCanvas *canvas);

Creates a new AdgGtkArea and sets the "canvas" property to canvas.

canvas :

the AdgCanvas shown by this widget

Returns :

the newly created widget

adg_gtk_area_set_canvas ()

void                adg_gtk_area_set_canvas             (AdgGtkArea *area,
                                                         AdgCanvas *canvas);

Sets a new canvas on area. The old canvas, if presents, is unreferenced.

area :

an AdgGtkArea

canvas :

the new AdgCanvas

adg_gtk_area_get_canvas ()

AdgCanvas *         adg_gtk_area_get_canvas             (AdgGtkArea *area);

Gets the canvas associated to area.

area :

an AdgGtkArea

Returns :

the requested AdgCanvas object or NULL on errors

adg_gtk_area_set_factor ()

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.

area :

an AdgGtkArea

factor :

the new zoom factor

adg_gtk_area_get_factor ()

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 use 1/1.05).

area :

an AdgGtkArea

Returns :

the requested zoom factor or 0 on error

Property Details

The "canvas" property

  "canvas"                   AdgCanvas*            : Read / Write / Construct

The canvas to be shown.


The "factor" property

  "factor"                   gdouble               : Read / Write

The factor used in zooming in and out.

Allowed values: >= 1

Default value: 1.05

Signal Details

The "canvas-changed" signal

void                user_function                      (AdgGtkArea *area,
                                                        gpointer    user_data)      : Run Last / No Recursion

Emitted when the AdgGtkArea has a new canvas.

area :

an AdgGtkArea

user_data :

user data set when the signal handler was connected.
AdgGtkArea 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