Class: GOffice::CanvasItem

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

The base class for all canvas items.

Instance Method Summary collapse

Constructor Details

#initialize(parent, type, first_arg_name, array) ⇒ GOffice::CanvasItem

Creates a new item of type type in group group. Properties can be set just the same way they are in #g_object_new.

Parameters:

  • parent (GOffice::CanvasGroup)

    parent Goc::Group for the new item

  • type (GLib::Type)

    #GType of the new item

  • first_arg_name (String)

    property name or nil

  • array (Array)

    value for the first property, followed optionally by more name/value pairs, followed by nil

Instance Method Details

#bounds_changednil

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

Returns:

  • (nil)

#canvasGOffice::Canvas

Returns canvas.

Returns:

#canvas=(canvas) ⇒ GOffice::Canvas

Parameters:

Returns:

#copy(source) ⇒ nil

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

Parameters:

Returns:

  • (nil)

#destroynil

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

Returns:

  • (nil)

#distance(x, y, near_item) ⇒ 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.

Parameters:

  • x (Float)

    horizontal position

  • y (Float)

    vertical position

  • near_item (GOffice::CanvasItem)

    where to store the nearest item

Returns:

  • (Float)

    the evaluated distance.

#draw(cr) ⇒ nil

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

Parameters:

  • cr (cairo::Context)

    #cairo_t

Returns:

  • (nil)

#draw_region(cr, x0, y0, x1, y1) ⇒ Boolean

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

Parameters:

  • cr (cairo::Context)

    #cairo_t

  • 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:

  • (Boolean)

    true if successful.

#duplicate(parent) ⇒ GOffice::CanvasItem

Creates a new GocItem identical to item inside the parent GocGroup if not NULL. not possible.

Parameters:

Returns:

#get_bounds(x0, y0, x1, y1) ⇒ nil

Retrieves the bounds of item in canvas coordinates.

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

Returns:

  • (nil)

#grabnil

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

Returns:

  • (nil)

#hidenil

Hides item.

Returns:

  • (nil)

#invalidatenil

Force a redraw of item bounding region.

Returns:

  • (nil)

#is_visibleBoolean

Returns true if item is visible.

Returns:

  • (Boolean)

    true if item is visible.

#lower(n) ⇒ nil

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

Parameters:

  • n (Integer)

    the rank change

Returns:

  • (nil)

#lower_to_bottomnil

Lowers item to bottom inside its parent Goc::Group so that it will be at least partly hidden by any overlapping item.

Returns:

  • (nil)

#operatorcairo::Operator

Returns the operator used when drawing the item.

Returns:

  • (cairo::Operator)

    the operator used when drawing the item.

#operator=(op) ⇒ nil

Set the operator used when drawing the item.

Parameters:

  • op (cairo::Operator)

    #cairo_operator_t

Returns:

  • (nil)

#parentGOffice::CanvasGroup

Returns parent.

Returns:

#parent=(parent) ⇒ GOffice::CanvasGroup

Parameters:

Returns:

#raise(n) ⇒ nil

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

Parameters:

  • n (Integer)

    the rank change

Returns:

  • (nil)

#raise_to_topnil

Raises item to front so that it becomes the toplevel item inside its parent Goc::Group.

Returns:

  • (nil)

#set(first_arg_name, array) ⇒ nil

Set properties and updates the canvas. Using #g_object_set instead would set the properties, but not update the canvas.

Parameters:

  • first_arg_name (String)

    property name or nil

  • array (Array)

    value for the first property, followed optionally by more name/value pairs, followed by nil

Returns:

  • (nil)

#shownil

Makes item visible.

Returns:

  • (nil)

#style_contextGtk::StyleContext

Returns The style context to use for the item.

Returns:

  • (Gtk::StyleContext)

    The style context to use for the item.

#transform=(m) ⇒ nil

Set the matrix used to transform the item.

Parameters:

  • m (cairo::Matrix)

    #cairo_matrix_t

Returns:

  • (nil)

#ungrabnil

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

Returns:

  • (nil)

#visible=(visible) ⇒ nil

Either hides or shows item as appropriate..

Parameters:

  • visible (Boolean)

    whether the item should be visible

Returns:

  • (nil)

#windowGdk::Window

NULL. Only Goc::Widget owns a #GdkWindow.

Returns:

  • (Gdk::Window)

    The Gdk::Window associated with the item if any or