goocanvas.ItemView — The interface for views of canvas items.
class goocanvas.ItemView(gobject.GInterface): |
|
"button-press-event" | def callback( |
"button-release-event" | def callback( |
"enter-notify-event" | def callback( |
"focus-in-event" | def callback( |
"focus-out-event" | def callback( |
"grab-broken-event" | def callback( |
"key-press-event" | def callback( |
"key-release-event" | def callback( |
"leave-notify-event" | def callback( |
"motion-notify-event" | def callback( |
goocanvas.ItemView
is implementated by
goocanvas.RectView
goocanvas.EllipseView
goocanvas.PathView
goocanvas.PolylineView
goocanvas.TextView
goocanvas.ImageView
goocanvas.GroupView
goocanvas.ItemViewSimple
goocanvas.ItemView
defines the interface that item views must implement, and contains methods for operating on item views.
def ensure_updated()
Updates the canvas immediately, if an update is scheduled. This ensures that all item bounds are up-to-date.
def find_child(child
)
child : | A child view. |
Returns: | The index of the given child item view. |
Gets the index of the child item view, counting from 0.
def get_bounds(bounds
)
bounds : | A GooCanvasBounds to return the bounds in. |
Gets the bounds of the item view. Note that the bounds includes the entire fill and stroke extents of the item view, whether they are painted or not.
def get_canvas_view()
Returns: | The GooCanvasView. |
Returns the GooCanvasView containing the given GooCanvasItemView.
def get_child(child_num
)
child_num : | The index of the child within the view, counting from 0. |
Returns: | The child at the given index. |
Returns the child view at the given index, or NULL if the item has no children or the index is out of range.
def get_combined_transform(result
)
result : | the matrix to store the resulting transform in. |
Returns: | True if there is a transformation. |
Gets the total transformation matrix of an item view, which is a combination of the item's transformation and the item view's transformation.
def get_item()
Returns: | The GooCanvasItem that the view is displaying. |
Returns the item the view is displaying.
def get_item_view_at(x
, y
, cr
, is_pointer_event
, parent_is_visible
)
x : | the x coordinate of the point. |
y : | the y coordinate of the point. |
cr : | a cairo contect. |
is_pointer_event : | True if the "pointer-events" properties of items should be used to determine which parts of the item are tested. |
parent_is_visible : | True if the parent item view is visible (which implies that all ancestors are also visible). |
Returns: | The item view found at the given point, or NULL if no item view was found. |
Gets the item view at the given point.
def get_n_children()
Returns: | The number of children of the GooCanvasItemView, or 0 if the view is not a container. |
Returns the number of children of the given GooCanvasItemView.
def get_parent_view()
Returns: | The parent view of the item. |
Returns the parent view of the given GooCanvasItemView.
def get_transform()
Returns: | The item view's transformation matrix. |
Gets the transformation matrix of an item view.
def is_container()
Returns: | True if the item view is a container. |
Returns True
if the given GooCanvasItemView is a container, i.e. it may contain children;
def is_visible()
Returns: | True if the item is visible. |
Checks if the item is visible. This entails checking the item's own visibility setting, as well as those of its ancestors. Note that this the item may be scrolled off the screen and so may not be actually visible to the user.
def paint(cr
, bounds
, scale
)
cr : | a cairo context. |
bounds : | the bounds that need to be repainted. |
scale : | the scale to use to determine whether an item should be painted. See GooCanvasItem |
Paints the item view and all children if they intersect the given bounds. Note that the scale argument may be different to the current scale in the GooCanvasView, e.g. when the canvas is being printed.
def request_update()
Requests that an update of the item is scheduled. It will be performed as soon as the application is idle, and before the canvas is redrawn.
def set_parent_view(parent_view
)
parent_view : | the parent view. |
Sets the parent view of the given GooCanvasItemView
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data, with coordinates translated to canvas coordinates. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'button-press-event" signal is emitted when a mouse button is pressed in an item view.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data, with coordinates translated to canvas coordinates. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'button-release-event" signal is emitted when a mouse button is released in an item view.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data, with coordinates translated to canvas coordinates. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'enter-notify-event" signal is emitted when the mouse enters an item view.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'focus-in-event" signal is emitted when the item receives the keyboard focus.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'focus-out-event" signal is emitted when the item loses the keyboard focus.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'grab-broken-event" signal is emitted when the item view's keyboard or pointer grab was lost unexpectedly.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'key-press-event" signal is emitted when a key is pressed and the item view has the keyboard focus.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'key-release-event" signal is emitted when a key is released and the item view has the keyboard focus.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data, with coordinates translated to canvas coordinates. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'leave-notify-event" signal is emitted when the mouse leaves an item view.
def callback(view
, target_view
, event
, user_param
, ...
)
view : | the item view that received the signal. |
target_view : | the target of the event. |
event : | the event data, with coordinates translated to canvas coordinates. |
user_param : | the first user parameter (if any) specified
with the connect () method
|
... : | additional user parameters (if any) |
Returns: | True to stop the signal emission, or False to let it continue. |
The 'motion-notify-event" signal is emitted when the mouse moves within an item view.