Class: Gtk::TreeViewColumn

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

Instance Method Summary collapse

Instance Method Details

#add_attribute(cell_renderer, attribute, column) ⇒ nil

Adds an attribute mapping to the list in tree_column. The column is the column of the model to get a value from, and the attribute is the parameter on cell_renderer to be set from the value. So for example if column 2 of the model contains strings, you could have the “text” attribute of a Gtk::CellRendererText get its values from column 2.

Parameters:

  • cell_renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer to set attributes on

  • attribute (String)

    An attribute on the renderer

  • column (Integer)

    The column position on the model to get the attribute from.

Returns:

  • (nil)

#alignmentGtk::gfloat

Returns alignment.

Returns:

  • (Gtk::gfloat)

    alignment

#alignment=(alignment) ⇒ Gtk::gfloat

Parameters:

  • alignment (Gtk::gfloat)

Returns:

  • (Gtk::gfloat)

    alignment

  • (Gtk::gfloat)

    alignment

#buttonGtk::Widget

Returns the button used in the treeview column header

Returns:

#cell_areaGtk::CellArea

The Gtk::CellArea used to layout cell renderers for this column.

If no area is specified when creating the tree view column with gtk_tree_view_column_new_with_area() a horizontally oriented Gtk::CellAreaBox will be used.

Returns:

#cell_area=(cell_area) ⇒ Gtk::CellArea

The Gtk::CellArea used to layout cell renderers for this column.

If no area is specified when creating the tree view column with gtk_tree_view_column_new_with_area() a horizontally oriented Gtk::CellAreaBox will be used.

Parameters:

Returns:

#cell_get_position(cell_renderer, x_offset, width) ⇒ TrueClass

Obtains the horizontal position and size of a cell in a column. If the cell is not found in the column, start_pos and width are not changed and false is returned.

Parameters:

  • cell_renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer

  • x_offset (Integer)

    return location for the horizontal position of cell within tree_column, may be nil

  • width (Integer)

    return location for the width of cell, may be nil

Returns:

  • (TrueClass)

    true if cell belongs to tree_column.

#cell_get_size(cell_area, x_offset, y_offset, width, height) ⇒ nil

Obtains the width and height needed to render the column. This is used primarily by the Gtk::TreeView.

Parameters:

  • cell_area (Gdk::Rectangle)

    The area a cell in the column will be allocated, or nil

  • x_offset (Integer)

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

  • y_offset (Integer)

    location to return y offset of a 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)

#cell_is_visibleTrueClass

Returns true if any of the cells packed into the tree_column are visible. For this to be meaningful, you must first initialize the cells with gtk_tree_view_column_cell_set_cell_data()

Returns:

  • (TrueClass)

    true, if any of the cells packed into the tree_column are currently visible

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

Sets the cell renderer based on the tree_model and iter. That is, for every attribute mapping in tree_column, it will get a value from the set column on the iter, and use that value to set the attribute on the cell renderer. This is used primarily by the Gtk::TreeView.

Parameters:

  • tree_model (Gtk::TreeModel)

    The Gtk::TreeModel to to get the cell renderers attributes from.

  • iter (Gtk::TreeIter)

    The Gtk::TreeIter to to get the cell renderer’s attributes from.

  • is_expander (TrueClass)

    true, if the row has children

  • is_expanded (TrueClass)

    true, if the row has visible children

Returns:

  • (nil)

#clearnil

Unsets all the mappings on all renderers on the tree_column.

Returns:

  • (nil)

#clear_attributes(cell_renderer) ⇒ nil

Clears all existing attributes previously set with gtk_tree_view_column_set_attributes().

Parameters:

  • cell_renderer (Gtk::CellRenderer)

    a Gtk::CellRenderer to clear the attribute mapping on.

Returns:

  • (nil)

#clickableTrueClass

Returns true if the user can click on the header for the column.

Returns:

  • (TrueClass)

    true if user can click the column header.

#clickable=(clickable) ⇒ TrueClass

Parameters:

  • clickable (TrueClass)

Returns:

  • (TrueClass)

    clickable

  • (TrueClass)

    clickable

#clickable?TrueClass

Returns clickable.

Returns:

  • (TrueClass)

    clickable

#clickednil

Emits the “clicked” signal on the column. This function will only work if tree_column is clickable.

Returns:

  • (nil)

#expandTrueClass

Returns true if the column expands to fill available space.

Returns:

  • (TrueClass)

    true if the column expands to fill available space.

#expand=(expand) ⇒ TrueClass

Parameters:

  • expand (TrueClass)

Returns:

  • (TrueClass)

    expand

  • (TrueClass)

    expand

#expand?TrueClass

Returns expand.

Returns:

  • (TrueClass)

    expand

#fixed_widthInteger

Returns fixed-width.

Returns:

  • (Integer)

    fixed-width

#fixed_width=(fixed_width) ⇒ Integer

Parameters:

  • fixed_width (Integer)

Returns:

  • (Integer)

    fixed-width

  • (Integer)

    fixed-width

#focus_cell(cell) ⇒ nil

Sets the current keyboard focus to be at cell, if the column contains 2 or more editable and activatable cells.

Parameters:

Returns:

  • (nil)

#max_widthInteger

Returns max-width.

Returns:

  • (Integer)

    max-width

#max_width=(max_width) ⇒ Integer

Parameters:

  • max_width (Integer)

Returns:

  • (Integer)

    max-width

  • (Integer)

    max-width

#min_widthInteger

Returns min-width.

Returns:

  • (Integer)

    min-width

#min_width=(min_width) ⇒ Integer

Parameters:

  • min_width (Integer)

Returns:

  • (Integer)

    min-width

  • (Integer)

    min-width

#newGtk::TreeViewColumn

Creates a new Gtk::TreeViewColumn.

Returns:

#new_with_area(area) ⇒ Gtk::TreeViewColumn

Creates a new Gtk::TreeViewColumn using area to render its cells.

Parameters:

  • area (Gtk::CellArea)

    the Gtk::CellArea that the newly created column should use to layout cells.

Returns:

#new_with_attributes(title, cell, array) ⇒ Gtk::TreeViewColumn

Creates a new Gtk::TreeViewColumn with a number of default values. This is equivalent to calling gtk_tree_view_column_set_title(), gtk_tree_view_column_pack_start(), and gtk_tree_view_column_set_attributes() on the newly created Gtk::TreeViewColumn.

Here’s a simple example:

enum { TEXT_COLUMN, COLOR_COLUMN, N_COLUMNS };
// ...
{
  GtkTreeViewColumn *column;
  GtkCellRenderer   *renderer = gtk_cell_renderer_text_new ();

  column = gtk_tree_view_column_new_with_attributes ("Title",
                                                     renderer,
                                                     "text", TEXT_COLUMN,
                                                     "foreground", COLOR_COLUMN,
                                                     NULL);
}

Parameters:

  • title (String)

    The title to set the header to

  • cell (Gtk::CellRenderer)

    The Gtk::CellRenderer

  • array (Array)

    A nil-terminated list of attributes

Returns:

#pack_end(cell, expand) ⇒ nil

Adds the cell to end of the column. If expand is false, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is true.

Parameters:

  • cell (Gtk::CellRenderer)

    The Gtk::CellRenderer.

  • expand (TrueClass)

    true if cell is to be given extra space allocated to tree_column.

Returns:

  • (nil)

#pack_start(cell, expand) ⇒ nil

Packs the cell into the beginning of the column. If expand is false, then the cell is allocated no more space than it needs. Any unused space is divided evenly between cells for which expand is true.

Parameters:

  • cell (Gtk::CellRenderer)

    The Gtk::CellRenderer.

  • expand (TrueClass)

    true if cell is to be given extra space allocated to tree_column.

Returns:

  • (nil)

#queue_resizenil

Flags the column, and the cell renderers added to this column, to have their sizes renegotiated.

Returns:

  • (nil)

#reorderableTrueClass

Returns true if the tree_column can be reordered by the user.

Returns:

  • (TrueClass)

    true if the tree_column can be reordered by the user.

#reorderable=(reorderable) ⇒ TrueClass

Parameters:

  • reorderable (TrueClass)

Returns:

  • (TrueClass)

    reorderable

  • (TrueClass)

    reorderable

#reorderable?TrueClass

Returns reorderable.

Returns:

  • (TrueClass)

    reorderable

#resizableTrueClass

Returns true if the tree_column can be resized by the end user.

Returns:

  • (TrueClass)

    true, if the tree_column can be resized.

#resizable=(resizable) ⇒ TrueClass

Parameters:

  • resizable (TrueClass)

Returns:

  • (TrueClass)

    resizable

  • (TrueClass)

    resizable

#resizable?TrueClass

Returns resizable.

Returns:

  • (TrueClass)

    resizable

#set_attributes(cell_renderer, array) ⇒ nil

Sets the attributes in the list as the attributes of tree_column. The attributes should be in attribute/column order, as in gtk_tree_view_column_add_attribute(). All existing attributes are removed, and replaced with the new attributes.

Parameters:

  • cell_renderer (Gtk::CellRenderer)

    the Gtk::CellRenderer we’re setting the attributes of

  • array (Array)

    A nil-terminated list of attributes

Returns:

  • (nil)

#set_cell_data_func(cell_renderer, func, func_data, destroy) ⇒ nil

Sets the Gtk::TreeCellDataFunc to use for the column. This function is used instead of the standard attributes mapping for setting the column value, and should set the value of tree_column’s cell renderer as appropriate. func may be nil to remove an older one.

Parameters:

  • cell_renderer (Gtk::CellRenderer)

    A Gtk::CellRenderer

  • func (Gtk::TreeCellDataFunc)

    The Gtk::TreeCellDataFunc to use.

  • func_data (GObject)

    The user data for func.

  • destroy (GLib::DestroyNotify)

    The destroy notification for func_data

Returns:

  • (nil)

#sizingGtk::TreeViewColumnSizing

Returns sizing.

Returns:

#sizing=(sizing) ⇒ Gtk::TreeViewColumnSizing

Parameters:

Returns:

#sort_column_idInteger

Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header clickable. Set to -1 to make the column unsortable.

Returns:

  • (Integer)

    sort-column-id

#sort_column_id=(sort_column_id) ⇒ Integer

Logical sort column ID this column sorts on when selected for sorting. Setting the sort column ID makes the column header clickable. Set to -1 to make the column unsortable.

Parameters:

  • sort_column_id (Integer)

Returns:

  • (Integer)

    sort-column-id

  • (Integer)

    sort-column-id

#sort_indicatorTrueClass

Gets the value set by gtk_tree_view_column_set_sort_indicator().

Returns:

  • (TrueClass)

    whether the sort indicator arrow is displayed

#sort_indicator=(sort_indicator) ⇒ TrueClass

Parameters:

  • sort_indicator (TrueClass)

Returns:

  • (TrueClass)

    sort-indicator

  • (TrueClass)

    sort-indicator

#sort_indicator?TrueClass

Returns sort-indicator.

Returns:

  • (TrueClass)

    sort-indicator

#sort_orderGtk::SortType

Returns sort-order.

Returns:

#sort_order=(sort_order) ⇒ Gtk::SortType

Parameters:

Returns:

#spacingInteger

Returns spacing.

Returns:

  • (Integer)

    spacing

#spacing=(spacing) ⇒ Integer

Parameters:

  • spacing (Integer)

Returns:

  • (Integer)

    spacing

  • (Integer)

    spacing

#titleString

Returns title.

Returns:

  • (String)

    title

#title=(title) ⇒ String

Parameters:

  • title (String)

Returns:

  • (String)

    title

  • (String)

    title

#tree_viewGtk::Widget

Returns the Gtk::TreeView wherein tree_column has been inserted. If column is currently not inserted in any tree view, nil is returned.

Returns:

  • (Gtk::Widget)

    The tree view wherein column has been inserted if any, nil otherwise.

#visibleTrueClass

Returns true if tree_column is visible. the tree will show the column.

Returns:

  • (TrueClass)

    whether the column is visible or not. If it is visible, then

#visible=(visible) ⇒ TrueClass

Parameters:

  • visible (TrueClass)

Returns:

  • (TrueClass)

    visible

  • (TrueClass)

    visible

#visible?TrueClass

Returns visible.

Returns:

  • (TrueClass)

    visible

#widgetGtk::Widget

Returns widget.

Returns:

#widget=(widget) ⇒ Gtk::Widget

Parameters:

Returns:

#widthInteger

Returns width.

Returns:

  • (Integer)

    width

#width=(width) ⇒ Integer

Parameters:

  • width (Integer)

Returns:

  • (Integer)

    width

  • (Integer)

    width

#x_offsetInteger

Returns x-offset.

Returns:

  • (Integer)

    x-offset

#x_offset=(x_offset) ⇒ Integer

Parameters:

  • x_offset (Integer)

Returns:

  • (Integer)

    x-offset

  • (Integer)

    x-offset