Class: Gtk::CellArea

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

Instance Method Summary collapse

Instance Method Details

#activate(context, widget, cell_area, flags, edit_only) ⇒ TrueClass

Activates area, usually by activating the currently focused cell, however some subclasses which embed widgets in the area can also activate a widget if it currently has the focus.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext in context with the current row data

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering on

  • cell_area (Gdk::Rectangle)

    the size and location of area relative to widget’s allocation

  • flags (Gtk::CellRendererState)

    the Gtk::CellRendererState flags for area for this row of data.

  • edit_only (TrueClass)

    if true then only cell renderers that are %GTK_CELL_RENDERER_MODE_EDITABLE will be activated.

Returns:

  • (TrueClass)

    Whether area was successfully activated.

#activate_cell(widget, renderer, event, cell_area, flags) ⇒ TrueClass

This is used by Gtk::CellArea subclasses when handling events to activate cells, the base Gtk::CellArea class activates cells for keyboard events for free in its own GtkCellArea->activate() implementation.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering onto

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer in area to activate

  • event (Gdk::Event)

    the Gdk::Event for which cell activation should occur

  • cell_area (Gdk::Rectangle)

    the Gdk::Rectangle in widget relative coordinates of renderer for the current row.

  • flags (Gtk::CellRendererState)

    the Gtk::CellRendererState for renderer

Returns:

  • (TrueClass)

    whether cell activation was successful

#add(renderer) ⇒ nil

Adds renderer to area with the default child cell properties.

Parameters:

Returns:

  • (nil)

#add_focus_sibling(renderer, sibling) ⇒ nil

Adds sibling to renderer’s focusable area, focus will be drawn around renderer and all of its siblings if renderer can focus for a given row.

Events handled by focus siblings can also activate the given focusable renderer.

Parameters:

Returns:

  • (nil)

#add_with_properties(renderer, first_prop_name, array) ⇒ nil

Adds renderer to area, setting cell properties at the same time. See gtk_cell_area_add() and gtk_cell_area_cell_set() for more details.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer to be placed inside area

  • first_prop_name (String)

    the name of the first cell property to set

  • array (Array)

    a nil-terminated list of property names and values, starting with first_prop_name

Returns:

  • (nil)

#apply_attributes(tree_model, iter, is_expander, is_expanded) ⇒ nil

Applies any connected attributes to the renderers in area by pulling the values from tree_model.

Parameters:

  • tree_model (Gtk::TreeModel)

    the Gtk::TreeModel to pull values from

  • iter (Gtk::TreeIter)

    the Gtk::TreeIter in tree_model to apply values for

  • is_expander (TrueClass)

    whether iter has children

  • is_expanded (TrueClass)

    whether iter is expanded in the view and children are visible

Returns:

  • (nil)

#attribute_connect(renderer, attribute, column) ⇒ nil

Connects an attribute to apply values from column for the Gtk::TreeModel in use.

Parameters:

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer to connect an attribute for

  • attribute (String)

    the attribute name

  • column (Integer)

    the Gtk::TreeModel column to fetch attribute values from

Returns:

  • (nil)

#attribute_disconnect(renderer, attribute) ⇒ nil

Disconnects attribute for the renderer in area so that attribute will no longer be updated with values from the model.

Parameters:

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer to disconnect an attribute for

  • attribute (String)

    the attribute name

Returns:

  • (nil)

#attribute_get_column(renderer, attribute) ⇒ Integer

Returns the model column that an attribute has been mapped to, or -1 if the attribute is not mapped.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer

  • attribute (String)

    an attribute on the renderer

Returns:

  • (Integer)

    the model column, or -1

#cell_get(renderer, first_prop_name, array) ⇒ nil

Gets the values of one or more cell properties for renderer in area.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer which is inside area

  • first_prop_name (String)

    the name of the first cell property to get

  • array (Array)

    return location for the first cell property, followed optionally by more name/return location pairs, followed by nil

Returns:

  • (nil)

#cell_get_property(renderer, property_name, value) ⇒ nil

Gets the value of a cell property for renderer in area.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer inside area

  • property_name (String)

    the name of the property to get

  • value (GObject::Value)

    a location to return the value

Returns:

  • (nil)

#cell_get_valist(renderer, first_property_name, var_args) ⇒ nil

Gets the values of one or more cell properties for renderer in area.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer inside area

  • first_property_name (String)

    the name of the first property to get

  • var_args (Gtk::va_list)

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

Returns:

  • (nil)

#cell_set(renderer, first_prop_name, array) ⇒ nil

Sets one or more cell properties for cell in area.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer which is a cell inside area

  • first_prop_name (String)

    the name of the first cell property to set

  • array (Array)

    a nil-terminated list of property names and values, starting with first_prop_name

Returns:

  • (nil)

#cell_set_property(renderer, property_name, value) ⇒ nil

Sets a cell property for renderer in area.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer inside area

  • property_name (String)

    the name of the cell property to set

  • value (GObject::Value)

    the value to set the cell property to

Returns:

  • (nil)

#cell_set_valist(renderer, first_property_name, var_args) ⇒ nil

Sets one or more cell properties for renderer in area.

Parameters:

  • renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer which inside area

  • first_property_name (String)

    the name of the first cell property to set

  • var_args (Gtk::va_list)

    a nil-terminated list of property names and values, starting with first_prop_name

Returns:

  • (nil)

#copy_context(context) ⇒ Gtk::CellAreaContext

This is sometimes needed for cases where rows need to share alignments in one orientation but may be separately grouped in the opposing orientation.

For instance, Gtk::IconView creates all icons (rows) to have the same width and the cells theirin to have the same horizontal alignments. However each row of icons may have a separate collective height. Gtk::IconView uses this to request the heights of each row based on a context which was already used to request all the row widths that are to be displayed.

Parameters:

Returns:

#create_contextGtk::CellAreaContext

Creates a Gtk::CellAreaContext to be used with area for all purposes. Gtk::CellAreaContext stores geometry information for rows for which it was operated on, it is important to use the same context for the same row of data at all times (i.e. one should render and handle events with the same Gtk::CellAreaContext which was used to request the size of those rows of data).

Returns:

#current_path_stringString

Gets the current Gtk::TreePath string for the currently applied Gtk::TreeIter, this is implicitly updated when gtk_cell_area_apply_attributes() is called and can be used to interact with renderers from Gtk::CellArea subclasses. attributes applied to area. This string belongs to the area and should not be freed.

Returns:

  • (String)

    The current Gtk::TreePath string for the current

#edit_widgetGtk::CellEditable

The widget currently editing the edited cell

This property is read-only and only changes as a result of a call gtk_cell_area_activate_cell().

Returns:

#edit_widget=(edit_widget) ⇒ Gtk::CellEditable

The widget currently editing the edited cell

This property is read-only and only changes as a result of a call gtk_cell_area_activate_cell().

Parameters:

Returns:

#edited_cellGtk::CellRenderer

The cell in the area that is currently edited

This property is read-only and only changes as a result of a call gtk_cell_area_activate_cell().

Returns:

#edited_cell=(edited_cell) ⇒ Gtk::CellRenderer

The cell in the area that is currently edited

This property is read-only and only changes as a result of a call gtk_cell_area_activate_cell().

Parameters:

Returns:

#event(context, widget, event, cell_area, flags) ⇒ Integer

Delegates event handling to a Gtk::CellArea.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext for this row of data.

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering to

  • event (Gdk::Event)

    the Gdk::Event to handle

  • cell_area (Gdk::Rectangle)

    the widget relative coordinates for area

  • flags (Gtk::CellRendererState)

    the Gtk::CellRendererState for area in this row.

Returns:

  • (Integer)

    true if the event was handled by area.

#find_cell_property(property_name) ⇒ GObject::ParamSpec

Finds a cell property of a cell area class by name.

Parameters:

  • property_name (String)

    the name of the child property to find

Returns:

  • (GObject::ParamSpec)

    the GParam::Spec of the child property or nil if aclass has no child property with that name.

#focus(direction) ⇒ TrueClass

This should be called by the area’s owning layout widget when focus is to be passed to area, or moved within area for a given direction and row data.

Implementing Gtk::CellArea classes should implement this method to receive and navigate focus in its own way particular to how it lays out cells.

Parameters:

Returns:

  • (TrueClass)

    true if focus remains inside area as a result of this call.

#focus_cellGtk::CellRenderer

The cell in the area that currently has focus

Returns:

#focus_cell=(focus_cell) ⇒ Gtk::CellRenderer

The cell in the area that currently has focus

Parameters:

Returns:

#foreach(callback, callback_data) ⇒ nil

Calls callback for every Gtk::CellRenderer in area.

Parameters:

  • callback (Gtk::CellCallback)

    the Gtk::CellCallback to call

  • callback_data (GObject)

    user provided data pointer

Returns:

  • (nil)

#foreach_alloc(context, widget, cell_area, background_area, callback, callback_data) ⇒ nil

Calls callback for every Gtk::CellRenderer in area with the allocated rectangle inside cell_area.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext for this row of data.

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering to

  • cell_area (Gdk::Rectangle)

    the widget relative coordinates and size for area

  • background_area (Gdk::Rectangle)

    the widget relative coordinates of the background area

  • callback (Gtk::CellAllocCallback)

    the Gtk::CellAllocCallback to call

  • callback_data (GObject)

    user provided data pointer

Returns:

  • (nil)

#get_cell_allocation(context, widget, renderer, cell_area, allocation) ⇒ nil

Derives the allocation of renderer inside area if area were to be renderered in cell_area.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext used to hold sizes for area.

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering on

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer to get the allocation for

  • cell_area (Gdk::Rectangle)

    the whole allocated area for area in widget for this row

  • allocation (Gdk::Rectangle)

    where to store the allocation for renderer

Returns:

  • (nil)

#get_cell_at_position(context, widget, cell_area, x, y, alloc_area) ⇒ Gtk::CellRenderer

Gets the Gtk::CellRenderer at x and y coordinates inside area and optionally returns the full cell allocation for it inside cell_area.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext used to hold sizes for area.

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering on

  • cell_area (Gdk::Rectangle)

    the whole allocated area for area in widget for this row

  • x (Integer)

    the x position

  • y (Integer)

    the y position

  • alloc_area (Gdk::Rectangle)

    where to store the inner allocated area of the returned cell renderer, or nil.

Returns:

#get_focus_from_sibling(renderer) ⇒ Gtk::CellRenderer

Gets the Gtk::CellRenderer which is expected to be focusable for which renderer is, or may be a sibling.

This is handy for Gtk::CellArea subclasses when handling events, after determining the renderer at the event location it can then chose to activate the focus cell for which the event cell may have been a sibling.

Parameters:

Returns:

  • (Gtk::CellRenderer)

    the Gtk::CellRenderer for which renderer is a sibling, or nil.

#get_focus_siblings(renderer) ⇒ GLib::List

Gets the focus sibling cell renderers for renderer.

Parameters:

Returns:

  • (GLib::List)

    A #GList of Gtk::CellRenderers. The returned list is internal and should not be freed.

#get_preferred_height(context, widget, minimum_height, natural_height) ⇒ nil

Retrieves a cell area’s initial minimum and natural height.

area will store some geometrical information in context along the way; when requesting sizes over an arbitrary number of rows, it’s not important to check the minimum_height and natural_height of this call but rather to consult gtk_cell_area_context_get_preferred_height() after a series of requests.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext to perform this request with

  • widget (Gtk::Widget)

    the Gtk::Widget where area will be rendering

  • minimum_height (Integer)

    location to store the minimum height, or nil

  • natural_height (Integer)

    location to store the natural height, or nil

Returns:

  • (nil)

#get_preferred_height_for_width(context, widget, width, minimum_height, natural_height) ⇒ nil

Retrieves a cell area’s minimum and natural height if it would be given the specified width.

area stores some geometrical information in context along the way while calling gtk_cell_area_get_preferred_width(). It’s important to perform a series of gtk_cell_area_get_preferred_width() requests with context first and then call gtk_cell_area_get_preferred_height_for_width() on each cell area individually to get the height for width of each fully requested row.

If at some point, the width of a single row changes, it should be requested with gtk_cell_area_get_preferred_width() again and then the full width of the requested rows checked again with gtk_cell_area_context_get_preferred_width().

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext which has already been requested for widths.

  • widget (Gtk::Widget)

    the Gtk::Widget where area will be rendering

  • width (Integer)

    the width for which to check the height of this area

  • minimum_height (Integer)

    location to store the minimum height, or nil

  • natural_height (Integer)

    location to store the natural height, or nil

Returns:

  • (nil)

#get_preferred_width(context, widget, minimum_width, natural_width) ⇒ nil

Retrieves a cell area’s initial minimum and natural width.

area will store some geometrical information in context along the way; when requesting sizes over an arbitrary number of rows, it’s not important to check the minimum_width and natural_width of this call but rather to consult gtk_cell_area_context_get_preferred_width() after a series of requests.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext to perform this request with

  • widget (Gtk::Widget)

    the Gtk::Widget where area will be rendering

  • minimum_width (Integer)

    location to store the minimum width, or nil

  • natural_width (Integer)

    location to store the natural width, or nil

Returns:

  • (nil)

#get_preferred_width_for_height(context, widget, height, minimum_width, natural_width) ⇒ nil

Retrieves a cell area’s minimum and natural width if it would be given the specified height.

area stores some geometrical information in context along the way while calling gtk_cell_area_get_preferred_height(). It’s important to perform a series of gtk_cell_area_get_preferred_height() requests with context first and then call gtk_cell_area_get_preferred_width_for_height() on each cell area individually to get the height for width of each fully requested row.

If at some point, the height of a single row changes, it should be requested with gtk_cell_area_get_preferred_height() again and then the full height of the requested rows checked again with gtk_cell_area_context_get_preferred_height().

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext which has already been requested for widths.

  • widget (Gtk::Widget)

    the Gtk::Widget where area will be rendering

  • height (Integer)

    the height for which to check the width of this area

  • minimum_width (Integer)

    location to store the minimum width, or nil

  • natural_width (Integer)

    location to store the natural width, or nil

Returns:

  • (nil)

#has_renderer(renderer) ⇒ TrueClass

Checks if area contains renderer.

Parameters:

Returns:

  • (TrueClass)

    true if renderer is in the area.

#inner_cell_area(widget, cell_area, inner_area) ⇒ nil

This is a convenience function for Gtk::CellArea implementations to get the inner area where a given Gtk::CellRenderer will be rendered. It removes any padding previously added by gtk_cell_area_request_renderer().

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering onto

  • cell_area (Gdk::Rectangle)

    the widget relative coordinates where one of area’s cells is to be placed

  • inner_area (Gdk::Rectangle)

    the return location for the inner cell area

Returns:

  • (nil)

#install_cell_property(property_id, pspec) ⇒ nil

Installs a cell property on a cell area class.

Parameters:

  • property_id (Integer)

    the id for the property

  • pspec (GObject::ParamSpec)

    the GParam::Spec for the property

Returns:

  • (nil)

#is_activatableTrueClass

Returns whether the area can do anything when activated, after applying new attributes to area.

Returns:

  • (TrueClass)

    whether area can do anything when activated.

#is_focus_sibling(renderer, sibling) ⇒ TrueClass

Returns whether sibling is one of renderer’s focus siblings (see gtk_cell_area_add_focus_sibling()).

Parameters:

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer expected to have focus

  • sibling (Gtk::CellRenderer)

    the Gtk::CellRenderer to check against renderer’s sibling list

Returns:

  • (TrueClass)

    true if sibling is a focus sibling of renderer

#list_cell_properties(n_properties) ⇒ Array<GObject::ParamSpec>

Returns all cell properties of a cell area class.

Parameters:

  • n_properties (Integer)

    location to return the number of cell properties found

Returns:

  • (Array<GObject::ParamSpec>)

    a newly allocated nil-terminated array of GParam::Spec*. The array must be freed with g_free().

#remove(renderer) ⇒ nil

Removes renderer from area.

Parameters:

Returns:

  • (nil)

#remove_focus_sibling(renderer, sibling) ⇒ nil

Removes sibling from renderer’s focus sibling list (see gtk_cell_area_add_focus_sibling()).

Parameters:

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer expected to have focus

  • sibling (Gtk::CellRenderer)

    the Gtk::CellRenderer to remove from renderer’s focus area

Returns:

  • (nil)

#render(context, widget, cr, background_area, cell_area, flags, paint_focus) ⇒ nil

Renders area’s cells according to area’s layout onto widget at the given coordinates.

Parameters:

  • context (Gtk::CellAreaContext)

    the Gtk::CellAreaContext for this row of data.

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering to

  • cr (cairo::Context)

    the #cairo_t to render with

  • background_area (Gdk::Rectangle)

    the widget relative coordinates for area’s background

  • cell_area (Gdk::Rectangle)

    the widget relative coordinates for area

  • flags (Gtk::CellRendererState)

    the Gtk::CellRendererState for area in this row.

  • paint_focus (TrueClass)

    whether area should paint focus on focused cells for focused rows or not.

Returns:

  • (nil)

#request_modeGtk::SizeRequestMode

Gets whether the area prefers a height-for-width layout or a width-for-height layout.

Returns:

#request_renderer(renderer, orientation, widget, for_size, minimum_size, natural_size) ⇒ nil

This is a convenience function for Gtk::CellArea implementations to request size for cell renderers. It’s important to use this function to request size and then use gtk_cell_area_inner_cell_area() at render and event time since this function will add padding around the cell for focus painting. the base request for the orientation is to be returned.

Parameters:

  • renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer to request size for

  • orientation (Gtk::Orientation)

    the Gtk::Orientation in which to request size

  • widget (Gtk::Widget)

    the Gtk::Widget that area is rendering onto

  • for_size (Integer)

    the allocation contextual size to request for, or -1 if

  • minimum_size (Integer)

    location to store the minimum size, or nil

  • natural_size (Integer)

    location to store the natural size, or nil

Returns:

  • (nil)

#stop_editing(canceled) ⇒ nil

Explicitly stops the editing of the currently edited cell.

If canceled is true, the currently edited cell renderer will emit the ::editing-canceled signal, otherwise the the ::editing-done signal will be emitted on the current edit widget.

See gtk_cell_area_get_edited_cell() and gtk_cell_area_get_edit_widget().

Parameters:

  • canceled (TrueClass)

    whether editing was canceled.

Returns:

  • (nil)