GOffice.CanvasItem

g GObject.Object GObject.Object GOffice.CanvasItem GOffice.CanvasItem GObject.Object->GOffice.CanvasItem

Subclasses:

GOffice.CanvasComponent, GOffice.CanvasGraph, GOffice.CanvasGroup, GOffice.CanvasImage, GOffice.CanvasPixbuf, GOffice.CanvasStyledItem, GOffice.CanvasWidget

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

bounds_changed ()

copy (source)

destroy ()

distance (x, y, near_item)

draw (cr)

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

duplicate (parent)

get_bounds (x0, y0, x1, y1)

get_parent ()

get_style_context ()

get_window ()

grab ()

hide ()

invalidate ()

is_visible ()

lower (n)

lower_to_bottom ()

raise_ (n)

raise_to_top ()

set_visible (visible)

show ()

ungrab ()

Virtual Methods

Inherited:

GObject.Object (7)

do_button2_pressed (button, x, y)

do_button_pressed (button, x, y)

do_button_released (button, x, y)

do_copy (dest)

do_distance (x, y, near_item)

do_draw (cr)

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

do_enter_notify (x, y)

do_get_window ()

do_key_pressed (ev)

do_key_released (ev)

do_leave_notify (x, y)

do_motion (x, y)

do_notify_scrolled ()

do_realize ()

do_unrealize ()

do_update_bounds ()

Properties

Name

Type

Flags

Short Description

canvas

GOffice.Canvas

r

The canvas object on which the item resides

parent

GOffice.CanvasGroup

r

The group in which the item resides

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

base

GObject.Object

r

cached_bounds

bool

r

canvas

GOffice.Canvas

r

op

cairo.Operator

r

parent

GOffice.CanvasGroup

r

priv

object

r

realized

bool

r

transform

cairo.Matrix

r

transformed

bool

r

visible

bool

r

x0

float

r

x1

float

r

y0

float

r

y1

float

r

Class Details

class GOffice.CanvasItem(**kwargs)
Bases:

GObject.Object

Abstract:

Yes

Structure:

GOffice.CanvasItemClass

bounds_changed()

This function needs to be called each time the bounds of self change. It is normally called from inside the implementation of items derived classes.

copy(source)
Parameters:

source (GOffice.CanvasItem) – GOffice.CanvasItem

Copies source properties to self. The two items must be of the same type and their common class needs a copy member.

destroy()

Destroys self, removes it from its parent group and updates the canvas accordingly.

distance(x, y, near_item)
Parameters:
Returns:

the evaluated distance.

Return type:

float

Evaluates the distance between the point with canvas coordinates x,`y` and the nearest point of self. near_item is set with either self or its appropriate child.

draw(cr)
Parameters:

cr (cairo.Context) – cairo.Context

Renders self using cr. There is no need to call this function directly. Invalidating the item is the way to go.

draw_region(cr, x0, y0, x1, y1)
Parameters:
  • cr (cairo.Context) – cairo.Context

  • x0 (float) – the lowest horizontal bound of the region to draw

  • y0 (float) – the lowest vertical bound of the region to draw

  • x1 (float) – the highest horizontal bound of the region to draw

  • y1 (float) – the highest vertical bound of the region to draw

Returns:

True if successful.

Return type:

bool

Renders self using cr, limiting all drawings to the region limited by x0, y0, x1, and y1. If this function returns False, GOffice.CanvasItem.draw should be called. There is no need to call this function directly. Invalidating the item is the way to go.

duplicate(parent)
Parameters:

parent (GOffice.CanvasGroup) – GOffice.CanvasGroup

Returns:

The duplicated item or None if the duplication was not possible.

Return type:

GOffice.CanvasItem

Creates a new GOffice.CanvasItem identical to self inside the parent GOffice.CanvasGroup if not None.

get_bounds(x0, y0, x1, y1)
Parameters:
  • x0 (float) – where to store the lowest horizontal bound

  • y0 (float) – where to store the lowest vertical bound

  • x1 (float) – where to store the highest horizontal bound

  • y1 (float) – where to store the highest vertical bound

Retrieves the bounds of self in canvas coordinates.

get_parent()
Returns:

The item parent GOffice.CanvasGroup.

Return type:

GOffice.CanvasGroup

get_style_context()
Returns:

The style context to use for the item.

Return type:

Gtk.StyleContext

get_window()
Returns:

The Gdk.Window associated with the item if any or None. Only GOffice.CanvasWidget owns a Gdk.Window.

Return type:

Gdk.Window

grab()

Grabs the item. This function will fail if another item is grabbed.

hide()

Hides self.

invalidate()

Force a redraw of self bounding region.

is_visible()
Returns:

True if self is visible.

Return type:

bool

lower(n)
Parameters:

n (int) – the rank change

Lowers self by n steps inside its parent GOffice.CanvasGroup (or less if the list is too short) in the item list so that it is displayed more deeply in the items stack.

lower_to_bottom()

Lowers self to bottom inside its parent GOffice.CanvasGroup so that it will be at least partly hidden by any overlapping item.

raise_(n)
Parameters:

n (int) – the rank change

Raises self by n steps inside its parent GOffice.CanvasGroup (or less if the list is too short) in the item list so that it is displayed nearer the top of the items stack.

raise_to_top()

Raises self to front so that it becomes the toplevel item inside its parent GOffice.CanvasGroup.

set_visible(visible)
Parameters:

visible (bool) – whether the item should be visible

Either hides or shows self as appropriate..

show()

Makes self visible.

ungrab()

Ungrabs the item. This function will fail if self is not grabbed.

do_button2_pressed(button, x, y) virtual
Parameters:
Return type:

bool

do_button_pressed(button, x, y) virtual
Parameters:
Return type:

bool

do_button_released(button, x, y) virtual
Parameters:
Return type:

bool

do_copy(dest) virtual
Parameters:

dest (GOffice.CanvasItem) – GOffice.CanvasItem

Copies source properties to dest. The two items must be of the same type and their common class needs a copy member.

do_distance(x, y, near_item) virtual
Parameters:
Returns:

the evaluated distance.

Return type:

float

Evaluates the distance between the point with canvas coordinates x,`y` and the nearest point of item. near_item is set with either item or its appropriate child.

do_draw(cr) virtual
Parameters:

cr (cairo.Context) – cairo.Context

Renders item using cr. There is no need to call this function directly. Invalidating the item is the way to go.

do_draw_region(cr, x0, y0, x1, y1) virtual
Parameters:
  • cr (cairo.Context) – cairo.Context

  • x0 (float) – the lowest horizontal bound of the region to draw

  • y0 (float) – the lowest vertical bound of the region to draw

  • x1 (float) – the highest horizontal bound of the region to draw

  • y1 (float) – the highest vertical bound of the region to draw

Returns:

True if successful.

Return type:

bool

Renders item using cr, limiting all drawings to the region limited by x0, y0, x1, and y1. If this function returns False, GOffice.CanvasItem.draw should be called. There is no need to call this function directly. Invalidating the item is the way to go.

do_enter_notify(x, y) virtual
Parameters:
Return type:

bool

do_get_window() virtual
Returns:

The Gdk.Window associated with the item if any or None. Only GOffice.CanvasWidget owns a Gdk.Window.

Return type:

Gdk.Window

do_key_pressed(ev) virtual
Parameters:

ev (Gdk.EventKey) –

Return type:

bool

do_key_released(ev) virtual
Parameters:

ev (Gdk.EventKey) –

Return type:

bool

do_leave_notify(x, y) virtual
Parameters:
Return type:

bool

do_motion(x, y) virtual
Parameters:
Return type:

bool

do_notify_scrolled() virtual
do_realize() virtual
do_unrealize() virtual
do_update_bounds() virtual

Property Details

GOffice.CanvasItem.props.canvas
Name:

canvas

Type:

GOffice.Canvas

Default Value:

None

Flags:

READABLE

The canvas object on which the item resides

GOffice.CanvasItem.props.parent
Name:

parent

Type:

GOffice.CanvasGroup

Default Value:

None

Flags:

READABLE

The group in which the item resides