## 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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.6002972,"math_prob":0.55548286,"size":6196,"snap":"2021-21-2021-25","text_gpt3_token_len":1662,"char_repetition_ratio":0.31669897,"word_repetition_ratio":0.39646465,"special_character_ratio":0.24483538,"punctuation_ratio":0.1779661,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.960815,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-16T22:46:03Z\",\"WARC-Record-ID\":\"<urn:uuid:7ba66f02-eda9-438d-aec9-d9a03566240c>\",\"Content-Length\":\"93301\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:50dce59a-dfc4-4d54-b44e-f5840fb73e41>\",\"WARC-Concurrent-To\":\"<urn:uuid:d5b62a2f-59a3-4fee-90b2-b3c9ac941284>\",\"WARC-IP-Address\":\"46.231.30.184\",\"WARC-Target-URI\":\"http://gtkdoc.entidi.com/goffice/GocCanvas.html\",\"WARC-Payload-Digest\":\"sha1:SU52SDTEX2IGCRI66HFJQP5SXUWRUMTF\",\"WARC-Block-Digest\":\"sha1:EJUHIZERGQHF44GS7NGWEOFTOZHV7VW3\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243989914.60_warc_CC-MAIN-20210516201947-20210516231947-00488.warc.gz\"}"}