GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

main.hh

Go to the documentation of this file.
00001 /* GFC-UI: Gtk+ Foundation Classes (User Interface Library) 00002 * Copyright (C) 2002-2004 The GFC Development Team. 00003 * 00004 * This program is free software; you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation; either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * This program is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU Library General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Library General Public License 00015 * along with this program; if not, write to the Free Software 00016 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00017 */ 00018 00045 00046 #ifndef GFC_MAIN_HH 00047 #define GFC_MAIN_HH 00048 00049 #ifndef GFC_POINTER_HH 00050 #include <gfc/pointer.hh> 00051 #endif 00052 00053 #ifndef GFC_GDK_TYPES_HH 00054 #include <gfc/gdk/types.hh> 00055 #endif 00056 00057 #ifndef SIGCXX_SIGCXX_H 00058 #include <sigc++/sigc++.h> 00059 #endif 00060 00061 #ifndef __GTK_MAIN_H__ 00062 #include <gtk/gtkmain.h> 00063 #endif 00064 00065 #ifndef _CPP_VECTOR 00066 #include <vector> 00067 #endif 00068 00069 namespace GFC { 00070 00071 namespace Gdk { 00072 class Event; 00073 class EventKey; 00074 } 00075 00076 namespace Gtk { 00077 class Widget; 00078 } 00079 00080 namespace Main { 00081 00082 class Connection; 00083 00086 00087 void init(int *argc, char ***argv); 00098 00099 bool init_check(int *argc, char ***argv); 00109 00110 void init_add(const sigc::slot<bool>& callback); 00116 00117 #ifdef G_THREADS_ENABLED 00118 void threads_init(GThreadFunctions *vtable = 0); 00138 #endif 00139 00143 00144 PangoLanguage* default_language(); 00151 00152 bool events_pending(); 00168 00169 Pointer<Gdk::Event> get_current_event(); 00176 00177 unsigned int get_current_event_time(); 00181 00182 bool get_current_event_state(Gdk::ModifierTypeField *state); 00187 00188 Pointer<Gtk::Widget> get_event_widget(Gdk::Event& event); 00197 00201 00202 void run(); 00206 00207 int level(); 00212 00213 void quit(); 00215 00216 bool iterate(bool blocking = true); 00224 00225 void grab_add(Gtk::Widget& widget); 00231 00232 Pointer<Gtk::Widget> grab_get_current(); 00235 00236 void grab_remove(Gtk::Widget& widget); 00240 00244 00247 00248 class QuitSignal : public sigc::trackable 00249 { 00250 public: 00251 typedef sigc::slot<bool> SlotType; 00253 00254 sigc::connection connect(const SlotType& slot, unsigned int main_level = 0); 00262 }; 00263 00266 extern QuitSignal quit_signal; 00267 00270 00271 class KeySnooperSignal : public sigc::trackable 00272 { 00273 std::vector<Connection*> connection_list; 00274 00275 public: 00276 typedef sigc::slot<bool, Gtk::Widget&, const Gdk::EventKey&> SlotType; 00278 00279 ~KeySnooperSignal(); 00281 00282 sigc::connection connect(const SlotType& slot); 00291 }; 00292 00295 extern KeySnooperSignal key_snooper_signal; 00296 00298 00299 } // namespace Main 00300 00301 } // namespace GFC 00302 00304 00305 #define GFC_MAIN(MainWidget)\ 00306 int main (int argc, char *argv[])\ 00307 {\ 00308 GFC::Main::init(&argc, &argv);\ 00309 MainWidget main_widget;\ 00310 main_widget.sig_destroy().connect(sigc::ptr_fun(&GFC::Main::quit));\ 00311 main_widget.show();\ 00312 GFC::Main::run();\ 00313 return 0;\ 00314 } 00315 00316 #endif // GFC_MAIN_HH 00317

Generated on Tue Aug 24 00:34:31 2004 for GFC-UI by doxygen 1.3.8