Class: Gtk::CellArea

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

Direct Known Subclasses

CellAreaBox

Instance Method Summary collapse

Instance Method Details

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

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 GtkCellAreaContext in context with the current row data

  • widget (Gtk::Widget)

    the GtkWidget that area is rendering on

  • cell_area (Gdk::Rectangle)

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

  • flags (Gtk::CellRendererState)

    the GtkCellRendererState flags for area for this row of data.

  • edit_only (Boolean)

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

Returns:

  • (Boolean)

    Whether area was successfully activated.

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

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

Parameters:

  • widget (Gtk::Widget)

    the GtkWidget that area is rendering onto

  • renderer (Gtk::CellRenderer)

    the GtkCellRenderer in area to activate

  • event (Gdk::Event)

    the GdkEvent for which cell activation should occur

  • cell_area (Gdk::Rectangle)

    the GdkRectangle in widget relative coordinates of renderer for the current row.

  • flags (Gtk::CellRendererState)

    the GtkCellRendererState for renderer

Returns:

  • (Boolean)

    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 GtkCellRenderer 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 GtkTreeModel to pull values from

  • iter (Gtk::TreeIter)

    the GtkTreeIter in tree_model to apply values for

  • is_expander (Boolean)

    whether iter has children

  • is_expanded (Boolean)

    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 GtkTreeModel in use.

Parameters:

  • renderer (Gtk::CellRenderer)

    the GtkCellRenderer to connect an attribute for

  • attribute (String)

    the attribute name

  • column (Integer)

    the GtkTreeModel 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 GtkCellRenderer 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 GtkCellRenderer

  • 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 GtkCellRenderer 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 GtkCellRenderer 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 GtkCellRenderer 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 GtkCellRenderer 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 GtkCellRenderer 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 GtkCellRenderer 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, GtkIconView 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. GtkIconView 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 GtkCellAreaContext to be used with area for all purposes. GtkCellAreaContext 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 GtkCellAreaContext which was used to request the size of those rows of data).

Returns:

#current_path_stringString

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

Returns:

  • (String)

    The current GtkTreePath 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 GtkCellArea.

Parameters:

  • context (Gtk::CellAreaContext)

    the GtkCellAreaContext for this row of data.

  • widget (Gtk::Widget)

    the GtkWidget that area is rendering to

  • event (Gdk::Event)

    the GdkEvent to handle

  • cell_area (Gdk::Rectangle)

    the widget relative coordinates for area

  • flags (Gtk::CellRendererState)

    the GtkCellRendererState 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 GParamSpec of the child property

#focus(direction) ⇒ Boolean

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 GtkCellArea classes should implement this method to receive and navigate focus in its own way particular to how it lays out cells.

Parameters:

Returns:

  • (Boolean)

    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 GtkCellRenderer in area.

Parameters:

  • callback (Gtk::CellCallback)

    the GtkCellCallback 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 GtkCellRenderer in area with the allocated rectangle inside cell_area.

Parameters:

  • context (Gtk::CellAreaContext)

    the GtkCellAreaContext for this row of data.

  • widget (Gtk::Widget)

    the GtkWidget 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 GtkCellAllocCallback 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 rendered in cell_area.

Parameters:

  • context (Gtk::CellAreaContext)

    the GtkCellAreaContext used to hold sizes for area.

  • widget (Gtk::Widget)

    the GtkWidget that area is rendering on

  • renderer (Gtk::CellRenderer)

    the GtkCellRenderer 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 GtkCellRenderer at x and y coordinates inside area and optionally returns the full cell allocation for it inside cell_area.

Parameters:

  • context (Gtk::CellAreaContext)

    the GtkCellAreaContext used to hold sizes for area.

  • widget (Gtk::Widget)

    the GtkWidget 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

Returns:

#get_focus_from_sibling(renderer) ⇒ Gtk::CellRenderer

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

This is handy for GtkCellArea 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:

#get_focus_siblings(renderer) ⇒ GLib::List<Gtk::CellRenderer>

Gets the focus sibling cell renderers for renderer.

Parameters:

Returns:

  • (GLib::List<Gtk::CellRenderer>)

    A GList of GtkCellRenderers. 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 GtkCellAreaContext to perform this request with

  • widget (Gtk::Widget)

    the GtkWidget where area will be rendering

  • minimum_height (Integer)

    location to store the minimum height

  • natural_height (Integer)

    location to store the natural height

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 GtkCellAreaContext which has already been requested for widths.

  • widget (Gtk::Widget)

    the GtkWidget 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

  • natural_height (Integer)

    location to store the natural height

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 GtkCellAreaContext to perform this request with

  • widget (Gtk::Widget)

    the GtkWidget where area will be rendering

  • minimum_width (Integer)

    location to store the minimum width

  • natural_width (Integer)

    location to store the natural width

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 GtkCellAreaContext which has already been requested for widths.

  • widget (Gtk::Widget)

    the GtkWidget 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

  • natural_width (Integer)

    location to store the natural width

Returns:

  • (nil)

#has_renderer(renderer) ⇒ Boolean

Checks if area contains renderer.

Parameters:

Returns:

  • (Boolean)

    true if renderer is in the area.

#inner_cell_area(widget, cell_area, inner_area) ⇒ nil

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

Parameters:

  • widget (Gtk::Widget)

    the GtkWidget 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 GParamSpec for the property

Returns:

  • (nil)

#is_activatableBoolean

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

Returns:

  • (Boolean)

    whether area can do anything when activated.

#is_focus_sibling(renderer, sibling) ⇒ Boolean

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

Parameters:

  • renderer (Gtk::CellRenderer)

    the GtkCellRenderer expected to have focus

  • sibling (Gtk::CellRenderer)

    the GtkCellRenderer to check against renderer’s sibling list

Returns:

  • (Boolean)

    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 GParamSpec*. 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:

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 GtkCellArea 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 GtkCellRenderer to request size for

  • orientation (Gtk::Orientation)

    the GtkOrientation in which to request size

  • widget (Gtk::Widget)

    the GtkWidget 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

  • natural_size (Integer)

    location to store the natural size

Returns:

  • (nil)

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

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

Parameters:

  • context (Gtk::CellAreaContext)

    the GtkCellAreaContext for this row of data.

  • widget (Gtk::Widget)

    the GtkWidget that area is rendering to

  • snapshot (Gtk::Snapshot)

    the GtkSnapshot to draw to

  • 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 GtkCellRendererState for area in this row.

  • paint_focus (Boolean)

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

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 (Boolean)

    whether editing was canceled.

Returns:

  • (nil)