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