00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef INSTIGATE_TOOLKIT_APPLICATION
00010 #define INSTIGATE_TOOLKIT_APPLICATION
00011
00022
00023
00024
00025 #include <list>
00026 #include <gtkmm.h>
00027 #include <glibmm/thread.h>
00028
00029
00030
00031 namespace instigate {
00032 namespace toolkit {
00033 class application;
00034 class window;
00035 }
00036 }
00037
00038 namespace Gtk {
00039 class Main;
00040 }
00041
00042 class QApplication;
00043
00064 class instigate::toolkit::application
00065 {
00066 friend class window;
00067
00069 public:
00078 void set_main_window(instigate::toolkit::window* w) throw();
00079
00081 public:
00089 void run() throw();
00090
00092 void quit() throw();
00093
00094 private:
00096 typedef std::map<std::string, toolkit::window*> windows;
00097
00098 windows m_windows;
00099
00100 private:
00101 void add_window(window*) throw();
00102
00104 void close_window(const std::string&) throw();
00105
00106 private:
00108 bool is_main_window(toolkit::window* w) throw();
00109
00111 void quit_qt_application() throw();
00112
00114 void quit_gtk_application() throw();
00115
00117 void call_gtk_run() throw();
00118
00120 void call_qt_run() throw();
00121
00129 void create_gtk_application(int c, char** v) throw();
00130
00137 void create_qt_application(int& c, char** v) throw();
00138
00139 bool emit_application_events() throw();
00140
00141 void emit_window_events(window*) throw();
00142
00143 private:
00144 static instigate::toolkit::application* m_application;
00145 window* m_main_window;
00146 Gtk::Main* m_gtk_application;
00147 QApplication* m_qt_application;
00148 sigc::connection m_connection;
00149 Glib::Mutex m_mutex;
00150 public:
00152 static instigate::toolkit::application* get() throw();
00153
00155 public:
00162 application(int& c, char** v) throw();
00163
00165 ~application() throw();
00166
00168 private:
00170 application(const application&) throw();
00171
00173 application& operator=(const application&) throw();
00174 };
00175
00176 #endif // INSTIGATE_TOOLKIT_APPLICATION