GooCanvasGrid: GooCanvas Reference Manual

## GooCanvasGrid GooCanvasGrid — a grid item. |

## Functions

GooCanvasItem * | goo_canvas_grid_new ()

## Properties

char * | border-color | Write
GdkRGBA * | border-color-gdk-rgba | Read / Write
guint | border-color-rgba | Read / Write
GooCairoPattern * | border-pattern | Read / Write
GdkPixbuf * | border-pixbuf | Write
double | border-width | Read / Write
double | height | Read / Write
char * | horz-grid-line-color | Write
GdkRGBA * | horz-grid-line-color-gdk-rgba | Read / Write
guint | horz-grid-line-color-rgba | Read / Write
GooCairoPattern * | horz-grid-line-pattern | Read / Write
GdkPixbuf * | horz-grid-line-pixbuf | Write
double | horz-grid-line-width | Read / Write
gboolean | show-horz-grid-lines | Read / Write
gboolean | show-vert-grid-lines | Read / Write
char * | vert-grid-line-color | Write
GdkRGBA * | vert-grid-line-color-gdk-rgba | Read / Write
guint | vert-grid-line-color-rgba | Read / Write
GooCairoPattern * | vert-grid-line-pattern | Read / Write
GdkPixbuf * | vert-grid-line-pixbuf | Write
double | vert-grid-line-width | Read / Write
gboolean | vert-grid-lines-on-top | Read / Write
double | width | Read / Write
double | x | Read / Write
double | x-offset | Read / Write
double | x-step | Read / Write
double | y | Read / Write
double | y-offset | Read / Write
double | y-step | Read / Write

## Types and Values

struct | GooCanvasGrid

## Object Hierarchy

        GObject
        ╰── GooCanvasItemSimple
            ╰── GooCanvasGrid

## Implemented Interfaces

GooCanvasGrid implements GooCanvasItem.

## Description

GooCanvasGrid represents a grid item. A grid consists of a number of equally-spaced horizontal and vertical grid lines, plus an optional border.

It is a subclass of GooCanvasItemSimple and so inherits all of the style properties such as "stroke-color", "fill-color" and "line-width".

It also implements the GooCanvasItem interface, so you can use the GooCanvasItem functions such as `goo_canvas_item_raise()` and `goo_canvas_item_rotate()`.

To create a GooCanvasGrid use `goo_canvas_grid_new()`.

To get or set the properties of an existing GooCanvasGrid, use `g_object_get()` and `g_object_set()`.

The grid's position and size is specified with the “x”, “y”, “width” and “height” properties.

The “x-step” and “y-step” properties specify the distance between grid lines. The “x-offset” and “y-offset” properties specify the distance before the first grid lines.

The horizontal or vertical grid lines can be hidden using the “show-horz-grid-lines” and “show-vert-grid-lines” properties.

The width of the border can be set using the “border-width” property. The border is drawn outside the area specified with the “x”, “y”, “width” and “height” properties.

Other properties allow the colors and widths of the grid lines to be set. The grid line color and width properties override the standard “stroke-color” and “line-width” properties, enabling different styles for horizontal and vertical grid lines.

## Functions

### goo_canvas_grid_new ()

    GooCanvasItem *
    goo_canvas_grid_new (GooCanvasItem *parent,
                         gdouble x,
                         gdouble y,
                         gdouble width,
                         gdouble height,
                         gdouble x_step,
                         gdouble y_step,
                         gdouble x_offset,
                         gdouble y_offset,
                         ...);

Creates a new grid item.

Here's an example showing how to create a grid:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    GooCanvasItem *grid = goo_canvas_grid_new (mygroup, 100.0, 100.0, 400.0, 200.0,
                                               20.0, 20.0, 10.0, 10.0,
                                               "horz-grid-line-width", 4.0,
                                               "horz-grid-line-color", "yellow",
                                               "vert-grid-line-width", 2.0,
                                               "vert-grid-line-color", "red",
                                               "border-width", 3.0,
                                               "border-color", "white",
                                               "fill-color", "blue",
                                               NULL);

#### Parameters

parent | the parent item, or `NULL`. If a parent is specified, it will assume ownership of the item, and the item will automatically be freed when it is removed from the parent. Otherwise call `g_object_unref()` to free it. | [skip]
x | the x coordinate of the left of the grid. |
y | the y coordinate of the top of the grid. |
width | the width of the grid. |
height | the height of the grid. |
x_step | the distance between the vertical grid lines. |
y_step | the distance between the horizontal grid lines. |
x_offset | the distance before the first vertical grid line. |
y_offset | the distance before the first horizontal grid line. |
... | optional pairs of property names and values, and a terminating `NULL`. |

#### Returns

a new grid item.

[transfer full]

## Types and Values

### struct GooCanvasGrid

    struct GooCanvasGrid;

The GooCanvasGrid struct contains private data only.

## Property Details

### The `“border-color”` property

      “border-color”             char *

The color to use for the border.

Owner: GooCanvasGrid

Flags: Write

Default value: NULL

### The `“border-color-gdk-rgba”` property

      “border-color-gdk-rgba”    GdkRGBA *

The color to use for the border, specified as a GdkRGBA.

Owner: GooCanvasGrid

Flags: Read / Write

Since: 2.0.1

### The `“border-color-rgba”` property

      “border-color-rgba”        guint

The color to use for the border, specified as a 32-bit integer value.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: 0

### The `“border-pattern”` property

      “border-pattern”           GooCairoPattern *

The cairo pattern to paint the border with.

Owner: GooCanvasGrid

Flags: Read / Write

### The `“border-pixbuf”` property

      “border-pixbuf”            GdkPixbuf *

The pixbuf to use to draw the border.

Owner: GooCanvasGrid

Flags: Write

### The `“border-width”` property

      “border-width”             double

The width of the border around the grid.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: -1

### The `“height”` property

      “height”                   double

The height of the grid.

Owner: GooCanvasGrid

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“horz-grid-line-color”` property

      “horz-grid-line-color”     char *

The color to use for the horizontal grid lines.

Owner: GooCanvasGrid

Flags: Write

Default value: NULL

### The `“horz-grid-line-color-gdk-rgba”` property

      “horz-grid-line-color-gdk-rgba” GdkRGBA *

The color to use for the horizontal grid lines, specified as a GdkRGBA.

Owner: GooCanvasGrid

Flags: Read / Write

Since: 2.0.1

### The `“horz-grid-line-color-rgba”` property

      “horz-grid-line-color-rgba” guint

The color to use for the horizontal grid lines, specified as a 32-bit integer value.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: 0

### The `“horz-grid-line-pattern”` property

      “horz-grid-line-pattern”   GooCairoPattern *

The cairo pattern to paint the horizontal grid lines with.

Owner: GooCanvasGrid

Flags: Read / Write

### The `“horz-grid-line-pixbuf”` property

      “horz-grid-line-pixbuf”    GdkPixbuf *

The pixbuf to use to draw the horizontal grid lines.

Owner: GooCanvasGrid

Flags: Write

### The `“horz-grid-line-width”` property

      “horz-grid-line-width”     double

The width of the horizontal grid lines.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: -1

### The `“show-horz-grid-lines”` property

      “show-horz-grid-lines”     gboolean

If the horizontal grid lines are shown.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: TRUE

### The `“show-vert-grid-lines”` property

      “show-vert-grid-lines”     gboolean

If the vertical grid lines are shown.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: TRUE

### The `“vert-grid-line-color”` property

      “vert-grid-line-color”     char *

The color to use for the vertical grid lines.

Owner: GooCanvasGrid

Flags: Write

Default value: NULL

### The `“vert-grid-line-color-gdk-rgba”` property

      “vert-grid-line-color-gdk-rgba” GdkRGBA *

The color to use for the vertical grid lines, specified as a GdkRGBA.

Owner: GooCanvasGrid

Flags: Read / Write

Since: 2.0.1

### The `“vert-grid-line-color-rgba”` property

      “vert-grid-line-color-rgba” guint

The color to use for the vertical grid lines, specified as a 32-bit integer value.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: 0

### The `“vert-grid-line-pattern”` property

      “vert-grid-line-pattern”   GooCairoPattern *

The cairo pattern to paint the vertical grid lines with.

Owner: GooCanvasGrid

Flags: Read / Write

### The `“vert-grid-line-pixbuf”` property

      “vert-grid-line-pixbuf”    GdkPixbuf *

The pixbuf to use to draw the vertical grid lines.

Owner: GooCanvasGrid

Flags: Write

### The `“vert-grid-line-width”` property

      “vert-grid-line-width”     double

The width of the vertical grid lines.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: -1

### The `“vert-grid-lines-on-top”` property

      “vert-grid-lines-on-top”   gboolean

If the vertical grid lines are painted above the horizontal grid lines.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: FALSE

### The `“width”` property

      “width”                    double

The width of the grid.

Owner: GooCanvasGrid

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“x”` property

      “x”                        double

The x coordinate of the grid.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: 0

### The `“x-offset”` property

      “x-offset”                 double

The distance before the first vertical grid line.

Owner: GooCanvasGrid

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“x-step”` property

      “x-step”                   double

The distance between the vertical grid lines.

Owner: GooCanvasGrid

Flags: Read / Write

Allowed values: >= 0

Default value: 10

### The `“y”` property

      “y”                        double

The y coordinate of the grid.

Owner: GooCanvasGrid

Flags: Read / Write

Default value: 0

### The `“y-offset”` property

      “y-offset”                 double

The distance before the first horizontal grid line.

Owner: GooCanvasGrid

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“y-step”` property

      “y-step”                   double

The distance between the horizontal grid lines.

Owner: GooCanvasGrid

Flags: Read / Write

Allowed values: >= 0

Default value: 10