Synopsis

                    GocCanvas;
typedef             GocCanvasClass;
enum                GocDirection;
void                goc_canvas_c2w                      (GocCanvas *canvas,
                                                         double x,
                                                         double y,
                                                         int *x_,
                                                         int *y_);
void                goc_canvas_get_bounds               (GocCanvas *canvas,
                                                         double *x0,
                                                         double *y0,
                                                         double *x1,
                                                         double *y1);
GdkEvent *          goc_canvas_get_cur_event            (GocCanvas *canvas);
GocDirection        goc_canvas_get_direction            (GocCanvas *canvas);
GODoc *             goc_canvas_get_document             (GocCanvas *canvas);
GocItem *           goc_canvas_get_grabbed_item         (GocCanvas *canvas);
int                 goc_canvas_get_height               (GocCanvas *canvas);
GocItem *           goc_canvas_get_item_at              (GocCanvas *canvas,
                                                         double x,
                                                         double y);
double              goc_canvas_get_pixels_per_unit      (GocCanvas *canvas);
gboolean            goc_canvas_get_realized             (GocCanvas *canvas);
GocGroup *          goc_canvas_get_root                 (GocCanvas *canvas);
void                goc_canvas_get_scroll_position      (GocCanvas *canvas,
                                                         double *x,
                                                         double *y);
int                 goc_canvas_get_width                (GocCanvas *canvas);
void                goc_canvas_grab_item                (GocCanvas *canvas,
                                                         GocItem *item);
void                goc_canvas_invalidate               (GocCanvas *canvas,
                                                         double x0,
                                                         double y0,
                                                         double x1,
                                                         double y1);
void                goc_canvas_render                   (GocCanvas *canvas,
                                                         cairo_t *cr,
                                                         double x0,
                                                         double y0,
                                                         double x1,
                                                         double y1);
void                goc_canvas_scroll_to                (GocCanvas *canvas,
                                                         double x,
                                                         double y);
void                goc_canvas_set_direction            (GocCanvas *canvas,
                                                         GocDirection direction);
void                goc_canvas_set_document             (GocCanvas *canvas,
                                                         GODoc *document);
void                goc_canvas_set_pixels_per_unit      (GocCanvas *canvas,
                                                         double pixels_per_unit);
void                goc_canvas_ungrab_item              (GocCanvas *canvas);
void                goc_canvas_w2c                      (GocCanvas *canvas,
                                                         int x,
                                                         int y,
                                                         double *x_,
                                                         double *y_);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkWidget
               +----GtkContainer
                     +----GtkLayout
                           +----GocCanvas

Implemented Interfaces

GocCanvas implements AtkImplementorIface, GtkBuildable and GtkScrollable.

Description

The canvas widget used in gnumeric.

Details

GocCanvas

typedef struct _GocCanvas GocCanvas;


GocCanvasClass

typedef GtkLayoutClass GocCanvasClass;


enum GocDirection

typedef enum {
	GOC_DIRECTION_LTR,
	GOC_DIRECTION_RTL,
	GOC_DIRECTION_MAX
} GocDirection;

GOC_DIRECTION_LTR

Left to right direction

GOC_DIRECTION_RTL

Right to left direction

GOC_DIRECTION_MAX

First invalid value

goc_canvas_c2w ()

void                goc_canvas_c2w                      (GocCanvas *canvas,
                                                         double x,
                                                         double y,
                                                         int *x_,
                                                         int *y_);

Retrieves the position in the widget given the canvas coordinates.

canvas :

GocCanvas

x :

the horizontal position as a canvas coordinate.

y :

the vertical position as a canvas coordinate.

x_ :

where to store the horizontal position as a widget coordinate.

y_ :

where to store the vertical position as a widget coordinate.

goc_canvas_get_bounds ()

void                goc_canvas_get_bounds               (GocCanvas *canvas,
                                                         double *x0,
                                                         double *y0,
                                                         double *x1,
                                                         double *y1);


goc_canvas_get_cur_event ()

GdkEvent *          goc_canvas_get_cur_event            (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

The GdkEvent being processed. [transfer none]

goc_canvas_get_direction ()

GocDirection        goc_canvas_get_direction            (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

the current canvas direction.

goc_canvas_get_document ()

GODoc *             goc_canvas_get_document             (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

The GODoc associated with the GocCanvas. [transfer none]

goc_canvas_get_grabbed_item ()

GocItem *           goc_canvas_get_grabbed_item         (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

The currently grabbed GocItem. [transfer none]

goc_canvas_get_height ()

int                 goc_canvas_get_height               (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

the height of the widget visible region.

goc_canvas_get_item_at ()

GocItem *           goc_canvas_get_item_at              (GocCanvas *canvas,
                                                         double x,
                                                         double y);

canvas :

GocCanvas

x :

horizontal position

y :

vertical position

Returns :

the GocItem displayed at (x,y) if any. [transfer none]

goc_canvas_get_pixels_per_unit ()

double              goc_canvas_get_pixels_per_unit      (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

how many pixels are used for each unit when displaying the canvas.

goc_canvas_get_realized ()

gboolean            goc_canvas_get_realized             (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

TRUE if the canvas has been realized as a GtkWidget.

goc_canvas_get_root ()

GocGroup *          goc_canvas_get_root                 (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

the top level item of canvas, always a GocGroup. [transfer none]

goc_canvas_get_scroll_position ()

void                goc_canvas_get_scroll_position      (GocCanvas *canvas,
                                                         double *x,
                                                         double *y);

Retrieves the origin of the visible region of the canvas.

canvas :

GocCanvas

x :

where to store the horizontal position

y :

where to store the vertical position

goc_canvas_get_width ()

int                 goc_canvas_get_width                (GocCanvas *canvas);

canvas :

GocCanvas

Returns :

the width of the widget visible region. [transfer none]

goc_canvas_grab_item ()

void                goc_canvas_grab_item                (GocCanvas *canvas,
                                                         GocItem *item);

Grabs GocItem. All subsequent events will be passed to GocItem. This function fails if an item is already grabbed.

canvas :

GocCanvas

item :

GocItem

goc_canvas_invalidate ()

void                goc_canvas_invalidate               (GocCanvas *canvas,
                                                         double x0,
                                                         double y0,
                                                         double x1,
                                                         double y1);

Invalidates a region of the canvas. The canvas will be redrawn only if the invalidated region intersects the visible area.

canvas :

GocCanvas

x0 :

minimum x coordinate of the invalidated region in canvas coordinates

y0 :

minimum y coordinate of the invalidated region in canvas coordinates

x1 :

maximum x coordinate of the invalidated region in canvas coordinates

y1 :

maximum y coordinate of the invalidated region in canvas coordinates

goc_canvas_render ()

void                goc_canvas_render                   (GocCanvas *canvas,
                                                         cairo_t *cr,
                                                         double x0,
                                                         double y0,
                                                         double x1,
                                                         double y1);


goc_canvas_scroll_to ()

void                goc_canvas_scroll_to                (GocCanvas *canvas,
                                                         double x,
                                                         double y);

Scrolls the canvas so that the origin of the visible region is at (x,y). The origin position depends on the canvas direction (see GocDirection).

canvas :

GocCanvas

x :

the horizontal position

y :

the vertical position

goc_canvas_set_direction ()

void                goc_canvas_set_direction            (GocCanvas *canvas,
                                                         GocDirection direction);

Sets the direction used by the canvas.

canvas :

GocCanvas

direction :

GocDirection

goc_canvas_set_document ()

void                goc_canvas_set_document             (GocCanvas *canvas,
                                                         GODoc *document);

Associates the GODoc with the GocCanvas. This is needed to use images when filling styled items (see GocStyledItem).

canvas :

GocCanvas

document :

GODoc

goc_canvas_set_pixels_per_unit ()

void                goc_canvas_set_pixels_per_unit      (GocCanvas *canvas,
                                                         double pixels_per_unit);

Sets the scale as the number of pixels used for each unit when displaying the canvas.

canvas :

GocCanvas

pixels_per_unit :

the new scale

goc_canvas_ungrab_item ()

void                goc_canvas_ungrab_item              (GocCanvas *canvas);

Ungrabs the currently grabbed GocItem. This function fails if no item is grabbed.

canvas :

GocCanvas

goc_canvas_w2c ()

void                goc_canvas_w2c                      (GocCanvas *canvas,
                                                         int x,
                                                         int y,
                                                         double *x_,
                                                         double *y_);

Retrieves the canvas coordinates given the position in the widget.

canvas :

GocCanvas

x :

the horizontal position as a widget coordinate.

y :

the vertical position as a widget coordinate.

x_ :

where to store the horizontal position as a canvas coordinate.

y_ :

where to store the vertical position as a canvas coordinate.