Class: Gtk::CellRenderer

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

Instance Method Summary collapse

Instance Method Details

#accessible_type=(type) ⇒ nil

Sets the type to be used for creating accessibles for cells rendered by cell renderers of renderer_class. Note that multiple accessibles will be created.

This function should only be called from class init functions of cell renderers.

Parameters:

  • type (GLib::Type)

    The object type that implements the accessible for widget_class. The type must be a subtype of Gtk::RendererCellAccessible

Returns:

  • (nil)

#activate(event, widget, path, background_area, cell_area, flags) ⇒ TrueClass

Passes an activate event to the cell renderer for possible processing. Some cell renderers may use events; for example, Gtk::CellRendererToggle toggles when it gets a mouse click.

Parameters:

  • event (Gdk::Event)

    a Gdk::Event

  • widget (Gtk::Widget)

    widget that received the event

  • path (String)

    widget-dependent string representation of the event location; e.g. for Gtk::TreeView, a string representation of #GtkTreePath

  • background_area (Gdk::Rectangle)

    background area as passed to gtk_cell_renderer_render()

  • cell_area (Gdk::Rectangle)

    cell area as passed to gtk_cell_renderer_render()

  • flags (Gtk::CellRendererState)

    render flags

Returns:

  • (TrueClass)

    true if the event was consumed/handled

#cell_background=(cell_background) ⇒ String

Returns cell-background.

Parameters:

  • cell_background (String)

Returns:

  • (String)

    cell-background

#cell_background_gdkGdk::Color

Cell background as a Gdk::Color

Returns:

  • (Gdk::Color)

    cell-background-gdk

#cell_background_gdk=(cell_background_gdk) ⇒ Gdk::Color

Cell background as a Gdk::Color

Parameters:

  • cell_background_gdk (Gdk::Color)

Returns:

  • (Gdk::Color)

    cell-background-gdk

  • (Gdk::Color)

    cell-background-gdk

#cell_background_rgbaGdk::RGBA

Cell background as a Gdk::RGBA

Returns:

  • (Gdk::RGBA)

    cell-background-rgba

#cell_background_rgba=(cell_background_rgba) ⇒ Gdk::RGBA

Cell background as a Gdk::RGBA

Parameters:

  • cell_background_rgba (Gdk::RGBA)

Returns:

  • (Gdk::RGBA)

    cell-background-rgba

  • (Gdk::RGBA)

    cell-background-rgba

#cell_background_set=(cell_background_set) ⇒ TrueClass

Parameters:

  • cell_background_set (TrueClass)

Returns:

  • (TrueClass)

    cell-background-set

  • (TrueClass)

    cell-background-set

#cell_background_set?TrueClass

Returns cell-background-set.

Returns:

  • (TrueClass)

    cell-background-set

#editing=(editing) ⇒ TrueClass

Parameters:

  • editing (TrueClass)

Returns:

  • (TrueClass)

    editing

  • (TrueClass)

    editing

#editing?TrueClass

Returns editing.

Returns:

  • (TrueClass)

    editing

#get_aligned_area(widget, flags, cell_area, aligned_area) ⇒ nil

Gets the aligned area used by cell inside cell_area. Used for finding the appropriate edit and focus rectangle.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget this cell will be rendering to

  • flags (Gtk::CellRendererState)

    render flags

  • cell_area (Gdk::Rectangle)

    cell area which would be passed to gtk_cell_renderer_render()

  • aligned_area (Gdk::Rectangle)

    the return location for the space inside cell_area that would acually be used to render.

Returns:

  • (nil)

#get_alignment(xalign, yalign) ⇒ nil

Fills in xalign and yalign with the appropriate values of cell.

Parameters:

  • xalign (Gtk::gfloat)

    location to fill in with the x alignment of the cell, or nil

  • yalign (Gtk::gfloat)

    location to fill in with the y alignment of the cell, or nil

Returns:

  • (nil)

#get_fixed_size(width, height) ⇒ nil

Fills in width and height with the appropriate size of cell.

Parameters:

  • width (Integer)

    location to fill in with the fixed width of the cell, or nil

  • height (Integer)

    location to fill in with the fixed height of the cell, or nil

Returns:

  • (nil)

#get_padding(xpad, ypad) ⇒ nil

Fills in xpad and ypad with the appropriate values of cell.

Parameters:

  • xpad (Integer)

    location to fill in with the x padding of the cell, or nil

  • ypad (Integer)

    location to fill in with the y padding of the cell, or nil

Returns:

  • (nil)

#get_preferred_height(widget, minimum_size, natural_size) ⇒ nil

Retreives a renderer’s natural size when rendered to widget.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget this cell will be rendering to

  • minimum_size (Integer)

    location to store the minimum size, or nil

  • natural_size (Integer)

    location to store the natural size, or nil

Returns:

  • (nil)

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

Retreives a cell renderers’s minimum and natural height if it were rendered to widget with the specified width.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget this cell will be rendering to

  • width (Integer)

    the size which is available for allocation

  • minimum_height (Integer)

    location for storing the minimum size, or nil

  • natural_height (Integer)

    location for storing the preferred size, or nil

Returns:

  • (nil)

#get_preferred_size(widget, minimum_size, natural_size) ⇒ nil

Retrieves the minimum and natural size of a cell taking into account the widget’s preference for height-for-width management.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget this cell will be rendering to

  • minimum_size (Gtk::Requisition)

    location for storing the minimum size, or nil

  • natural_size (Gtk::Requisition)

    location for storing the natural size, or nil

Returns:

  • (nil)

#get_preferred_width(widget, minimum_size, natural_size) ⇒ nil

Retreives a renderer’s natural size when rendered to widget.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget this cell will be rendering to

  • minimum_size (Integer)

    location to store the minimum size, or nil

  • natural_size (Integer)

    location to store the natural size, or nil

Returns:

  • (nil)

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

Retreives a cell renderers’s minimum and natural width if it were rendered to widget with the specified height.

Parameters:

  • widget (Gtk::Widget)

    the Gtk::Widget this cell will be rendering to

  • height (Integer)

    the size which is available for allocation

  • minimum_width (Integer)

    location for storing the minimum size, or nil

  • natural_width (Integer)

    location for storing the preferred size, or nil

Returns:

  • (nil)

#get_size(widget, cell_area, x_offset, y_offset, width, height) ⇒ nil

Obtains the width and height needed to render the cell. Used by view widgets to determine the appropriate size for the cell_area passed to gtk_cell_renderer_render(). If cell_area is not nil, fills in the x and y offsets (if set) of the cell relative to this location.

Please note that the values set in width and height, as well as those in x_offset and y_offset are inclusive of the xpad and ypad properties.

Parameters:

  • widget (Gtk::Widget)

    the widget the renderer is rendering to

  • cell_area (Gdk::Rectangle)

    The area a cell will be allocated, or nil

  • x_offset (Integer)

    location to return x offset of cell relative to cell_area, or nil

  • y_offset (Integer)

    location to return y offset of cell relative to cell_area, or nil

  • width (Integer)

    location to return width needed to render a cell, or nil

  • height (Integer)

    location to return height needed to render a cell, or nil

Returns:

  • (nil)

#get_state(widget, cell_state) ⇒ Gtk::StateFlags

Translates the cell renderer state to Gtk::StateFlags, based on the cell renderer and widget sensitivity, and the given Gtk::CellRendererState.

Parameters:

Returns:

#heightInteger

Returns height.

Returns:

  • (Integer)

    height

#height=(height) ⇒ Integer

Parameters:

  • height (Integer)

Returns:

  • (Integer)

    height

  • (Integer)

    height

#is_activatableTrueClass

Checks whether the cell renderer can do something when activated.

Returns:

  • (TrueClass)

    true if the cell renderer can do anything when activated

#is_expanded=(is_expanded) ⇒ TrueClass

Parameters:

  • is_expanded (TrueClass)

Returns:

  • (TrueClass)

    is-expanded

  • (TrueClass)

    is-expanded

#is_expanded?TrueClass

Returns is-expanded.

Returns:

  • (TrueClass)

    is-expanded

#is_expander=(is_expander) ⇒ TrueClass

Parameters:

  • is_expander (TrueClass)

Returns:

  • (TrueClass)

    is-expander

  • (TrueClass)

    is-expander

#is_expander?TrueClass

Returns is-expander.

Returns:

  • (TrueClass)

    is-expander

#modeGtk::CellRendererMode

Returns mode.

Returns:

#mode=(mode) ⇒ Gtk::CellRendererMode

Parameters:

Returns:

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

Invokes the virtual render function of the Gtk::CellRenderer. The three passed-in rectangles are areas in cr. Most renderers will draw within cell_area; the xalign, yalign, xpad, and ypad fields of the Gtk::CellRenderer should be honored with respect to cell_area. background_area includes the blank space around the cell, and also the area containing the tree expander; so the background_area rectangles for all cells tile to cover the entire window.

Parameters:

  • cr (cairo::Context)

    a cairo context to draw to

  • widget (Gtk::Widget)

    the widget owning window

  • background_area (Gdk::Rectangle)

    entire cell area (including tree expanders and maybe padding on the sides)

  • cell_area (Gdk::Rectangle)

    area normally rendered by a cell renderer

  • flags (Gtk::CellRendererState)

    flags that affect rendering

Returns:

  • (nil)

#request_modeGtk::SizeRequestMode

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

Returns:

#sensitiveTrueClass

Returns the cell renderer’s sensitivity.

Returns:

  • (TrueClass)

    true if the cell renderer is sensitive

#sensitive=(sensitive) ⇒ TrueClass

Parameters:

  • sensitive (TrueClass)

Returns:

  • (TrueClass)

    sensitive

  • (TrueClass)

    sensitive

#sensitive?TrueClass

Returns sensitive.

Returns:

  • (TrueClass)

    sensitive

#set_alignment(xalign, yalign) ⇒ nil

Sets the renderer’s alignment within its available space.

Parameters:

  • xalign (Gtk::gfloat)

    the x alignment of the cell renderer

  • yalign (Gtk::gfloat)

    the y alignment of the cell renderer

Returns:

  • (nil)

#set_fixed_size(width, height) ⇒ nil

Sets the renderer size to be explicit, independent of the properties set.

Parameters:

  • width (Integer)

    the width of the cell renderer, or -1

  • height (Integer)

    the height of the cell renderer, or -1

Returns:

  • (nil)

#set_padding(xpad, ypad) ⇒ nil

Sets the renderer’s padding.

Parameters:

  • xpad (Integer)

    the x padding of the cell renderer

  • ypad (Integer)

    the y padding of the cell renderer

Returns:

  • (nil)

#start_editing(event, widget, path, background_area, cell_area, flags) ⇒ Gtk::CellEditable

Starts editing the contents of this cell, through a new Gtk::CellEditable widget created by the Gtk::CellRendererClass.start_editing virtual function.

Parameters:

  • event (Gdk::Event)

    a Gdk::Event

  • widget (Gtk::Widget)

    widget that received the event

  • path (String)

    widget-dependent string representation of the event location; e.g. for Gtk::TreeView, a string representation of #GtkTreePath

  • background_area (Gdk::Rectangle)

    background area as passed to gtk_cell_renderer_render()

  • cell_area (Gdk::Rectangle)

    cell area as passed to gtk_cell_renderer_render()

  • flags (Gtk::CellRendererState)

    render flags

Returns:

  • (Gtk::CellEditable)

    A new Gtk::CellEditable for editing this cell, or nil if editing is not possible

#stop_editing(canceled) ⇒ nil

Informs the cell renderer that the editing is stopped. If canceled is true, the cell renderer will emit the Gtk::CellRenderer::editing-canceled signal.

This function should be called by cell renderer implementations in response to the Gtk::CellEditable::editing-done signal of Gtk::CellEditable.

Parameters:

  • canceled (TrueClass)

    true if the editing has been canceled

Returns:

  • (nil)

#visibleTrueClass

Returns the cell renderer’s visibility.

Returns:

  • (TrueClass)

    true if the cell renderer is visible

#visible=(visible) ⇒ TrueClass

Parameters:

  • visible (TrueClass)

Returns:

  • (TrueClass)

    visible

  • (TrueClass)

    visible

#visible?TrueClass

Returns visible.

Returns:

  • (TrueClass)

    visible

#widthInteger

Returns width.

Returns:

  • (Integer)

    width

#width=(width) ⇒ Integer

Parameters:

  • width (Integer)

Returns:

  • (Integer)

    width

  • (Integer)

    width

#xalignGtk::gfloat

Returns xalign.

Returns:

  • (Gtk::gfloat)

    xalign

#xalign=(xalign) ⇒ Gtk::gfloat

Parameters:

  • xalign (Gtk::gfloat)

Returns:

  • (Gtk::gfloat)

    xalign

  • (Gtk::gfloat)

    xalign

#xpadInteger

Returns xpad.

Returns:

  • (Integer)

    xpad

#xpad=(xpad) ⇒ Integer

Parameters:

  • xpad (Integer)

Returns:

  • (Integer)

    xpad

  • (Integer)

    xpad

#yalignGtk::gfloat

Returns yalign.

Returns:

  • (Gtk::gfloat)

    yalign

#yalign=(yalign) ⇒ Gtk::gfloat

Parameters:

  • yalign (Gtk::gfloat)

Returns:

  • (Gtk::gfloat)

    yalign

  • (Gtk::gfloat)

    yalign

#ypadInteger

Returns ypad.

Returns:

  • (Integer)

    ypad

#ypad=(ypad) ⇒ Integer

Parameters:

  • ypad (Integer)

Returns:

  • (Integer)

    ypad

  • (Integer)

    ypad