TreeModel.h
Go to the documentation of this file.00001 #ifndef TREEMODEL_H_
00002 #define TREEMODEL_H_
00003
00004 #include <string>
00005
00006 #include <gtk/gtktreemodel.h>
00007 #include <gtk/gtktreeselection.h>
00008
00009 namespace gtkutil
00010 {
00011
00017 class TreeModel
00018 {
00019 public:
00020
00033 static std::string getString (GtkTreeModel* model, GtkTreeIter* iter, gint colNo);
00034
00046 static bool getBoolean (GtkTreeModel* model, GtkTreeIter* iter, gint colNo);
00047
00059 static int getInt (GtkTreeModel* model, GtkTreeIter* iter, gint colNo);
00060
00072 static gpointer getPointer (GtkTreeModel* model, GtkTreeIter* iter, gint colNo);
00073
00085 static std::string getSelectedString (GtkTreeSelection* selection, gint colNo);
00086
00099 static std::string getSelectedParentString (GtkTreeSelection* sel, gint colNo);
00100
00114 static bool getSelectedBoolean (GtkTreeSelection* selection, gint colNo);
00115
00127 static gpointer getSelectedPointer (GtkTreeSelection* selection, gint colNo);
00128
00138 static gboolean equalFuncStringContains (GtkTreeModel* model, gint column, const gchar* key,
00139 GtkTreeIter* iter, gpointer search_data);
00140
00141
00142
00143
00144
00145
00146 class SelectionFinder
00147 {
00148
00149
00150 std::string _selection;
00151
00152
00153 int _needle;
00154
00155
00156 GtkTreePath* _path;
00157
00158
00159 GtkTreeModel* _model;
00160
00161
00162 int _column;
00163
00164
00165 bool _searchForInt;
00166
00167 public:
00168
00169
00170 SelectionFinder (const std::string& selection, int column);
00171
00172
00173 SelectionFinder (int needle, int column);
00174
00175
00176
00177 GtkTreePath* getPath ();
00178
00182 GtkTreeIter getIter ();
00183
00184
00185 static gboolean
00186 forEach (GtkTreeModel* model, GtkTreePath* path, GtkTreeIter* iter, gpointer vpSelf);
00187
00188 };
00189 };
00190
00191 }
00192
00193 #endif