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"
26 #include "silcincludes.h"
27 #include "clientlibincludes.h"
30 #include <sigc++/signal_system.h>
31 #include <sigc++/object_slot.h>
32 #include <sigc++/marshal.h>
33 #include <glade/glade-xml.h>
34 #include <gtk--/box.h>
35 #include <gtk--/button.h>
36 #include <gtk--/checkbutton.h>
37 #include <gtk--/ctree.h>
38 #include <gtk--/entry.h>
39 #include <gtk--/eventbox.h>
40 #include <gtk--/frame.h>
41 #include <gtk--/label.h>
42 #include <gtk--/menuitem.h>
43 #include <gtk--/optionmenu.h>
44 #include <gtk--/text.h>
45 #include <gtk--/widget.h>
46 #include <gtk--/window.h>
47 #include <gnome--/dialog.h>
48 #include <gnome--/entry.h>
49 #include <gnome--/pixmap.h>
50 #include <gnome--/pixmapmenuitem.h>
54 class SilcerBaseWindow : public SigC::Object
57 SilcerBaseWindow(const char *widgetname);
58 virtual ~SilcerBaseWindow();
60 void show() { _thisWindow->show(); }
61 void hide() { _thisWindow->hide(); }
64 virtual void set_dynamic();
66 Signal0<void, Marshal<void> > evtDestroy;
70 // FIXME: Should make this function properly copy
71 SilcerBaseWindow& operator=(const SilcerBaseWindow&) { return *this;}
72 SilcerBaseWindow(const SilcerBaseWindow&) {}
77 Gtk::Button *getButton(const char *name)
78 { return SilcerGetWidget<Gtk::Button>(_thisGH, name); }
80 Gtk::CheckButton *getCheckButton(const char *name)
81 { return SilcerGetWidget<Gtk::CheckButton>(_thisGH, name); }
83 Gtk::CTree *getCTree(const char *name)
84 { return SilcerGetWidget<Gtk::CTree>(_thisGH, name); }
86 Gtk::Entry *getEntry(const char *name)
87 { return SilcerGetWidget<Gtk::Entry>(_thisGH, name); }
89 Gtk::EventBox *getEventBox(const char *name)
90 { return SilcerGetWidget<Gtk::EventBox>(_thisGH, name); }
92 Gtk::Frame *getFrame(const char *name)
93 { return SilcerGetWidget<Gtk::Frame>(_thisGH, name); }
95 Gtk::HBox *getHBox(const char *name)
96 { return SilcerGetWidget<Gtk::HBox>(_thisGH, name); }
98 Gnome::Entry *getGEntry(const char *name)
99 { return SilcerGetWidget<Gnome::Entry>(_thisGH, name); }
101 Gtk::Label *getLabel(const char *name)
102 { return SilcerGetWidget<Gtk::Label>(_thisGH, name); }
104 Gtk::MenuItem *getMenuItem(const char *name)
105 { return SilcerGetWidget<Gtk::MenuItem>(_thisGH, name); }
107 Gtk::OptionMenu *getOptionMenu(const char *name)
108 { return SilcerGetWidget<Gtk::OptionMenu>(_thisGH, name); }
110 Gnome::Pixmap *getPixmap(const char *name)
111 { return SilcerGetWidget<Gnome::Pixmap>(_thisGH, name); }
113 Gtk::PixmapMenuItem *getPixmapMenuItem(const char *name)
114 { return SilcerGetWidget<Gtk::PixmapMenuItem>(_thisGH, name); }
116 Gtk::Text *getText(const char *name)
117 { return SilcerGetWidget<Gtk::Text>(_thisGH, name); }
119 Gtk::VBox *getVBox(const char *name)
120 { return SilcerGetWidget<Gtk::VBox>(_thisGH, name); }
122 template <class T> T *getWidget(const char *name)
123 { return SilcerGetWidget<T>(_thisGH, name); }
126 Gtk::Window *_thisWindow;
132 class SilcerBaseDialog : public SilcerBaseWindow
135 SilcerBaseDialog(const char *widgetname, gboolean close_hides = false);
136 virtual ~SilcerBaseDialog() {}
139 Gnome::Dialog *_thisDialog;
140 gboolean on_Dialog_close();
143 class SilcerBaseWidget : public SigC::Object
146 SilcerBaseWidget(const char* widgetname, const char* filename);
147 virtual ~SilcerBaseWidget();
148 void show() { _thisWidget->show(); }
149 void hide() { _thisWidget->hide(); }
150 Gtk::Widget* get_this_widget() { return _thisWidget; }
151 virtual void close();
153 virtual void set_dynamic();
154 // Destruction signal
155 Signal0<void, Marshal<void> > evtDestroy;
158 // FIXME: Should make this function properly copy
159 SilcerBaseWidget& operator=(const SilcerBaseWidget&) { return *this;}
160 SilcerBaseWidget(const SilcerBaseWidget&) {}
164 Gtk::Button *getButton(const char *name)
165 { return SilcerGetWidget<Gtk::Button>(_thisGH, name); }
167 Gtk::CheckButton *getCheckButton(const char *name)
168 { return SilcerGetWidget<Gtk::CheckButton>(_thisGH, name); }
170 Gtk::Entry *getEntry(const char *name)
171 { return SilcerGetWidget<Gtk::Entry>(_thisGH, name); }
173 Gtk::Label *getLabel(const char *name)
174 { return SilcerGetWidget<Gtk::Label>(_thisGH, name); }
176 Gtk::MenuItem *getMenuItem(const char *name)
177 { return SilcerGetWidget<Gtk::MenuItem>(_thisGH, name); }
179 Gtk::OptionMenu *getOptionMenu(const char *name)
180 { return SilcerGetWidget<Gtk::OptionMenu>(_thisGH, name); }
182 Gtk::PixmapMenuItem *getPixmapMenuItem(const char *name)
183 { return SilcerGetWidget<Gtk::PixmapMenuItem>(_thisGH, name); }
185 Gtk::Text *getText(const char *name)
186 { return SilcerGetWidget<Gtk::Text>(_thisGH, name); }
188 template <class T> T *getWidget(const char *name)
189 { return SilcerGetWidget<T>(_thisGH, name); }
192 Gtk::Widget *_thisWidget;
198 #endif /* SILCERBASEWIN_HH */