1 // This file is a part of Simple Launcher
3 // Copyright (C) 2006, 2007, Mikhail Sobolev
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.
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
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
18 #ifndef _DIALOG_ENTRY_H_
19 #define _DIALOG_ENTRY_H_
21 #include <gtk/gtkwidget.h>
23 #include <hildon/hildon-number-editor.h>
25 #include "gconf-wrapper.h"
27 class SettingsDialogEntry {
29 virtual ~SettingsDialogEntry() {}
31 const std::string& name() const { return myName; }
32 virtual GtkWidget *getWidget() const = 0;
34 virtual void updateValue() = 0;
37 SettingsDialogEntry(GConfOption& option, const std::string& name): myOption(option), myName(name) {}
40 GConfOption& myOption;
41 const std::string myName;
44 class SettingsDialogStringEntry : public SettingsDialogEntry {
46 SettingsDialogStringEntry(GConfStringOption& option, const std::string& name): SettingsDialogEntry(option, name) {}
49 GtkWidget *getWidget() const;
52 class SettingsDialogBooleanEntry : public SettingsDialogEntry {
54 SettingsDialogBooleanEntry(GConfBooleanOption& option, const std::string& name);
57 GtkWidget *getWidget() const { return myWidget; }
63 class SettingsDialogIntegerEntry : public SettingsDialogEntry {
65 SettingsDialogIntegerEntry(GConfIntegerOption& option, const std::string& name, int minValue, int maxValue);
68 GtkWidget *getWidget() const { return GTK_WIDGET(mySpinBox); }
71 HildonNumberEditor *mySpinBox;
75 class SettingsDialogChoiceEntry : public SettingsDialogEntry {
77 SettingsDialogChoiceEntry(GConfIntegerOption& option, const std::string& name);
79 virtual const std::string& text(int index) const = 0;
80 virtual int numberOfChoices() const = 0;
81 virtual int initialValue() const = 0;
84 GtkWidget *getWidget() const { return myWidget; }
90 class SettingsDialogIconSizeEntry : public SettingsDialogChoiceEntry
93 class SettingsDialogIconSizeEntry : public SettingsDialogEntry {
95 SettingsDialogIconSizeEntry(GConfIntegerOption& option, const std::string& name);
99 GtkWidget *getWidget() const { return myWidget; }