1/*
2 * Copyright (C) 2004 The gtkmm Development Team
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19#m4 _PUSH(SECTION_CC_PRE_INCLUDES)
20#undef GTK_DISABLE_DEPRECATED
21#m4 _POP()
22_CONFIGINCLUDE(gtkmmconfig.h)
23
24#include <gtkmm/widget.h>
25#include <gtkmm/celllayout.h>
26#include <gtkmm/treemodel.h>
27#include <gtkmm/treepath.h>
28#include <gtkmm/cellrenderer.h>
29#include <gdkmm/pixbuf.h>
30
31_DEFS(gtkmm,gtk)
32_PINCLUDE(gtkmm/private/widget_p.h)
33
34namespace Gtk
35{
36
37/** A widget displaying a single row of a TreeModel.
38 * A CellView displays a single row of a TreeModel, using cell renderers just like TreeView. CellView doesn't support some of the more
39 * complex features of GtkTreeView, like cell editing and drag and drop.
40 *
41 * @ingroup Widgets
42 */
43class CellView :
44  public Widget,
45  public CellLayout
46{
47  _CLASS_GTKOBJECT(CellView, GtkCellView, GTK_CELL_VIEW, Gtk::Widget, GtkWidget)
48  _IMPLEMENTS_INTERFACE(CellLayout)
49
50public:
51  _CTOR_DEFAULT()
52
53  /** Creates a new CellView widget, adds a CellRendererText to it, and makes it show the text.
54   * Optionally, the text can be marked up with the Pango text markup language.
55   *
56   * @param text The text to display in the cell view
57   * @param markup Whether the @a text uses Pango text markup language.
58   */
59  explicit CellView(const Glib::ustring& text, bool use_markup = false);
60  _IGNORE(gtk_cell_view_new_with_text, gtk_cell_view_new_with_markup)
61
62  /** Creates a new CellView widget, adds a CellRendererPixbuf to it, and makes it show the pixbuf.
63   *
64   * @param pixbuf The image to display in the cell view
65   * @param markup Whether the @a text uses Pango text markup language.
66   */
67  explicit CellView(const Glib::RefPtr<Gdk::Pixbuf>& pixbuf);
68  _IGNORE(gtk_cell_view_new_with_pixbuf)
69
70  //_WRAP_METHOD(void set_value(CellRenderer& renderer, const Glib::ustring& property, const Glib::ValueBase& value), gtk_cell_view_set_value)
71  _IGNORE(gtk_cell_view_set_values)
72
73  _WRAP_METHOD(void set_model(const Glib::RefPtr<TreeModel>& model), gtk_cell_view_set_model)
74
75  /** Remove the model from the CellView.
76   *
77   * @see set_model().
78   *
79   * @newin{2,16}
80   */
81  void unset_model();
82
83  _WRAP_METHOD(Glib::RefPtr<TreeModel> get_model(), gtk_cell_view_get_model, refreturn)
84  _WRAP_METHOD(Glib::RefPtr<const TreeModel> get_model() const, gtk_cell_view_get_model, refreturn, constversion)
85
86  _WRAP_METHOD(void set_displayed_row(const TreeModel::Path& path), gtk_cell_view_set_displayed_row)
87  _WRAP_METHOD(TreeModel::Path get_displayed_row() const, gtk_cell_view_get_displayed_row)
88  _WRAP_METHOD(bool get_size_of_row(const TreeModel::Path& path, Requisition& requisition) const, gtk_cell_view_get_size_of_row)
89
90  _WRAP_METHOD(void set_background_color(const Gdk::Color& color), gtk_cell_view_set_background_color)
91
92  _WRAP_METHOD(Glib::ListHandle<CellRenderer*> get_cell_renderers(),
93               gtk_cell_view_get_cell_renderers, deprecated)
94  _WRAP_METHOD(Glib::ListHandle<const CellRenderer*> get_cell_renderers() const,
95               gtk_cell_view_get_cell_renderers, deprecated)
96
97  _WRAP_PROPERTY("background", Glib::ustring)
98  _WRAP_PROPERTY("background-gdk", Gdk::Color)
99  _WRAP_PROPERTY("background-set", bool)
100  _WRAP_PROPERTY("model", Glib::RefPtr<TreeModel>)
101};
102
103} // namespace Gtk
104