/* Copyright (C) 1998-2002 The gtkmm Development Team
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see .
*/
#include
typedef Gtk::TreeModel::Path Path; //So that the generated method implemenations can use this a return type.
namespace Gtk
{
TreeModel::iterator TreeModelSort::convert_child_iter_to_iter(const iterator& child_iter) const
{
TreeIter sorted_iter (const_cast(this));
gtk_tree_model_sort_convert_child_iter_to_iter(
const_cast(gobj()), sorted_iter.gobj(),
const_cast(child_iter.gobj()));
return sorted_iter;
}
TreeModel::iterator TreeModelSort::convert_iter_to_child_iter(const iterator& sorted_iter) const
{
const auto child_model = gtk_tree_model_sort_get_model(const_cast(gobj()));
TreeIter child_iter (dynamic_cast(Glib::wrap_auto((GObject*) child_model, false)));
gtk_tree_model_sort_convert_iter_to_child_iter(
const_cast(gobj()), child_iter.gobj(),
const_cast(sorted_iter.gobj()));
return child_iter;
}
void TreeModelSort::set_value_impl(const iterator& row, int column, const Glib::ValueBase& value)
{
// Avoid two extra ref/unref cycles -- we don't store the child
// model pointer anywhere, so it's OK to do this _internally_.
const auto child_model = dynamic_cast(
Glib::wrap_auto((GObject*) gtk_tree_model_sort_get_model(gobj()), false));
TreeIter child_iter (child_model);
gtk_tree_model_sort_convert_iter_to_child_iter(
gobj(), child_iter.gobj(), const_cast(row.gobj()));
child_model->set_value_impl(child_iter, column, value);
}
} // namespace Gtk