/* Copyright (C) 2020 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/>.
 */

_CONFIGINCLUDE(gtkmmconfig.h)

#include <glibmm/object.h>
#include <gtkmm/listitemfactory.h>
#include <giomm/menumodel.h>
#include <gtkmm/sorter.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gtk
{
class GTKMM_API ColumnView;

/** The column added to Gtk::ColumnView.
 *
 * %Gtk::ColumnViewColumn represents the columns being added to Gtk::ColumnView.
 *
 * Columns have a title, and can optionally have a header menu set
 * with set_header_menu().
 *
 * A sorter can be associated with a column using set_sorter(), to let
 * users influence sorting by clicking on the column header.
 *
 * @see Gtk::ColumnView
 *
 * @ingroup ListView
 */
class GTKMM_API ColumnViewColumn : public Glib::Object
{
  _CLASS_GOBJECT(ColumnViewColumn, GtkColumnViewColumn, GTK_COLUMN_VIEW_COLUMN, Glib::Object, GObject, , , GTKMM_API)

protected:
  _WRAP_CTOR(ColumnViewColumn(const Glib::ustring& title, const Glib::RefPtr<ListItemFactory>& factory = {}), gtk_column_view_column_new)

public:
  _WRAP_CREATE(const Glib::ustring& title, const Glib::RefPtr<ListItemFactory>& factory = {})

#m4 _CONVERSION(`GtkColumnView*',`ColumnView*',__RP2P)
  _WRAP_METHOD(ColumnView* get_column_view(), gtk_column_view_column_get_column_view)
  _WRAP_METHOD(const ColumnView* get_column_view() const, gtk_column_view_column_get_column_view, constversion)
  _WRAP_METHOD(void set_factory(const Glib::RefPtr<ListItemFactory>& factory),
    gtk_column_view_column_set_factory)
  _WRAP_METHOD(Glib::RefPtr<ListItemFactory> get_factory(), gtk_column_view_column_get_factory, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const ListItemFactory> get_factory() const,
    gtk_column_view_column_get_factory, refreturn, constversion)

  _WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_column_view_column_set_title)
  _WRAP_METHOD(Glib::ustring get_title() const, gtk_column_view_column_get_title)

  _WRAP_METHOD(void set_sorter(const Glib::RefPtr<Sorter>& sorter), gtk_column_view_column_set_sorter)
  _WRAP_METHOD(Glib::RefPtr<Sorter> get_sorter(), gtk_column_view_column_get_sorter, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Sorter> get_sorter() const, gtk_column_view_column_get_sorter, refreturn, constversion)

  _WRAP_METHOD(void set_visible(bool visible = true), gtk_column_view_column_set_visible)
  _WRAP_METHOD(bool get_visible() const, gtk_column_view_column_get_visible)

  _WRAP_METHOD(void set_header_menu(const Glib::RefPtr<Gio::MenuModel>& model),
    gtk_column_view_column_set_header_menu)
  _WRAP_METHOD(Glib::RefPtr<Gio::MenuModel> get_header_menu(),
    gtk_column_view_column_get_header_menu, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::MenuModel> get_header_menu() const,
    gtk_column_view_column_get_header_menu, refreturn, constversion)

  _WRAP_METHOD(void set_fixed_width(int fixed_width), gtk_column_view_column_set_fixed_width)
  _WRAP_METHOD(int get_fixed_width() const, gtk_column_view_column_get_fixed_width)

  _WRAP_METHOD(void set_resizable(bool resizable = true), gtk_column_view_column_set_resizable)
  _WRAP_METHOD(bool get_resizable() const, gtk_column_view_column_get_resizable)

  _WRAP_METHOD(void set_expand(bool expand = true), gtk_column_view_column_set_expand)
  _WRAP_METHOD(bool get_expand() const, gtk_column_view_column_get_expand)

  _WRAP_METHOD(void set_id(const Glib::ustring& id), gtk_column_view_column_set_id)
  _WRAP_METHOD(Glib::ustring get_id() const, gtk_column_view_column_get_id)

  _WRAP_PROPERTY("column-view", ColumnView*)
  _WRAP_PROPERTY("factory", Glib::RefPtr<ListItemFactory>)
  _WRAP_PROPERTY("title", Glib::ustring)
  _WRAP_PROPERTY("sorter", Glib::RefPtr<Sorter>)
  _WRAP_PROPERTY("visible", bool)
  _WRAP_PROPERTY("header-menu", Glib::RefPtr<Gio::MenuModel>)
  _WRAP_PROPERTY("resizable", bool)
  _WRAP_PROPERTY("expand", bool)
  _WRAP_PROPERTY("fixed-width", int)
  _WRAP_PROPERTY("id", Glib::ustring)
};

} // namespace Gtk
