5 Author: Pekka Riikonen <priikone@silcnet.org>
7 Copyright (C) 2001 Pekka Riikonen
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
20 #ifndef SILCERBASEWIN_HH
21 #define SILCERBASEWIN_HH
23 #include "silcer_gladehelper.hh"
25 #include "silcincludes.h"
26 #include "silcclient.h"
28 #include <sigc++/signal_system.h>
29 #include <sigc++/object_slot.h>
30 #include <sigc++/marshal.h>
31 #include <glade/glade-xml.h>
32 #include <gtk--/box.h>
33 #include <gtk--/button.h>
34 #include <gtk--/checkbutton.h>
35 #include <gtk--/ctree.h>
36 #include <gtk--/entry.h>
37 #include <gtk--/eventbox.h>
38 #include <gtk--/frame.h>
39 #include <gtk--/label.h>
40 #include <gtk--/menuitem.h>
41 #include <gtk--/optionmenu.h>
42 #include <gtk--/text.h>
43 #include <gtk--/widget.h>
44 #include <gtk--/window.h>
45 #include <gnome--/dialog.h>
46 #include <gnome--/entry.h>
47 #include <gnome--/pixmap.h>
48 #include <gnome--/pixmapmenuitem.h>
52 class SilcerBaseWindow : public SigC::Object
55 SilcerBaseWindow(const char *widgetname);
56 virtual ~SilcerBaseWindow();
58 void show() { _thisWindow->show(); }
59 void hide() { _thisWindow->hide(); }
62 virtual void set_dynamic();
64 Signal0<void, Marshal<void> > evtDestroy;
68 // FIXME: Should make this function properly copy
69 SilcerBaseWindow& operator=(const SilcerBaseWindow&) { return *this;}
70 SilcerBaseWindow(const SilcerBaseWindow&) {}
75 Gtk::Button *getButton(const char *name)
76 { return SilcerGetWidget<Gtk::Button>(_thisGH, name); }
78 Gtk::CheckButton *getCheckButton(const char *name)
79 { return SilcerGetWidget<Gtk::CheckButton>(_thisGH, name); }
81 Gtk::CTree *getCTree(const char *name)
82 { return SilcerGetWidget<Gtk::CTree>(_thisGH, name); }
84 Gtk::Entry *getEntry(const char *name)
85 { return SilcerGetWidget<Gtk::Entry>(_thisGH, name); }
87 Gtk::EventBox *getEventBox(const char *name)
88 { return SilcerGetWidget<Gtk::EventBox>(_thisGH, name); }
90 Gtk::Frame *getFrame(const char *name)
91 { return SilcerGetWidget<Gtk::Frame>(_thisGH, name); }
93 Gtk::HBox *getHBox(const char *name)
94 { return SilcerGetWidget<Gtk::HBox>(_thisGH, name); }
96 Gnome::Entry *getGEntry(const char *name)
97 { return SilcerGetWidget<Gnome::Entry>(_thisGH, name); }
99 Gtk::Label *getLabel(const char *name)
100 { return SilcerGetWidget<Gtk::Label>(_thisGH, name); }
102 Gtk::MenuItem *getMenuItem(const char *name)
103 { return SilcerGetWidget<Gtk::MenuItem>(_thisGH, name); }
105 Gtk::OptionMenu *getOptionMenu(const char *name)
106 { return SilcerGetWidget<Gtk::OptionMenu>(_thisGH, name); }
108 Gnome::Pixmap *getPixmap(const char *name)
109 { return SilcerGetWidget<Gnome::Pixmap>(_thisGH, name); }
111 Gtk::PixmapMenuItem *getPixmapMenuItem(const char *name)
112 { return SilcerGetWidget<Gtk::PixmapMenuItem>(_thisGH, name); }
114 Gtk::Text *getText(const char *name)
115 { return SilcerGetWidget<Gtk::Text>(_thisGH, name); }
117 Gtk::VBox *getVBox(const char *name)
118 { return SilcerGetWidget<Gtk::VBox>(_thisGH, name); }
120 template <class T> T *getWidget(const char *name)
121 { return SilcerGetWidget<T>(_thisGH, name); }
124 Gtk::Window *_thisWindow;
130 class SilcerBaseDialog : public SilcerBaseWindow
133 SilcerBaseDialog(const char *widgetname, gboolean close_hides = false);
134 virtual ~SilcerBaseDialog() {}
137 Gnome::Dialog *_thisDialog;
138 gboolean on_Dialog_close();
141 class SilcerBaseWidget : public SigC::Object
144 SilcerBaseWidget(const char* widgetname, const char* filename);
145 virtual ~SilcerBaseWidget();
146 void show() { _thisWidget->show(); }
147 void hide() { _thisWidget->hide(); }
148 Gtk::Widget* get_this_widget() { return _thisWidget; }
149 virtual void close();
151 virtual void set_dynamic();
152 // Destruction signal
153 Signal0<void, Marshal<void> > evtDestroy;
156 // FIXME: Should make this function properly copy
157 SilcerBaseWidget& operator=(const SilcerBaseWidget&) { return *this;}
158 SilcerBaseWidget(const SilcerBaseWidget&) {}
162 Gtk::Button *getButton(const char *name)
163 { return SilcerGetWidget<Gtk::Button>(_thisGH, name); }
165 Gtk::CheckButton *getCheckButton(const char *name)
166 { return SilcerGetWidget<Gtk::CheckButton>(_thisGH, name); }
168 Gtk::Entry *getEntry(const char *name)
169 { return SilcerGetWidget<Gtk::Entry>(_thisGH, name); }
171 Gtk::Label *getLabel(const char *name)
172 { return SilcerGetWidget<Gtk::Label>(_thisGH, name); }
174 Gtk::MenuItem *getMenuItem(const char *name)
175 { return SilcerGetWidget<Gtk::MenuItem>(_thisGH, name); }
177 Gtk::OptionMenu *getOptionMenu(const char *name)
178 { return SilcerGetWidget<Gtk::OptionMenu>(_thisGH, name); }
180 Gtk::PixmapMenuItem *getPixmapMenuItem(const char *name)
181 { return SilcerGetWidget<Gtk::PixmapMenuItem>(_thisGH, name); }
183 Gtk::Text *getText(const char *name)
184 { return SilcerGetWidget<Gtk::Text>(_thisGH, name); }
186 template <class T> T *getWidget(const char *name)
187 { return SilcerGetWidget<T>(_thisGH, name); }
190 Gtk::Widget *_thisWidget;
196 #endif /* SILCERBASEWIN_HH */