logo top
Main Page   Widgets   Namespaces   Book  

Gtk::TreeSelection Class Reference
[TreeView Classes]

Typedefed as Gtk::TreeView::Selection. More...

Inheritance diagram for Gtk::TreeSelection:

Inheritance graph
[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 Member Functions

virtual ~TreeSelection ()
GtkTreeSelection* gobj ()
 Provides access to the underlying C GObject.

const GtkTreeSelection* gobj () const
 Provides access to the underlying C GObject.

GtkTreeSelection* gobj_copy ()
void set_mode (SelectionMode type)
SelectionMode get_mode () const
void set_select_function (const SlotSelect& slot)
TreeViewget_tree_view ()
const TreeViewget_tree_view () const
Glib::RefPtr<TreeModelget_model ()
 Shortcut for get_tree_view()->get_model().

Glib::RefPtr<const TreeModelget_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)
void select (const TreeModel::iterator& iter)
void select (const TreeModel::Row& row)
void select (const TreeModel::Path& start_path, const TreeModel::Path& end_path)
void unselect (const TreeModel::Path& path)
void unselect (const TreeModel::Path& start_path, const TreeModel::Path& end_path)
void unselect (const TreeModel::iterator& iter)
bool is_selected (const TreeModel::Path& path) const
bool is_selected (const TreeModel::iterator& iter) const
void select_all ()
void unselect_all ()
ListHandle_Path get_selected_rows () const
ListHandle_Path get_selected_rows (Glib::RefPtr<TreeModel>& model)
int count_selected_rows () const
Glib::SignalProxy0<void> signal_changed ()

Protected Member Functions

virtual void on_changed ()

Related Functions

(Note that these are not member functions.)

Glib::RefPtr<Gtk::TreeSelectionwrap (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 Glib::ListHandle<TreeModel::Path, TreePath_Traits> Gtk::TreeSelection::ListHandle_Path
 

typedef SigC::Slot1<void, const TreeModel::iterator&> Gtk::TreeSelection::SlotForeachIter
 

typedef SigC::Slot1<void, const TreeModel::Path&> Gtk::TreeSelection::SlotForeachPath
 

typedef SigC::Slot2<void, const TreeModel::Path&, const TreeModel::iterator&> Gtk::TreeSelection::SlotForeachPathAndIter
 

typedef SigC::Slot3<bool, const Glib::RefPtr<TreeModel>&, const TreeModel::Path&, bool> Gtk::TreeSelection::SlotSelect
 

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
 

SelectionMode Gtk::TreeSelection::get_mode (  )  const
 

Glib::RefPtr<const TreeModel> Gtk::TreeSelection::get_model (  )  const
 

Glib::RefPtr<TreeModel> Gtk::TreeSelection::get_model (  ) 
 

Shortcut for get_tree_view()->get_model().

Returns:
The TreeModel associated with this TreeSelection.

TreeModel::iterator Gtk::TreeSelection::get_selected ( Glib::RefPtr<TreeModel>&  model  ) 
 

Get the currently selected row.

Returns:
The currently selected row. Or NULL if no rows were selected.
Return values:
model The current TreeModel.
Note:
This method won't work if the selection mode is Gtk::SELECTION_MULTIPLE. Use selected_foreach() for multiple selections.

TreeModel::iterator Gtk::TreeSelection::get_selected (  ) 
 

Get the currently selected row.

Returns:
The currently selected row.
Note:
This method won't work if the selection mode is Gtk::SELECTION_MULTIPLE. Use selected_foreach() for multiple selections.

ListHandle_Path Gtk::TreeSelection::get_selected_rows ( Glib::RefPtr<TreeModel>&  model  ) 
 

ListHandle_Path Gtk::TreeSelection::get_selected_rows (  )  const
 

const TreeView* Gtk::TreeSelection::get_tree_view (  )  const
 

TreeView* Gtk::TreeSelection::get_tree_view (  ) 
 

const GtkTreeSelection* Gtk::TreeSelection::gobj (  )  const [inline]
 

Provides access to the underlying C GObject.

GtkTreeSelection* Gtk::TreeSelection::gobj (  )  [inline]
 

Provides access to the underlying C GObject.

GtkTreeSelection* Gtk::TreeSelection::gobj_copy (  ) 
 

bool Gtk::TreeSelection::is_selected ( const TreeModel::iterator iter  )  const
 

bool Gtk::TreeSelection::is_selected ( const TreeModel::Path path  )  const
 

virtual void Gtk::TreeSelection::on_changed (  )  [protected, virtual]
 

void Gtk::TreeSelection::select ( const TreeModel::Path start_path,
const TreeModel::Path end_path
 

void Gtk::TreeSelection::select ( const TreeModel::Row row  ) 
 

void Gtk::TreeSelection::select ( const TreeModel::iterator iter  ) 
 

void Gtk::TreeSelection::select ( const TreeModel::Path path  ) 
 

void Gtk::TreeSelection::select_all (  ) 
 

void Gtk::TreeSelection::selected_foreach ( const SlotForeachPathAndIter slot  ) 
 

void Gtk::TreeSelection::selected_foreach ( const SlotForeachPath slot  ) 
 

void Gtk::TreeSelection::selected_foreach ( const SlotForeachIter slot  ) 
 

void Gtk::TreeSelection::set_mode ( SelectionMode  type  ) 
 

void Gtk::TreeSelection::set_select_function ( const SlotSelect slot  ) 
 

Glib::SignalProxy0<void> Gtk::TreeSelection::signal_changed (  ) 
 

Prototype:
void changed()

void Gtk::TreeSelection::unselect ( const TreeModel::iterator iter  ) 
 

void Gtk::TreeSelection::unselect ( const TreeModel::Path start_path,
const TreeModel::Path end_path
 

void Gtk::TreeSelection::unselect ( const TreeModel::Path path  ) 
 

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 gtkmm2.2 by Doxygen 1.3.3 © 1997-2001