IconTextColumn.h
Go to the documentation of this file.00001 #ifndef ICONTEXTCOLUMN_H_
00002 #define ICONTEXTCOLUMN_H_
00003
00004 #include <gtk/gtktreeviewcolumn.h>
00005 #include <gtk/gtkcellrenderertext.h>
00006 #include <gtk/gtkcellrendererpixbuf.h>
00007
00008 namespace gtkutil
00009 {
00010
00015 class IconTextColumn
00016 {
00017
00018 GtkTreeViewColumn* _column;
00019
00020 public:
00021
00038 IconTextColumn (const std::string& title, gint textCol, gint iconCol, bool useMarkup = false)
00039 {
00040
00041 _column = gtk_tree_view_column_new();
00042 gtk_tree_view_column_set_title(_column, title.c_str());
00043 gtk_tree_view_column_set_spacing(_column, 3);
00044
00045
00046 GtkCellRenderer* pixRend = gtk_cell_renderer_pixbuf_new();
00047 gtk_tree_view_column_pack_start(_column, pixRend, FALSE);
00048 gtk_tree_view_column_set_attributes(_column, pixRend, "pixbuf", iconCol, NULL);
00049
00050
00051 GtkCellRenderer* textRend = gtk_cell_renderer_text_new();
00052 gtk_tree_view_column_pack_start(_column, textRend, FALSE);
00053 gtk_tree_view_column_set_attributes(_column, textRend, useMarkup ? "markup" : "text", textCol, NULL);
00054 }
00055
00059 operator GtkTreeViewColumn* ()
00060 {
00061 return _column;
00062 }
00063 };
00064
00065 }
00066
00067 #endif