Gtk2::Ex::TreeViewBits - various helpers for Gtk2::TreeView
Gtk2::Ex::TreeViewBits::toggle_expand_row ($treeview, $path)
Toggle the row at
$pathbetween expanded or collapsed.
This is a simple combination of check
collapse_row. It's handy for making a toggle in the style of the Space key (
toggle-cursor-row), but say on a button press rather than the cursor row.
See examples/treeview-toggle-expand.pl in the Gtk2-Ex-WidgetBits sources for a complete program using this under a
Remove the currently selected rows of
$treeviewfrom the underlying TreeModel. If nothing is selected then do nothing.
Rows are removed using
Gtk2::TreeStore. The model doesn't have to be a ListStore or TreeStore, only something with a compatible
Currently this is implemented by tracking rows to be removed using a
Gtk2::TreeRowReferenceon each and removing them one by one. This isn't fast, but is safe against additional changes to the model or the selection during the removals.
Gtk2::Ex::TreeViewBits::scroll_cursor_to_path ($treeview, $path)
Move the TreeView cursor to
$path, expanding and scrolling if necessary to ensure the row is then visible.
This function is a combination of
scroll_to_cell(), except the scroll is skipped if
$pathis already fully visible. Avoiding a scroll is good because it avoids content jumping around when merely moving to different nearby rows.
When a scroll is done the row is centred in the
$treeviewwindow. If the row is bigger than the window then it's positioned at the start of the window.
As of Gtk 2.12.12, if a TreeView is in
fixed-height-mode and the last row is unexpanded then a
scroll_cursor_to_path() to a sub-row of it doesn't scroll correctly. It expands, moves the cursor, but the scroll goes only to that last parent row, not the intended sub-row. Believe this is a bug in Gtk.
Copyright 2007, 2008, 2009, 2010, 2011, 2012 Kevin Ryde
Gtk2-Ex-WidgetBits is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version.
Gtk2-Ex-WidgetBits is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Gtk2-Ex-WidgetBits. If not, see http://www.gnu.org/licenses/.