| 1 | #ifndef _GTKMM_CELLRENDERER_GENERATION_H |
| 2 | #define _GTKMM_CELLRENDERER_GENERATION_H |
| 3 | /* cellrenderer_generation.h |
| 4 | * |
| 5 | * Copyright (C) 2003 The gtkmm Development Team |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2.1 of the License, or(at your option) any later version. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 19 | */ |
| 20 | |
| 21 | #include <gtkmm/cellrenderertext.h> |
| 22 | #include <gtkmm/cellrendererpixbuf.h> |
| 23 | #include <gtkmm/cellrenderertoggle.h> |
| 24 | #include <gtkmm/cellrendereraccel.h> |
| 25 | |
| 26 | namespace Gtk |
| 27 | { |
| 28 | |
| 29 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 30 | namespace CellRenderer_Generation |
| 31 | { |
| 32 | |
| 33 | template<class T_ModelColumnType> //e.g. bool or Glib::ustring. |
| 34 | CellRenderer* generate_cellrenderer(bool editable = false) |
| 35 | { |
| 36 | auto cell_renderer = new CellRendererText(); //the default - template specializations will use other renderers. |
| 37 | //CellRendererText can render both strings and numerical values. |
| 38 | |
| 39 | cell_renderer->property_editable() = editable; |
| 40 | |
| 41 | return cell_renderer; |
| 42 | } |
| 43 | |
| 44 | #if !defined(__GNUC__) || __GNUC__ > 2 |
| 45 | // gcc 2.95.x fails in TreeView::append_column_editable if the |
| 46 | // following specializations are declared in the header. |
| 47 | template<> GTKMM_API |
| 48 | CellRenderer* generate_cellrenderer<bool>(bool editable); |
| 49 | |
| 50 | template<> GTKMM_API |
| 51 | CellRenderer* generate_cellrenderer< Glib::RefPtr<Gdk::Pixbuf> >(bool editable); |
| 52 | |
| 53 | template<> GTKMM_API |
| 54 | CellRenderer* generate_cellrenderer<AccelKey>(bool editable); |
| 55 | |
| 56 | #endif |
| 57 | |
| 58 | } //CellRenderer_Generation |
| 59 | #endif //DOXYGEN_SHOULD_SKIP_THIS |
| 60 | |
| 61 | } // namespace Gtk |
| 62 | |
| 63 | #endif /* _GTKMM_CELLRENDERER_GENERATION_H */ |