Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::TreeView Class Reference

A GtkTreeView C++ wrapper class. More...

`#include <inti/gtk/treeview.h>`

Inheritance diagram for Inti::Gtk::TreeView:

List of all members.

## Public Types

- typedef Slot4< bool, TreeView &,
  TreeViewColumn &, TreeViewColumn *,
  TreeViewColumn * > ColumnDropSlot
    Signature of the callback slot for determining whether a column can be dropped in a particular spot (as determined by prev_column and next_column).
- typedef Slot2< void, TreeView &,
  const TreePath & > MappingSlot
    Signature of the callback slot to be called on each expanded row.
- typedef Slot4< bool, TreeModel *,
  int, const String &, const
  TreeIter & > SearchEqualSlot
    Signature of the callback slot to be called during an interactvie search.

## Public Member Functions

Constructors

- TreeView ()
    Construct a new tree view.
- TreeView (TreeModel &model)
    Construct a new tree view with the model initialized to model.
- virtual ~TreeView ()
    Destructor.

Accessors

- GtkTreeView * gtk_tree_view () const
    Get a pointer to the GtkTreeView structure.
- GtkTreeViewClass * gtk_tree_view_class () const
    Get a pointer to the GtkTreeViewClass structure.
- operator GtkTreeView * () const
    Conversion operator; safely converts a TreeView to a GtkTreeView pointer.
- TreeModel * get_model () const
    Returns the model the tree view is based on.
- TreeSelection * get_selection () const
    Returns the TreeSelection associated with the tree view.
- Adjustment * get_hadjustment () const
    Gets the Adjustment currently being used for the horizontal aspect.
- Adjustment * get_vadjustment () const
    Gets the Adjustment currently being used for the vertical aspect.
- bool get_headers_visible () const
    Returns true if the headers on the tree view are visible.
- TreeViewColumn * get_column (int position) const
    Gets the TreeViewColumn at the given position in the tree view.
- bool get_columns (std::vector< TreeViewColumn * > &columns) const
    Returns a list of all the columns currently in tree_view.
- TreeViewColumn * get_expander_column () const
    Returns the column that is the current expander column, that is, the column that has the expander arrow drawn next to it.
- bool row_expanded (const TreePath &path) const
    Returns true if the node pointed to by path is expanded in the tree view.
- bool get_reorderable () const
    Retrieves whether the user can reorder the tree via drag-and-drop (see set_reorderable()).
- void get_cursor (Pointer< TreePath > *path, TreeViewColumn **focus_column) const
    Fills in path and focus_column with the current path and focus column.
- Gdk::Window * get_bin_window () const
    Returns the window that tree view renders to.
- bool get_path_at_pos (int x, int y, Pointer< TreePath > *path, TreeViewColumn **column, int *cell_x, int *cell_y) const
    Finds the path at the point (x, y), relative to widget coordinates.
- void get_cell_area (const TreePath *path, const TreeViewColumn *column, Gdk::Rectangle &rectangle) const
    Fills the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.
- Gdk::Rectangle get_cell_area (const TreePath *path, const TreeViewColumn *column) const
    Returns a rectangle filled with the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.
- void get_background_area (const TreePath *path, const TreeViewColumn *column, Gdk::Rectangle &rectangle) const
    Fills the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.
- Gdk::Rectangle get_background_area (const TreePath *path, const TreeViewColumn *column) const
    Returns a rectangle filled with the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.
- void get_visible_rect (Gdk::Rectangle &visible_rect) const
    Fills visible_rect with the currently visible region of the view, in tree coordinates.
- Gdk::Rectangle get_visible_rect () const
    Returns a rectangle filled with the currently visible region of the view, in tree coordinates.
- bool get_rules_hint () const
    Gets the setting set by set_rules_hint().
- void get_drag_dest_row (Pointer< TreePath > *path, TreeViewDropPosition *pos) const
    Gets the path and/or drop position type of a row.
- bool get_dest_row_at_pos (int drag_x, int drag_y, Pointer< TreePath > *path, TreeViewDropPosition *pos) const
    Finds the path and drop position type for the coordinates (drag_x, drag_y).
- bool get_enable_search () const
    Returns whether or not the tree allows interactive searching.
- int get_search_column () const
    Gets the column searched on by the interactive search code.

Methods

- void set_model (TreeModel *model)
    Sets the model for the tree view.
- void set_hadjustment (Adjustment *adjustment)
    Sets the Adjustment for the current horizontal aspect.
- void set_vadjustment (Adjustment *adjustment)
    Sets the Adjustment for the current vertical aspect.
- void set_headers_visible (bool headers_visible)
    Sets the visibility state of the headers.
- void columns_autosize ()
    Resizes all columns to their optimal width. Only works after the tree view has been realized.
- void set_headers_clickable (bool setting)
    Allow the column title buttons to be clicked.
- int append_column (TreeViewColumn &column)
    Appends column to the list of columns.
- int append_column (const String &title, CellRenderer *cell,...)
    Creates a new TreeViewColumn and appends it to the end of the list of columns.
- int append_column (const String &title, CellRenderer &cell, const TreeViewColumn::CellDataSlot *data)
    Convenience method that appends a new column to the tree view with the given cell renderer and a TreeViewColumn::CellDataSlot to set cell renderer attributes.
- int insert_column (TreeViewColumn &column, int position)
    This inserts the column into the tree view at position.
- int insert_column (int position, const String &title, CellRenderer *cell,...)
    Creates a new TreeViewColumn and inserts it into the tree view at position.
- int insert_column (int position, const String &title, CellRenderer &cell, const TreeViewColumn::CellDataSlot *data)
    Convenience method that inserts a new column into the TreeView with the given cell renderer and a TreeViewColumn::CellDataSlot to set cell renderer attributes.
- int remove_column (TreeViewColumn &column)
    Removes column from the tree view.
- void move_column_after (TreeViewColumn &column, TreeViewColumn *base_column)
    Moves column to be after to base_column.
- void set_expander_column (TreeViewColumn *column)
    Sets the column to draw the expander arrow at.
- void set_column_drag_function (const ColumnDropSlot *drop)
    Sets a user callback slot for determining where a column may be dropped when dragged.
- void scroll_to_point (int tree_x, int tree_y)
    Scrolls the tree view such that the top-left corner of the visible area is tree_x, tree_y, where tree_x and tree_y are specified in tree window coordinates.
- void scroll_to_cell (const TreePath *path, const TreeViewColumn *column)
    Moves the alignments of the tree view to the position specified by column and path.
- void scroll_to_cell (const TreePath *path, const TreeViewColumn *column, float row_align, float col_align)
    Moves the alignments of the tree view to the position specified by column and path.
- void row_activated (TreePath &path, TreeViewColumn &column)
    Activates the cell determined by path and column.
- void expand_all ()
    Recursively expands all nodes in the tree view.
- void collapse_all ()
    Recursively collapses all visible, expanded nodes in the tree view.
- void expand_to_path (const TreePath &path)
    Expands the row at path.
- bool expand_row (const TreePath &path, bool open_all)
    Opens the row specified by path so its children are visible.
- bool collapse_row (const TreePath &path)
    Collapses the row specified by path hiding its child rows, if they exist.
- void map_expanded_rows (const MappingSlot *map)
    Calls the map slot on all expanded rows.
- void set_reorderable (bool reorderable)
    This function is a convenience function to allow you to reorder models that support the drag-and-drop interface; both TreeStore and ListStore support these.
- void set_cursor (const TreePath &path, TreeViewColumn *focus_column, bool start_editing=false)
    Sets the current keyboard focus to be at path, and selects it.
- void set_cursor_on_cell (const TreePath &path, TreeViewColumn *focus_column, CellRenderer *focus_cell, bool start_editing=false)
    Sets the current keyboard focus to be at path, and selects it.
- void widget_to_tree_coords (int wx, int wy, int *tx, int *ty) const
    Converts widget coordinates to coordinates for the tree window (the full scrollable area of the tree).
- void tree_to_widget_coords (int tx, int ty, int *wx, int *wy) const
    Converts tree coordinates (coordinates in the full scrollable area of the tree) to widget coordinates.
- void set_rules_hint (bool setting)
    This method tells GTK+ that the user interface for your application requires users to read across tree rows and associate cells with one another.
- void enable_model_drag_source (Gdk::ModifierTypeField start_button_mask, const std::vector< TargetEntry > &targets, Gdk::DragActionField actions)
    Sets up the tree view so that GTK+ will start a drag operation when the user clicks and drags on the tree view.
- void enable_model_drag_dest (const std::vector< TargetEntry > &targets, Gdk::DragActionField actions)
    Sets the tree view as a potential drop destination.
- void unset_rows_drag_source ()
    Undoes the effects of enable_model_drag_source().
- void unset_rows_drag_dest ()
    Clears information about a drop destination set with enable_model_drag_dest().
- void set_drag_dest_row (const TreePath &path, TreeViewDropPosition pos)
    Sets where a dropped row goes.
- Pointer< Gdk::Pixmap > create_row_drag_icon (const TreePath &path)
    Creates a Gdk::Pixmap representation of the row at path; this image is used for a drag icon.
- void set_enable_search (bool enable_search)
    If enable_search is set, then the user can type in text to search through the tree interactively.
- void set_search_column (int column)
    Sets column as the column where the interactive search code should search in.
- void set_search_equal_func (const SearchEqualSlot *search_equal)
    Sets the compare slot for the interactive search capabilities.

Property Proxies

- const ModelPropertyProxy prop_model ()
    The model for the tree view (TreeModel* : Read / Write).
- const HAdjustmentPropertyProxy prop_hadjustment ()
    Horizontal Adjustment for the widget (Adjustment* : Read / Write).
- const VAdjustmentPropertyProxy prop_vadjustment ()
    Vertical Adjustment for the widget (Adjustment* : Read / Write).
- const HeadersVisiblePropertyProxy prop_headers_visible ()
    Show the column header buttons (bool : Read / Write).
- const HeadersClickablePropertyProxy prop_headers_clickable ()
    Column headers respond to click events (bool : Write).
- const ExpanderColumnPropertyProxy prop_expander_column ()
    Set the column for the expander column (TreeViewColumn* : Read / Write).
- const ReorderablePropertyProxy prop_reorderable ()
    The view is reorderable (bool : Read / Write).
- const RulesHintPropertyProxy prop_rules_hint ()
    Set a hint to the theme engine to draw rows in alternating colors (bool : Read / Write).
- const EnableSearchPropertyProxy prop_enable_search ()
    The view allows user to search through columns interactively (bool : Read / Write).
- const SearchColumnPropertyProxy prop_search_column ()
    The model column to search through when searching through code (int : Read / Write).

Signal Proxies

- const SetScrollAdjustmentsSignalProxy sig_set_scroll_adjustments ()
    Connect to the set_scroll_adjustments_signal; emitted when a tree view is added to a scrolling aware parent.
- const RowActivatedSignalProxy sig_row_activated ()
    Connect to the row_activated_signal; emitted when a row is activated.
- const TestExpandRowSignalProxy sig_test_expand_row ()
    Connect to the test_expand_row_signal; emitted to determine if a row has child rows and can be opened.
- const TestCollapseRowSignalProxy sig_test_collapse_row ()
    Connect to the test_collapse_row_signal; emitted to determine if a row has visible child rows that can be collapsed.
- const RowExpandSignalProxy sig_row_expanded ()
    Connect to the row_expanded_signal; emitted when a row is opened so its children are visible.
- const RowCollapsedSignalProxy sig_row_collapsed ()
    Connect to the row_collapsed_signal; emitted when a row is collapsed to hide its child rows.
- const ColumnsChangedSignalProxy sig_columns_changed ()
    Connect to the columns_changed_signal; emitted whenever the order or number of columns in the tree view changes.
- const CursorChangedSignalProxy sig_cursor_changed ()
    Connect to the cursor_changed_signal; emitted whenever the current keyboard focus changes.

## Protected Member Functions

Constructors

- TreeView (GtkTreeView *tree_view, bool reference=false)
    Construct a new TreeView from an existing GtkTreeView.

Signal Handlers

- virtual void on_set_scroll_adjustments (Adjustment *hadjustment, Adjustment *vadjustment)
    Called when a tree view is added to a scrolling aware parent.
- virtual void on_row_activated (const TreePath &path, TreeViewColumn &column)
    Called when the cell determined by path and column is activated.
- virtual bool on_test_expand_row (const TreeIter &iter, const TreePath &path)
    Called to determine if the row identified by iter and path has child rows and can be opened.
- virtual bool on_test_collapse_row (const TreeIter &iter, const TreePath &path)
    Called to determine if the row identified by iter and path has child rows that are visible and can be collapsed.
- virtual void on_row_expanded (const TreeIter &iter, const TreePath &path)
    Called when the row determined by iter and path is opened so its children are visible.
- virtual void on_row_collapsed (const TreeIter &iter, const TreePath &path)
    Called when the row determined by iter and path is collapsed to hide its child rows.
- virtual void on_columns_changed ()
    Called whenever the order or number of columns in the tree view changes.
- virtual void on_cursor_changed ()
    Called whenever the current keyboard focus changes.

## Detailed Description

A GtkTreeView C++ wrapper class.

TreeView is a widget that can display any object that implements the TreeModel interface.

To use TreeView in your application you only need to include two header files <treeview.h> and either <liststore.h> or <treestore.h>. These header files include all the other header files that TreeView needs.

## Member Typedef Documentation

typedef Slot4<bool, TreeView&, TreeViewColumn&, TreeViewColumn*, TreeViewColumn*> Inti::Gtk::TreeView::ColumnDropSlot

Signature of the callback slot for determining whether a column can be dropped in a particular spot (as determined by prev_column and next_column).

Example: Method signature for ColumnDropSlot.

                 bool method(TreeView& tree_view,
                             TreeViewColumn& column,
                             TreeViewColumn *prev_column,
                             TreeViewColumn *next_column);

                 // tree_view: The TreeView.
                 // column: The TreeViewColumn being dragged.
                 // prev_column: A TreeViewColumn on one side of column.
                 // next_column: A TreeViewColumn on the other side of column.
                 // return: true if column can be dropped in this spot.

In left to right locales, prev_column is on the left of the potential drop spot, and next_column is on the right. In right to left mode, this is reversed. This slot should return true if the spot is a valid drop spot. Please note that returning true does not actually indicate that the column drop was made, but is meant only to indicate a possible drop spot to the user.

typedef Slot2<void, TreeView&, const TreePath&> Inti::Gtk::TreeView::MappingSlot

Signature of the callback slot to be called on each expanded row.

Example: Method signature for MappingSlot.

                 void method(TreeView& tree_view, const TreePath& path);

                 // tree_view: The TreeView.
                 // path: The path being expanded.

typedef Slot4<bool, TreeModel*, int, const String&, const TreeIter&> Inti::Gtk::TreeView::SearchEqualSlot

Signature of the callback slot to be called during an interactvie search.

Example: Method signature for SearchEqualSlot.

                 bool method(TreeModel *model, int column, const String& key, const TreeIter& iter);

                 // model: The TreeModel.
                 // column: The coloumn identifier.
                 // key: The string being search for.
                 // iter: A valid TreeIter for the row being searched.
                 // return: <EM>false</EM> to stop the search, <EM>true</EM> to continue.

## Constructor & Destructor Documentation

Inti::Gtk::TreeView::TreeView | ( | GtkTreeView * | tree_view,
|  | bool | reference = false
| ) | `[explicit, protected]`

Construct a new TreeView from an existing GtkTreeView.

Parameters:

  tree_view | A pointer to a GtkTreeView.
  reference | Set false if the initial reference count is floating, set true if it's not.

The tree_view can be a newly created GtkTreeView or an existing GtkTreeView (see G::Object::Object).

Inti::Gtk::TreeView::TreeView | ( | TreeModel & | model | ) | `[explicit]`

Construct a new tree view with the model initialized to model.

Parameters:

  model | The model.

## Member Function Documentation

int Inti::Gtk::TreeView::append_column | ( | const String & | title,
|  | CellRenderer & | cell,
|  | const TreeViewColumn::CellDataSlot * | data
| ) |

Convenience method that appends a new column to the tree view with the given cell renderer and a TreeViewColumn::CellDataSlot to set cell renderer attributes.

Parameters:

  title | The column title.
  cell | The cell renderer for column.
  data | The callback slot to set attributes of cell renderer.

Returns:
  The number of columns in the tree view post-insert

See also Gtk::TreeViewColumn::set_cell_data_func(), Gtk::TreeViewColumn::pack_start().

int Inti::Gtk::TreeView::append_column | ( | const String & | title,
|  | CellRenderer * | cell,
|  | ... |
| ) |

Creates a new TreeViewColumn and appends it to the end of the list of columns.

Parameters:

  title | The title to set the header to.
  cell | The CellRenderer.
  ... | A null-terminated list of 'char* /int' attribute/column pairs.

Returns:
  The number of columns in the tree view after insertion.

The column is initialized with the attributes given.

int Inti::Gtk::TreeView::append_column | ( | TreeViewColumn & | column | ) |

Appends column to the list of columns.

Parameters:

  column | The TreeViewColumn to add.

Returns:
  The number of columns in the tree view after appending.

bool Inti::Gtk::TreeView::collapse_row | ( | const TreePath & | path | ) |

Collapses the row specified by path hiding its child rows, if they exist.

Parameters:

  path | The path to a row in the tree view.

Returns:
  true if the row was collapsed.

Pointer<Gdk::Pixmap> Inti::Gtk::TreeView::create_row_drag_icon | ( | const TreePath & | path | ) |

Creates a Gdk::Pixmap representation of the row at path; this image is used for a drag icon.

Parameters:

  path | A TreePath in tree_view.

Returns:
  A smart pointer to a newly-allocated pixmap of the drag icon.

void Inti::Gtk::TreeView::enable_model_drag_dest | ( | const std::vector< TargetEntry > & | targets,
|  | Gdk::DragActionField | actions
| ) |

Sets the tree view as a potential drop destination.

Parameters:

  targets | A vector of TargetEntry indicating the drop types that this tree view will accept.
  actions | A bitmask of possible actions for a drop onto this widget.

The targets and actions fields only are used if DEST_DEFAULT_MOTION or DEST_DEFAULT_DROP are given.

void Inti::Gtk::TreeView::enable_model_drag_source | ( | Gdk::ModifierTypeField | start_button_mask,
|  | const std::vector< TargetEntry > & | targets,
|  | Gdk::DragActionField | actions
| ) |

Sets up the tree view so that GTK+ will start a drag operation when the user clicks and drags on the tree view.

Parameters:

  start_button_mask | The bitmask of buttons that can start the drag.
  targets | The TargetEntrys for the targets the drag will support.
  actions | The bitmask of possible actions for a drag from this widget.

This method is provided for manual drag-and-drop. TreeView already provides simple drag-and-drop (see set_reorderable()).

bool Inti::Gtk::TreeView::expand_row | ( | const TreePath & | path,
|  | bool | open_all
| ) |

Opens the row specified by path so its children are visible.

Parameters:

  path | The path to a row.
  open_all | Whether to recursively expand, or just expand the immediate children.

Returns:
  true if the row existed and had children.

void Inti::Gtk::TreeView::expand_to_path | ( | const TreePath & | path | ) |

Expands the row at path.

Parameters:

  path | The path to a row.

This will also expand all parent rows of path as necessary.

Gdk::Rectangle Inti::Gtk::TreeView::get_background_area | ( | const TreePath * | path,
|  | const TreeViewColumn * | column
| ) | const

Returns a rectangle filled with the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.

Parameters:

  path | A TreePath for the row, or null to get only horizontal coordinates.
  column | A TreeViewColumn for the column, or null to get only vertical coordinates.

Returns:
  A rectangle filled with cell background area.

If path is null, or points to a node not found in the tree, the y and height fields of the rectangle will be filled with 0. If column is null, the x and width fields will be filled with 0. The returned rectangle is equivalent to the background_area passed to Gtk::CellRenderer::render(). These background areas tile to cover the entire tree window (except for the area used for header buttons). Contrast with the cell_area, returned by get_cell_area(), which returns only the cell itself, excluding surrounding borders and the tree expander area.

void Inti::Gtk::TreeView::get_background_area | ( | const TreePath * | path,
|  | const TreeViewColumn * | column,
|  | Gdk::Rectangle & | rectangle
| ) | const

Fills the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.

Parameters:

  path | A TreePath for the row, or null to get only horizontal coordinates.
  column | A TreeViewColumn for the column, or null to get only vertical coordinates.
  rectangle | The rectangle to fill with cell background area.

If path is null, or points to a node not found in the tree, the y and height fields of the rectangle will be filled with 0. If column is null, the x and width fields will be filled with 0. The returned rectangle is equivalent to the background_area passed to Gtk::CellRenderer::render(). These background areas tile to cover the entire tree window (except for the area used for header buttons). Contrast with the cell_area, returned by get_cell_area(), which returns only the cell itself, excluding surrounding borders and the tree expander area.

Gdk::Window* Inti::Gtk::TreeView::get_bin_window | ( |  | ) | const

Returns the window that tree view renders to.

Returns:
  A Gdk::Window, or null when tree_view hasn't been realized yet.

This is used primarily to compare to event->window to confirm that the event on the tree view is on the right window.

Gdk::Rectangle Inti::Gtk::TreeView::get_cell_area | ( | const TreePath * | path,
|  | const TreeViewColumn * | column
| ) | const

Returns a rectangle filled with the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.

Parameters:

  path | A TreePath for the row, or null to get only horizontal coordinates.
  column | A TreeViewColumn for the column, or null to get only vertical coordinates.

Returns:
  A rectangle filled with the cell area.

If path is null, or points to a path not currently displayed, the y and height fields of the rectangle will be filled with 0. If column is null, the x and width fields will be filled with 0. The sum of all cell rects does not cover the entire tree; there are extra pixels in between rows, for example. The returned rectangle is equivalent to the cell_area passed to Gtk::CellRenderer::render(). This method is only valid if the tree view is realized.

void Inti::Gtk::TreeView::get_cell_area | ( | const TreePath * | path,
|  | const TreeViewColumn * | column,
|  | Gdk::Rectangle & | rectangle
| ) | const

Fills the bounding rectangle in tree window coordinates for the cell at the row specified by path and the column specified by column.

Parameters:

  path | A TreePath for the row, or null to get only horizontal coordinates.
  column | A TreeViewColumn for the column, or null to get only vertical coordinates.
  rectangle | The rectangle to fill with the cell area.

If path is null, or points to a path not currently displayed, the y and height fields of the rectangle will be filled with 0. If column is null, the x and width fields will be filled with 0. The sum of all cell rects does not cover the entire tree; there are extra pixels in between rows, for example. The returned rectangle is equivalent to the cell_area passed to Gtk::CellRenderer::render(). This method is only valid if the tree view is realized.

TreeViewColumn* Inti::Gtk::TreeView::get_column | ( | int | position | ) | const

Gets the TreeViewColumn at the given position in the tree view.

Parameters:

  position | The position of the column, counting from 0.

Returns:
  The TreeViewColumn, or null if the position is outside the range of columns.

bool Inti::Gtk::TreeView::get_columns | ( | std::vector< TreeViewColumn * > & | columns | ) | const

Returns a list of all the columns currently in tree_view.

Parameters:

  columns | A reference to a vector of TreeViewcolumn* to hold the list of columns.

Returns:
  true if columns is not empty.

void Inti::Gtk::TreeView::get_cursor | ( | Pointer< TreePath > * | path,
|  | TreeViewColumn ** | focus_column
| ) | const

Fills in path and focus_column with the current path and focus column.

Parameters:

  path | A smart pointer to be filled with the current cursor path, or null.
  focus_column | A pointer to be filled with the current focus column, or null.

If the cursor isn't currently set, then '*path' will be null. If no column currently has the focus, then '*focus_column' will be null.

bool Inti::Gtk::TreeView::get_dest_row_at_pos | ( | int | drag_x,
|  | int | drag_y,
|  | Pointer< TreePath > * | path,
|  | TreeViewDropPosition * | pos
| ) | const

Finds the path and drop position type for the coordinates (drag_x, drag_y).

Parameters:

  drag_x | The X coordinate.
  drag_y | The Y coordinate.
  path | A smart pointer to a TreePath to be filled in, or null.
  pos | The return location for the drop position type, or null.

Returns:
  true if a row exists at the coordinates.

This method is provided to allow a custom drag-and-drop implementation. See get_path_at_pos().

void Inti::Gtk::TreeView::get_drag_dest_row | ( | Pointer< TreePath > * | path,
|  | TreeViewDropPosition * | pos
| ) | const

Gets the path and/or drop position type of a row.

Parameters:

  path | A smart pointer to a TreePath to be filled in, or null.
  pos | The return location for the drop position type, or null.

bool Inti::Gtk::TreeView::get_enable_search | ( |  | ) | const

Returns whether or not the tree allows interactive searching.

Returns:
  Whether or not to let the user search interactively.

TreeViewColumn* Inti::Gtk::TreeView::get_expander_column | ( |  | ) | const

Returns the column that is the current expander column, that is, the column that has the expander arrow drawn next to it.

Returns:
  The expander column.

Adjustment* Inti::Gtk::TreeView::get_hadjustment | ( |  | ) | const

Gets the Adjustment currently being used for the horizontal aspect.

Returns:
  An Adjustment object, or null if none is currently being used.

bool Inti::Gtk::TreeView::get_headers_visible | ( |  | ) | const

Returns true if the headers on the tree view are visible.

Returns:
  Whether the headers are visible or not.

TreeModel* Inti::Gtk::TreeView::get_model | ( |  | ) | const

Returns the model the tree view is based on.

Returns:
  The model, or null if the model is currently unset.

bool Inti::Gtk::TreeView::get_path_at_pos | ( | int | x,
|  | int | y,
|  | Pointer< TreePath > * | path,
|  | TreeViewColumn ** | column,
|  | int * | cell_x,
|  | int * | cell_y
| ) | const

Finds the path at the point (x, y), relative to widget coordinates.

Parameters:

  x | The x position to be identified.
  y | The y position to be identified.
  path | A smart pointer to a TreePath pointer to be filled in, or null.
  column | A pointer to a TreeViewColumn pointer to be filled in, or null.
  cell_x | A pointer where the X coordinate relative to the cell can be placed, or null.
  cell_y | A pointer where the Y coordinate relative to the cell can be placed, or null.

Returns:
  true if a row exists at that coordinate.

x and y are relative to an event's coordinates and must come from an event on the tree view only where event->window == get_bin_window(). It is primarily for things like popup menus. If path is non-null, then it will be filled with the TreePath at that point. If column is non-null, then it will be filled with the column at that point. cell_x and cell_y return the coordinates relative to the cell background (i.e. the background_area passed to Gtk::CellRenderer::render()). This method is only meaningful if the tree view is realized.

bool Inti::Gtk::TreeView::get_reorderable | ( |  | ) | const

Retrieves whether the user can reorder the tree via drag-and-drop (see set_reorderable()).

Returns:
  true if the tree can be reordered.

bool Inti::Gtk::TreeView::get_rules_hint | ( |  | ) | const

Gets the setting set by set_rules_hint().

Returns:
  true if rules are useful for the user of this tree.

int Inti::Gtk::TreeView::get_search_column | ( |  | ) | const

Gets the column searched on by the interactive search code.

Returns:
  The column the interactive search code searches in.

Adjustment* Inti::Gtk::TreeView::get_vadjustment | ( |  | ) | const

Gets the Adjustment currently being used for the vertical aspect.

Returns:
  An Adjustment object, or null if none is currently being used.

Gdk::Rectangle Inti::Gtk::TreeView::get_visible_rect | ( |  | ) | const

Returns a rectangle filled with the currently visible region of the view, in tree coordinates.

Returns:
  The rectangle to fill with the visible region.

Convert to widget coordinates with tree_to_widget_coords(). Tree coordinates start at (0,0) for row 0 of the tree, and cover the entire scrollable area of the tree.

void Inti::Gtk::TreeView::get_visible_rect | ( | Gdk::Rectangle & | visible_rect | ) | const

Fills visible_rect with the currently visible region of the view, in tree coordinates.

Parameters:

  visible_rect | The rectangle to fill.

Convert to widget coordinates with tree_to_widget_coords(). Tree coordinates start at (0,0) for row 0 of the tree, and cover the entire scrollable area of the tree.

int Inti::Gtk::TreeView::insert_column | ( | int | position,
|  | const String & | title,
|  | CellRenderer & | cell,
|  | const TreeViewColumn::CellDataSlot * | data
| ) |

Convenience method that inserts a new column into the TreeView with the given cell renderer and a TreeViewColumn::CellDataSlot to set cell renderer attributes.

Parameters:

  position | The position to insert, or -1 to append.
  title | The column title.
  cell | The cell renderer for column.
  data | The callback slot to set attributes of cell renderer.

Returns:
  The number of columns in the tree view post-insert

See also Gtk::TreeViewColumn::set_cell_data_func(), Gtk::TreeViewColumn::pack_start().

int Inti::Gtk::TreeView::insert_column | ( | int | position,
|  | const String & | title,
|  | CellRenderer * | cell,
|  | ... |
| ) |

Creates a new TreeViewColumn and inserts it into the tree view at position.

Parameters:

  position | The position to insert the new column in.
  title | The title to set the header to.
  cell | The CellRenderer.
  ... | A null-terminated list of 'char* /int' (attribute/column) pairs.

Returns:
  The number of columns in the tree view after insertion.

If position is -1, then the newly created column is appended to the end. The column is initialized with the attributes given.

int Inti::Gtk::TreeView::insert_column | ( | TreeViewColumn & | column,
|  | int | position
| ) |

This inserts the column into the tree view at position.

Parameters:

  column | The TreeViewColumn to be inserted.
  position | The position to insert column in.

Returns:
  The number of columns in the tree view after insertion.

If position is -1, then the column is appended to the end.

void Inti::Gtk::TreeView::map_expanded_rows | ( | const MappingSlot * | map | ) |

Calls the map slot on all expanded rows.

Parameters:

  map | The callback slot to be called.

void Inti::Gtk::TreeView::move_column_after | ( | TreeViewColumn & | column,
|  | TreeViewColumn * | base_column
| ) |

Moves column to be after to base_column.

Parameters:

  column | The TreeViewColumn to be moved.
  base_column | The TreeViewColumn to be moved relative to, or null.

If base_column is null, then column is placed in the first position.

virtual void Inti::Gtk::TreeView::on_row_activated | ( | const TreePath & | path,
|  | TreeViewColumn & | column
| ) | `[protected, virtual]`

Called when the cell determined by path and column is activated.

Parameters:

  path | The TreePath being activated.
  column: | The TreeViewColumn being activated.

virtual void Inti::Gtk::TreeView::on_row_collapsed | ( | const TreeIter & | iter,
|  | const TreePath & | path
| ) | `[protected, virtual]`

Called when the row determined by iter and path is collapsed to hide its child rows.

Parameters:

  iter | A valid iterator pointing to path.
  path | The path to the row being collapsed.

virtual void Inti::Gtk::TreeView::on_row_expanded | ( | const TreeIter & | iter,
|  | const TreePath & | path
| ) | `[protected, virtual]`

Called when the row determined by iter and path is opened so its children are visible.

Parameters:

  iter | A valid iterator pointing to path.
  path | The path to the row being expanded.

virtual void Inti::Gtk::TreeView::on_set_scroll_adjustments | ( | Adjustment * | hadjustment,
|  | Adjustment * | vadjustment
| ) | `[protected, virtual]`

Called when a tree view is added to a scrolling aware parent.

Parameters:

  hadjustment | The horizontal adjustment.
  vadjustment | The vertical adjustment.

virtual bool Inti::Gtk::TreeView::on_test_collapse_row | ( | const TreeIter & | iter,
|  | const TreePath & | path
| ) | `[protected, virtual]`

Called to determine if the row identified by iter and path has child rows that are visible and can be collapsed.

Parameters:

  iter | A valid iterator pointing to path.
  path | The path to the row being checked.

Returns:
  true if the row has child rows that are visible and can be collapsed.

virtual bool Inti::Gtk::TreeView::on_test_expand_row | ( | const TreeIter & | iter,
|  | const TreePath & | path
| ) | `[protected, virtual]`

Called to determine if the row identified by iter and path has child rows and can be opened.

Parameters:

  iter | A valid iterator pointing to path.
  path | The path to the row being checked.

Returns:
  true if the row has chil rows and can be expanded.

int Inti::Gtk::TreeView::remove_column | ( | TreeViewColumn & | column | ) |

Removes column from the tree view.

Parameters:

  column | The TreeViewColumn to remove.

Returns:
  The number of columns in the tree view after removing.

void Inti::Gtk::TreeView::row_activated | ( | TreePath & | path,
|  | TreeViewColumn & | column
| ) |

Activates the cell determined by path and column.

Parameters:

  path | The TreePath to be activated.
  column | The TreeViewColumn to be activated.

bool Inti::Gtk::TreeView::row_expanded | ( | const TreePath & | path | ) | const

Returns true if the node pointed to by path is expanded in the tree view.

Parameters:

  path | A TreePath to test expansion state.

Returns:
  true if path is expanded.

void Inti::Gtk::TreeView::scroll_to_cell | ( | const TreePath * | path,
|  | const TreeViewColumn * | column,
|  | float | row_align,
|  | float | col_align
| ) |

Moves the alignments of the tree view to the position specified by column and path.

Parameters:

  path | The path of the row to move to, or null.
  column | The TreeViewColumn to move horizontally to, or null.
  row_align | The vertical alignment of the row specified by path.
  col_align | The horizontal alignment of the column specified by column.

If column is null, then no horizontal scrolling occurs. Likewise, if path is null no vertical scrolling occurs. At a minimum, one of column or path need to be non-null. row_align determines where the row is placed, and col_align determines where the column is placed. Both are expected to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means center. If the cell is currently visible on the screen, nothing is done.

This method only works if the model is set, and path is a valid row on the model. If the model changes before the tree view is realized, the centered path will be modified to reflect this change.

void Inti::Gtk::TreeView::scroll_to_cell | ( | const TreePath * | path,
|  | const TreeViewColumn * | column
| ) |

Moves the alignments of the tree view to the position specified by column and path.

Parameters:

  path | The path of the row to move to, or null.
  column | The TreeViewColumn to move horizontally to, or null.

If column is null, then no horizontal scrolling occurs. Likewise, if path is null no vertical scrolling occurs. At a minimum, one of column or path need to be non-null. This method has no alignment arguments. Instead the tree does the minimum amount of work to scroll the cell onto the screen. This means that the cell will be scrolled to the edge closest to it's current position. If the cell is currently visible on the screen, nothing is done.

This method only works if the model is set, and path is a valid row on the model. If the model changes before the tree view is realized, the centered path will be modified to reflect this change.

void Inti::Gtk::TreeView::scroll_to_point | ( | int | tree_x,
|  | int | tree_y
| ) |

Scrolls the tree view such that the top-left corner of the visible area is tree_x, tree_y, where tree_x and tree_y are specified in tree window coordinates.

Parameters:

  tree_x | The X coordinate of new top-left pixel of visible area, or -1.
  tree_y | The Y coordinate of new top-left pixel of visible area, or -1.

The tree view must be realized before this function is called. If it isn't, you probably want to be using scroll_to_cell(). If either tree_x or tree_y are -1, then that direction isn't scrolled.

void Inti::Gtk::TreeView::set_column_drag_function | ( | const ColumnDropSlot * | drop | ) |

Sets a user callback slot for determining where a column may be dropped when dragged.

Parameters:

  drop | A callback slot to determine which columns are reorderable, or null.

This slot is called on every column pair in turn at the beginning of a column drag to determine where a drop can take place. The arguments passed to the slot method are: the tree view, the TreeViewColumn being dragged and the two TreeViewColumns determining the drop spot. If either of the TreeViewColumn arguments for the drop spot are null, then they indicate an edge. If slot is set to be null, then tree view reverts to the default behavior of allowing all columns to be dropped everywhere.

void Inti::Gtk::TreeView::set_cursor | ( | const TreePath & | path,
|  | TreeViewColumn * | focus_column,
|  | bool | start_editing = false
| ) |

Sets the current keyboard focus to be at path, and selects it.

Parameters:

  path | A TreePath.
  focus_column | A TreeViewColumn, or null.
  start_editing | true if the specified cell should start being edited.

This is useful when you want to focus the user's attention on a particular row. If focus_column is not null, then focus is given to the column specified by it. Additionally, if focus_column is specified, and start_editing is true, then editing should be started in the specified cell. This function is often followed by Gtk::Widget::grab_focus() in order to give keyboard focus to the widget. Please note that editing can only happen when the widget is realized.

void Inti::Gtk::TreeView::set_cursor_on_cell | ( | const TreePath & | path,
|  | TreeViewColumn * | focus_column,
|  | CellRenderer * | focus_cell,
|  | bool | start_editing = false
| ) |

Sets the current keyboard focus to be at path, and selects it.

Parameters:

  path | A TreePath.
  focus_column | A TreeViewColumn, or null.
  focus_cell | A CellRenderer, or null.
  start_editing | Set true if the specified cell should start being edited.

This is useful when you want to focus the user's attention on a particular row. If focus_column is not null, then focus is given to the column specified by it. If focus_column and focus_cell are not null, and focus_column contains 2 or more editable or activatable cells, then focus is given to the cell specified by focus_cell. Additionally, if focus_column is specified, and start_editing is true, then editing should be started in the specified cell. This method is often followed by Gtk::Widget::grab_focus() in order to give keyboard focus to the tree view. Please note that editing can only happen when the widget is realized.

void Inti::Gtk::TreeView::set_drag_dest_row | ( | const TreePath & | path,
|  | TreeViewDropPosition | pos
| ) |

Sets where a dropped row goes.

Parameters:

  path | A TreePath to the destination row.
  pos | One of the position values in the TreeViewDropPosition enumeration.

void Inti::Gtk::TreeView::set_enable_search | ( | bool | enable_search | ) |

If enable_search is set, then the user can type in text to search through the tree interactively.

Parameters:

  enable_search | true if the user can search interactively.

void Inti::Gtk::TreeView::set_expander_column | ( | TreeViewColumn * | column | ) |

Sets the column to draw the expander arrow at.

Parameters:

  column | The column to draw the expander arrow at, or null.

It must be in the tree view. If column is null, then the expander arrow is always at the first visible column.

void Inti::Gtk::TreeView::set_hadjustment | ( | Adjustment * | adjustment | ) |

Sets the Adjustment for the current horizontal aspect.

Parameters:

  adjustment | The Adjustment to set, or null.

void Inti::Gtk::TreeView::set_headers_clickable | ( | bool | setting | ) |

Allow the column title buttons to be clicked.

Parameters:

  setting | true if the columns are clickable.

void Inti::Gtk::TreeView::set_headers_visible | ( | bool | headers_visible | ) |

Sets the visibility state of the headers.

Parameters:

  headers_visible | true if the headers are visible.

void Inti::Gtk::TreeView::set_model | ( | TreeModel * | model | ) |

Sets the model for the tree view.

Parameters:

  model | The model.

If the tree view already has a model set, it will remove it before setting the new model. If model is null, then it will unset the old model.

void Inti::Gtk::TreeView::set_reorderable | ( | bool | reorderable | ) |

This function is a convenience function to allow you to reorder models that support the drag-and-drop interface; both TreeStore and ListStore support these.

Parameters:

  reorderable | true if the tree can be reordered.

If reorderable is true, then the user can reorder the model by dragging and dropping rows. The developer can listen to these changes by connecting to the model's signals. This method does not give you any degree of control over the order, any reorderering is allowed. If more control is needed, you should probably handle drag and drop manually.

void Inti::Gtk::TreeView::set_rules_hint | ( | bool | setting | ) |

This method tells GTK+ that the user interface for your application requires users to read across tree rows and associate cells with one another.

Parameters:

  setting | true if the tree requires reading across rows.

By default, GTK+ will then render the tree with alternating row colors. Do not use it just because you prefer the appearance of the ruled tree; that's a question for the theme. Some themes will draw tree rows in alternating colors even when rules are turned off, and users who prefer that appearance all the time can choose those themes. You should call this method only as a semantic hint to the theme engine that your tree makes alternating colors useful from a functional standpoint (since it has lots of columns, generally).

void Inti::Gtk::TreeView::set_search_column | ( | int | column | ) |

Sets column as the column where the interactive search code should search in.

Parameters:

  column | The column of the model to search in.

Additionally, turns on interactive searching. Note that column refers to a column of the model.

void Inti::Gtk::TreeView::set_search_equal_func | ( | const SearchEqualSlot * | search_equal | ) |

Sets the compare slot for the interactive search capabilities.

Parameters:

  search_equal | The compare slot to call during the search.

void Inti::Gtk::TreeView::set_vadjustment | ( | Adjustment * | adjustment | ) |

Sets the Adjustment for the current vertical aspect.

Parameters:

  adjustment | The Adjustment to set, or null.

void Inti::Gtk::TreeView::tree_to_widget_coords | ( | int | tx,
|  | int | ty,
|  | int * | wx,
|  | int * | wy
| ) | const

Converts tree coordinates (coordinates in the full scrollable area of the tree) to widget coordinates.

Parameters:

  tx | The tree X coordinate.
  ty | The tree Y coordinate.
  wx | The return location for widget X coordinate.
  wy | The return location for widget Y coordinate.

void Inti::Gtk::TreeView::unset_rows_drag_dest | ( |  | ) |

| Clears information about a drop destination set with enable_model_drag_dest(). The tree view will no longer receive notification of drags.

void Inti::Gtk::TreeView::widget_to_tree_coords | ( | int | wx,
|  | int | wy,
|  | int * | tx,
|  | int * | ty
| ) | const

Converts widget coordinates to coordinates for the tree window (the full scrollable area of the tree).

Parameters:

  wx | The widget X coordinate.
  wy | The widget Y coordinate.
  tx | The return location for tree X coordinate.
  ty | The return location for tree Y coordinate.

The documentation for this class was generated from the following file:

- treeview.h

Main Page - Footer