MIDI branch becomes trunk
[ardour.git] / libs / gtkmm2 / gtk / gtkmm / cellrenderer_generation.h
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 Library General Public
11  * License as published by the Free Software Foundation; either
12  * version 2 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  * Library General Public License for more details.
18  *
19  * You should have received a copy of the GNU Library 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>
25 #include <gtkmm/cellrendererpixbuf.h>
26 #include <gtkmm/cellrenderertoggle.h>
27
28 namespace Gtk
29 {
30
31 #ifndef DOXYGEN_SHOULD_SKIP_THIS
32 namespace CellRenderer_Generation
33 {
34
35 template<class T_ModelColumnType> //e.g. bool or Glib::ustring.
36 CellRenderer* generate_cellrenderer(bool editable = false)
37 {
38   CellRendererText* pCellRenderer = new CellRendererText(); //the default - template specializations will use other renderers.
39   //CellRendererText can render both strings and numerical values.
40
41   pCellRenderer->property_editable() = editable;
42   return pCellRenderer;
43 }
44
45 #if !defined(__GNUC__) || __GNUC__ > 2
46 // gcc 2.95.x fails in TreeView::append_column_editable if the
47 // following specializations are declared in the header.
48 template<>
49 CellRenderer* generate_cellrenderer<bool>(bool editable);
50
51 template<>
52 CellRenderer* generate_cellrenderer< Glib::RefPtr<Gdk::Pixbuf> >(bool editable);
53
54 #endif
55
56 } //CellRenderer_Generation
57 #endif //DOXYGEN_SHOULD_SKIP_THIS
58
59 } // namespace Gtk
60
61
62 #endif /* _GTKMM_CELLRENDERER_GENERATION_H */