/* Copyright (C) 2022 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 <http://www.gnu.org/licenses/>.
 */

#include <gtk/gtk.h>

namespace Gtk
{

std::pair<Glib::RefPtr<ColumnViewColumn>, SortType>
ColumnViewSorter::get_nth_sort_column(unsigned int position)
{
  GtkSortType sort_order;
  auto retvalue = Glib::wrap(gtk_column_view_sorter_get_nth_sort_column(gobj(), position, (GtkSortType*)&sort_order));
  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return {retvalue, (SortType)sort_order};
}

std::pair<Glib::RefPtr<const ColumnViewColumn>, SortType>
ColumnViewSorter::get_nth_sort_column(unsigned int position) const
{
  return const_cast<ColumnViewSorter*>(this)->get_nth_sort_column(position);
}

} // namespace Gtk
