Main Page
Widgets
Namespaces
Book
Gtk::TreeSelection Class Reference
[TreeView Classes ]
Typedefed as Gtk::TreeView::Selection .
More...
Inheritance diagram for Gtk::TreeSelection:
[legend ] List of all members.
Public Types
typedef SigC::Slot3< bool,
const Glib::RefPtr <TreeModel >&,
const TreeModel::Path &,
bool > SlotSelect
e.g. on_select_function(const Glib::RefPtr<TreeModel>& model, const TreeModel::Path& path, bool path_currently_selected)
typedef SigC::Slot1< void,
const TreeModel::iterator & > SlotForeachIter
typedef SigC::Slot1< void,
const TreeModel::Path & > SlotForeachPath
typedef SigC::Slot2< void,
const TreeModel::Path &,
const TreeModel::iterator & > SlotForeachPathAndIter
typedef Glib::ListHandle <
TreeModel::Path , TreePath_Traits > ListHandle_Path
Public Methods
virtual ~TreeSelection ()
GtkTreeSelection* gobj ()
const GtkTreeSelection* gobj () const
GtkTreeSelection* gobj_copy ()
void set_mode (SelectionMode type)
Sets the selection mode of the selection .
SelectionMode get_mode () const
Gets the selection mode for selection .
void set_select_function (const SlotSelect & slot)
TreeView * get_tree_view ()
Returns the tree view associated with selection .
const TreeView * get_tree_view () const
Returns the tree view associated with selection .
Glib::RefPtr <TreeModel > get_model ()
Shortcut for get_tree_view()->get_model() .
Glib::RefPtr <const TreeModel > get_model () const
TreeModel::iterator get_selected ()
Get the currently selected row.
TreeModel::iterator get_selected (Glib::RefPtr <TreeModel >& model)
Get the currently selected row.
void selected_foreach (const SlotForeachIter & slot)
void selected_foreach (const SlotForeachPath & slot)
void selected_foreach (const SlotForeachPathAndIter & slot)
void select (const TreeModel::Path & path)
Select the row at path .
void select (const TreeModel::iterator & iter)
Selects the specified iterator.
void select (const TreeModel::Row & row)
Selects the specified iterator.
void select (const TreeModel::Path & start_path, const TreeModel::Path & end_path)
Selects a range of nodes, determined by start_path and end_path inclusive.
void unselect (const TreeModel::Path & path)
Unselects the row at path .
void unselect (const TreeModel::Path & start_path, const TreeModel::Path & end_path)
Unselects a range of nodes, determined by start_path and end_path inclusive.
void unselect (const TreeModel::iterator & iter)
Unselects the specified iterator.
bool is_selected (const TreeModel::Path & path) const
Returns true
if the row pointed to by path is currently selected.
bool is_selected (const TreeModel::iterator & iter) const
Returns true
if the row at iter is currently selected.
void select_all ()
Selects all the nodes.
void unselect_all ()
Unselects all the nodes.
ListHandle_Path get_selected_rows () const
ListHandle_Path get_selected_rows (Glib::RefPtr <TreeModel >& model)
int count_selected_rows () const
Returns the number of rows that have been selected in tree .
Glib::SignalProxy0 <void> signal_changed ()
Protected Methods
virtual void on_changed ()
Related Functions
(Note that these are not member functions.)
Glib::RefPtr <Gtk::TreeSelection> wrap (GtkTreeSelection* object, bool take_copy=false)
Detailed Description
Typedefed as Gtk::TreeView::Selection .
This is a helper object to manage the selection for a Gtk::TreeView widget.
It is automatically created when a new Gtk::TreeView widget is created, and cannot exist independently of this widget. The primary reason this class exists is for cleanliness of code and API. That is, there is no conceptual reason all these methods could not be methods on the Gtk::TreeView widget instead of a separate class.
The Gtk::TreeSelection object can be obtained from a Gtk::TreeView by calling Gtk::TreeView::get_selection() . It can be manipulated to check the selection status of the tree, as well as to select and deselect individual rows. Selection is done completely view-side. As a result, multiple views of the same model can have completely different selections. Additionally, you cannot change the selection of a row on the model that is not currently displayed by the view without expanding its parents first.
When monitoring the selection of a view, it's important to remember that the "changed" signal is mostly a hint. That is, it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a "changed" signal when nothing has happened.
Member Typedef Documentation
typedef SigC::Slot1<void, const TreeModel::Path &> Gtk::TreeSelection::SlotForeachPath
e.g. on_select_function(const Glib::RefPtr<TreeModel>& model, const TreeModel::Path& path, bool path_currently_selected)
Constructor & Destructor Documentation
virtual Gtk::TreeSelection::~TreeSelection
(
)
[virtual]
Member Function Documentation
int Gtk::TreeSelection::count_selected_rows
(
)
const
Returns the number of rows that have been selected in tree .
Returns: The number of rows selected.
Since: 2.2.
Gets the selection mode for selection .
See set_mode() .
Returns: The current selection mode.
Get the currently selected row.
Returns: The currently selected row. Or NULL if no rows were selected.
Return values:
Note: This method won't work if the selection mode is Gtk::SELECTION_MULTIPLE
. Use selected_foreach() for multiple selections.
const TreeView * Gtk::TreeSelection::get_tree_view
(
)
const
Returns the tree view associated with selection .
Returns: A Gtk::TreeView .
TreeView * Gtk::TreeSelection::get_tree_view
(
)
Returns the tree view associated with selection .
Returns: A Gtk::TreeView .
const GtkTreeSelection* Gtk::TreeSelection::gobj
(
)
const [inline]
GtkTreeSelection* Gtk::TreeSelection::gobj
(
)
[inline]
GtkTreeSelection* Gtk::TreeSelection::gobj_copy
(
)
Returns true
if the row at iter is currently selected.
Parameters:
Returns: true
, if iter is selected.
Returns true
if the row pointed to by path is currently selected.
If path does not point to a valid location, false
is returned
Parameters:
Returns: true
if path is selected.
virtual void Gtk::TreeSelection::on_changed
(
)
[protected, virtual]
Selects a range of nodes, determined by start_path and end_path inclusive.
Parameters:
start_path The initial node of the range.
end_path The final node of the range.
Selects the specified iterator.
Parameters:
Selects the specified iterator.
Parameters:
Select the row at path .
Parameters:
void Gtk::TreeSelection::select_all
(
)
Sets the selection mode of the selection .
If the previous type was Gtk::SELECTION_MULTIPLE , then the anchor is kept selected, if it was previously selected.
Parameters:
void Gtk::TreeSelection::set_select_function
(
const SlotSelect &
slot
)
Unselects the specified iterator.
Parameters:
Unselects a range of nodes, determined by start_path and end_path inclusive.
Since: 2.2
Parameters:
start_path The initial node of the range.
end_path The initial node of the range.
Unselects the row at path .
Parameters:
void Gtk::TreeSelection::unselect_all
(
)
Friends And Related Function Documentation
Glib::RefPtr <Gtk::TreeSelection> wrap
(
GtkTreeSelection*
object ,
bool
take_copy = false
)
[related]
The documentation for this class was generated from the following file:
Generated for gtkmm by
Doxygen 1.3-rc1 © 1997-2001