| 1 |
/* Copyright (C) 2004 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtkmm/cellrenderertext.h> |
| 18 |
#include <gtkmm/treemodel.h> |
| 19 |
_DEFS(gtkmm,gtk) |
| 20 |
_PINCLUDE(gtkmm/private/cellrenderertext_p.h) |
| 21 |
|
| 22 |
|
| 23 |
namespace Gtk |
| 24 |
{ |
| 25 |
|
| 26 |
/** Renders a combobox in a cell. |
| 27 |
* CellRendererCombo renders text in a cell like CellRendererText, from which it is derived. But while |
| 28 |
* CellRendererText offers a simple entry to edit the text, CellRendererCombo offers a ComboBox or |
| 29 |
* ComboBoxEntry widget to edit the text. The values to display in the combo box are taken from the |
| 30 |
* tree model specified in the model property. |
| 31 |
* |
| 32 |
* The combo cell renderer takes care of adding a text cell renderer to the combo box and sets it to |
| 33 |
* display the column specified by its text_column property. Further cell renderers can be added in a |
| 34 |
* handler for the editing_started signal. |
| 35 |
* |
| 36 |
* @ingroup TreeView |
| 37 |
*/ |
| 38 |
class GTKMM_API CellRendererCombo : public CellRendererText |
| 39 |
{ |
| 40 |
_CLASS_GTKOBJECT(CellRendererCombo, GtkCellRendererCombo, GTK_CELL_RENDERER_COMBO, Gtk::CellRendererText, GtkCellRendererText, , , GTKMM_API) |
| 41 |
public: |
| 42 |
|
| 43 |
_CTOR_DEFAULT |
| 44 |
|
| 45 |
#m4begin |
| 46 |
dnl // We need this special conversion here since the C++ Gtk::TreeIter carries |
| 47 |
dnl // a pointer to the Gtk::TreeModel, whereas the plain GtkTreeIter struct does |
| 48 |
dnl // not. |
| 49 |
_CONVERSION(`GtkTreeIter*',`const TreeModel::iterator&',`TreeModel::iterator(_get_model(self), $3)') |
| 50 |
#m4end |
| 51 |
|
| 52 |
#m4 _CONVERSION(`const gchar*',`const Glib::ustring&',__GCHARP_TO_USTRING) |
| 53 |
_WRAP_SIGNAL(void changed(const Glib::ustring& path, const TreeModel::iterator& iter), "changed", no_default_handler) |
| 54 |
|
| 55 |
_WRAP_PROPERTY("model", Glib::RefPtr<Gtk::TreeModel>) |
| 56 |
_WRAP_PROPERTY("text_column", int) |
| 57 |
_WRAP_PROPERTY("has_entry", bool) |
| 58 |
|
| 59 |
Glib::PropertyProxy_Base _property_renderable() override; |
| 60 |
}; |
| 61 |
|
| 62 |
} //namespace Gtk |