GOffice.Canvas

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Scrollable Gtk.Scrollable GObject.GInterface->Gtk.Scrollable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned GOffice.Canvas GOffice.Canvas Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Layout Gtk.Layout Gtk.Container->Gtk.Layout Gtk.Layout->GOffice.Canvas Gtk.Scrollable->Gtk.Layout Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Layout (10), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Scrollable (9)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

c2w (x, y, x_, y_)

get_bounds (x0, y0, x1, y1)

get_cur_event ()

get_direction ()

get_document ()

get_grabbed_item ()

get_height ()

get_item_at (x, y)

get_pixels_per_unit ()

get_realized ()

get_root ()

get_scroll_position (x, y)

get_width ()

grab_item (item)

invalidate (x0, y0, x1, y1)

invalidate_region (item, region)

render (cr, x0, y0, x1, y1)

scroll_to (x, y)

set_direction (direction)

set_document (document)

set_pixels_per_unit (pixels_per_unit)

ungrab_item ()

w2c (x, y, x_, y_)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Gtk.Scrollable (1)

Properties

Inherited:

Gtk.Layout (2), Gtk.Container (3), Gtk.Widget (39), Gtk.Scrollable (4)

Child Properties

Inherited:

Gtk.Layout (2)

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name

Type

Access

Description

base

Gtk.Layout

r

cur_event

Gdk.Event

r

direction

GOffice.CanvasDirection

r

document

GOffice.Doc

r

grabbed_item

GOffice.CanvasItem

r

height

int

r

last_item

GOffice.CanvasItem

r

pixels_per_unit

float

r

priv

object

r

root

GOffice.CanvasGroup

r

scroll_x1

float

r

scroll_y1

float

r

width

int

r

Class Details

class GOffice.Canvas(**kwargs)
Bases:

Gtk.Layout

Abstract:

No

c2w(x, y, x_, y_)
Parameters:
  • x (int) – the horizontal position as a canvas coordinate.

  • y (int) – 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.

Retrieves the position in the widget given the canvas coordinates.

get_bounds(x0, y0, x1, y1)
Parameters:
get_cur_event()
Returns:

The Gdk.Event being processed.

Return type:

Gdk.Event

get_direction()
Returns:

the current canvas direction.

Return type:

GOffice.CanvasDirection

get_document()
Returns:

The GOffice.Doc associated with the GOffice.Canvas.

Return type:

GOffice.Doc

get_grabbed_item()
Returns:

The currently grabbed GOffice.CanvasItem.

Return type:

GOffice.CanvasItem

get_height()
Returns:

the height of the widget visible region.

Return type:

int

get_item_at(x, y)
Parameters:
  • x (float) – horizontal position

  • y (float) – vertical position

Returns:

the GOffice.CanvasItem displayed at (x,`y`) if any.

Return type:

GOffice.CanvasItem

get_pixels_per_unit()
Returns:

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

Return type:

float

get_realized()
Returns:

True if the canvas has been realized as a Gtk.Widget.

Return type:

bool

get_root()
Returns:

the top level item of self, always a GOffice.CanvasGroup.

Return type:

GOffice.CanvasGroup

get_scroll_position(x, y)
Parameters:
  • x (float) – where to store the horizontal position

  • y (float) – where to store the vertical position

Retrieves the origin of the visible region of the canvas.

get_width()
Returns:

the width of the widget visible region.

Return type:

int

grab_item(item)
Parameters:

item (GOffice.CanvasItem) – GOffice.CanvasItem

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

invalidate(x0, y0, x1, y1)
Parameters:
  • x0 (float) – minimum x coordinate of the invalidated region in canvas coordinates

  • y0 (float) – minimum y coordinate of the invalidated region in canvas coordinates

  • x1 (float) – maximum x coordinate of the invalidated region in canvas coordinates

  • y1 (float) – maximum y coordinate of the invalidated region in canvas coordinates

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

invalidate_region(item, region)
Parameters:

Invalidates a region of the canvas. Only item will be redrawn if the next draw event is called with a cairo contest clipped to region. Used in gnumeric for the walking ants cursor.

render(cr, x0, y0, x1, y1)
Parameters:
scroll_to(x, y)
Parameters:
  • x (float) – the horizontal position

  • y (float) – the vertical position

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

set_direction(direction)
Parameters:

direction (GOffice.CanvasDirection) – GOffice.CanvasDirection

Sets the direction used by the canvas.

set_document(document)
Parameters:

document (GOffice.Doc) – GOffice.Doc

Associates the GOffice.Doc with the GOffice.Canvas. This is needed to use images when filling styled items (see GOffice.CanvasStyledItem).

set_pixels_per_unit(pixels_per_unit)
Parameters:

pixels_per_unit (float) – the new scale

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

ungrab_item()

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

w2c(x, y, x_, y_)
Parameters:
  • x (float) – the horizontal position as a widget coordinate.

  • y (float) – 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.

Retrieves the canvas coordinates given the position in the widget.