ApplicationItemFactory:
[simple-launcher] / settings-page-items.h
1 // This file is a part of Simple Launcher
2 //
3 // Copyright (C) 2006, 2007, Mikhail Sobolev
4 //
5 // Simple Launcher is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 as published by
7 // the Free Software Foundation.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12 // more details.
13 //
14 // You should have received a copy of the GNU General Public License along with
15 // this program; if not, write to the Free Software Foundation, Inc., 51
16 // Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 #ifndef __SETTINGS_PAGE_ITEMS_H_
19 #define __SETTINGS_PAGE_ITEMS_H_
20
21 #include <gtk/gtkliststore.h>
22 #include <gtk/gtktreeview.h>
23 #include <gtk/gtkbutton.h>
24 #include <gtk/gtkcellrenderertoggle.h>
25
26 #include "launcher-item.h"
27 #include "settings-page.h"
28
29 class SettingsPageWithItems : public SettingsPage {
30 public:
31   SettingsPageWithItems(int, LauncherItems&);
32  ~SettingsPageWithItems();
33
34   GtkWidget *getWidget() const { return myWidget; }
35
36   void updateValues();
37
38 private:
39   static void _selectionChanged(GtkTreeSelection *, gpointer);
40
41          void selectionChanged(GtkTreeSelection *);
42          void kickIt(GtkTreeIter *);
43
44   static void _renderText(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer self);
45   static void _renderBool(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter, gpointer self);
46   static void _moveUp(GtkButton *, void *);
47   static void _moveDown(GtkButton *, void *);
48   static void _toggleBool(GtkCellRendererToggle *, const gchar *, void *);
49
50   void renderText(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter);
51   void renderBool(GtkTreeViewColumn *column, GtkCellRenderer *cell, GtkTreeModel *model, GtkTreeIter *iter);
52   void moveUp(GtkButton *);
53   void moveDown(GtkButton *);
54   void toggleBool(GtkCellRendererToggle *, const gchar *);
55
56   void swap(GtkTreeIter& a, GtkTreeIter& b);
57
58 private:
59   GtkWidget *myWidget;
60   GtkListStore *myStore;
61   GtkTreeView *myView;
62   GtkTreeSelection *mySelection;
63
64   GtkTreeIter *myLastSelection;
65
66   LauncherItems& myItems;
67 };
68
69 #endif
70
71 // vim:ts=2:sw=2:et