GOffice.CanvasItem¶
- Subclasses:
GOffice.CanvasComponent
,GOffice.CanvasGraph
,GOffice.CanvasGroup
,GOffice.CanvasImage
,GOffice.CanvasPixbuf
,GOffice.CanvasStyledItem
,GOffice.CanvasWidget
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
The canvas object on which the item resides |
||
r |
The group in which the item resides |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
base |
r |
||
cached_bounds |
r |
||
canvas |
r |
||
op |
r |
||
parent |
r |
||
priv |
r |
||
realized |
r |
||
transform |
r |
||
transformed |
r |
||
visible |
r |
||
x0 |
r |
||
x1 |
r |
||
y0 |
r |
||
y1 |
r |
Class Details¶
- class GOffice.CanvasItem(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
- 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:
x (
float
) – horizontal positiony (
float
) – vertical positionnear_item (
GOffice.CanvasItem
) – where to store the nearest item
- Returns:
the evaluated distance.
- Return type:
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 drawy0 (
float
) – the lowest vertical bound of the region to drawx1 (
float
) – the highest horizontal bound of the region to drawy1 (
float
) – the highest vertical bound of the region to draw
- Returns:
True
if successful.- Return type:
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:
Creates a new
GOffice.CanvasItem
identical to self inside the parentGOffice.CanvasGroup
if notNone
.
- get_bounds(x0, y0, x1, y1)¶
- Parameters:
Retrieves the bounds of self in canvas coordinates.
- get_parent()¶
- Returns:
The item parent
GOffice.CanvasGroup
.- Return type:
- get_style_context()¶
- Returns:
The style context to use for the item.
- Return type:
- get_window()¶
- Returns:
The
Gdk.Window
associated with the item if any orNone
. OnlyGOffice.CanvasWidget
owns aGdk.Window
.- Return type:
- grab()¶
Grabs the item. This function will fail if another item is grabbed.
- hide()¶
Hides self.
- invalidate()¶
Force a redraw of self bounding region.
- 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¶
- do_button_pressed(button, x, y) virtual¶
- do_button_released(button, x, y) virtual¶
- 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:
x (
float
) – horizontal positiony (
float
) – vertical positionnear_item (
GOffice.CanvasItem
) – where to store the nearest item
- Returns:
the evaluated distance.
- Return type:
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 drawy0 (
float
) – the lowest vertical bound of the region to drawx1 (
float
) – the highest horizontal bound of the region to drawy1 (
float
) – the highest vertical bound of the region to draw
- Returns:
True
if successful.- Return type:
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_get_window() virtual¶
- Returns:
The
Gdk.Window
associated with the item if any orNone
. OnlyGOffice.CanvasWidget
owns aGdk.Window
.- Return type:
- do_key_pressed(ev) virtual¶
- Parameters:
ev (
Gdk.EventKey
) –- Return type:
- do_key_released(ev) virtual¶
- Parameters:
ev (
Gdk.EventKey
) –- Return type:
- do_notify_scrolled() virtual¶
- do_realize() virtual¶
- do_unrealize() virtual¶
- do_update_bounds() virtual¶
Property Details¶
- GOffice.CanvasItem.props.canvas¶
- Name:
canvas
- Type:
- Default Value:
- Flags:
The canvas object on which the item resides
- GOffice.CanvasItem.props.parent¶
- Name:
parent
- Type:
- Default Value:
- Flags:
The group in which the item resides