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

_CONFIGINCLUDE(gtkmmconfig.h)

#include <gtkmm/widget.h>
#include <gtkmm/celllayout.h>
#include <gtkmm/treemodel.h>
#include <gtkmm/treepath.h>
#include <gtkmm/cellrenderer.h>
#include <gtkmm/cellarea.h>
#include <gtkmm/cellareacontext.h>
#include <gtkmm/orientable.h>
#include <gdkmm/texture.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/widget_p.h)

#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
#undef GTK_DISABLE_DEPRECATED
#define GDK_DISABLE_DEPRECATION_WARNINGS 1
#m4 _POP()

_IS_DEPRECATED // The entire file is deprecated.

namespace Gtk
{

/** A widget displaying a single row of a TreeModel.
 * A CellView displays a single row of a TreeModel, using cell renderers just like TreeView. CellView doesn't support some of the more
 * complex features of GtkTreeView, like cell editing and drag and drop.
 *
 * @ingroup Widgets
 * @deprecated 4.10: List views use widgets to display their contents.
 *   You can use Gtk::Box instead.
 */
class GTKMM_API CellView :
  public Widget,
  public CellLayout,
  public Orientable
{
  _CLASS_GTKOBJECT(CellView, GtkCellView, GTK_CELL_VIEW, Gtk::Widget, GtkWidget, , , GTKMM_API)
  _IMPLEMENTS_INTERFACE(CellLayout)
  _IMPLEMENTS_INTERFACE(Orientable)

public:
  _CTOR_DEFAULT()

  /** Creates a new CellView widget, adds a CellRendererText to it, and makes it show the text.
   * Optionally, the text can be marked up with the Pango text markup language.
   *
   * @param text The text to display in the cell view
   * @param use_markup Whether the @a text uses Pango text markup language.
   */
  explicit CellView(const Glib::ustring& text, bool use_markup = false);
  _IGNORE(gtk_cell_view_new_with_text, gtk_cell_view_new_with_markup)

  /** Creates a new %CellView widget, adds a CellRendererPixbuf to it, and makes it show the texure.
   *
   * @param texture The image to display in the cell view.
   */
  explicit CellView(const Glib::RefPtr<Gdk::Texture>& texture);
  _IGNORE(gtk_cell_view_new_with_texture)

  /** Sets the model for @a cell_view.
   * If @a cell_view already has a model set, it will remove it before setting
   * the new model. Use unset_model() to unset the old model.
   *
   * Deprecated: 4.10
   *
   * @param model A `Gtk::TreeModel`.
   */
  _WRAP_METHOD(void set_model(const Glib::RefPtr<TreeModel>& model), gtk_cell_view_set_model)

  /** Remove the model from the CellView.
   *
   * @see set_model().
   */
  void unset_model();

  _WRAP_METHOD(Glib::RefPtr<TreeModel> get_model(), gtk_cell_view_get_model, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const TreeModel> get_model() const, gtk_cell_view_get_model, refreturn, constversion)

  _WRAP_METHOD(void set_displayed_row(const TreeModel::Path& path), gtk_cell_view_set_displayed_row)
  _WRAP_METHOD(TreeModel::Path get_displayed_row() const, gtk_cell_view_get_displayed_row)

  _WRAP_METHOD(bool get_draw_sensitive() const, gtk_cell_view_get_draw_sensitive)
  _WRAP_METHOD(void set_draw_sensitive(bool draw_sensitive = true), gtk_cell_view_set_draw_sensitive)
  _WRAP_METHOD(bool get_fit_model() const, gtk_cell_view_get_fit_model)
  _WRAP_METHOD(void set_fit_model(bool fit_model = true), gtk_cell_view_set_fit_model)

  _WRAP_PROPERTY("model", Glib::RefPtr<TreeModel>)
  _WRAP_PROPERTY("cell-area", Glib::RefPtr<CellArea>)
  _WRAP_PROPERTY("cell-area-context", Glib::RefPtr<CellAreaContext>)
  _WRAP_PROPERTY("draw-sensitive", bool)
  _WRAP_PROPERTY("fit-model", bool)
};

} // namespace Gtk
