00001
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef OMGUI_APP_H
00024 #define OMGUI_APP_H
00025
00026 #include <omgui/dllimpexp.h>
00027 #include <omgui/types.h>
00028 #include <omgui/event.h>
00029
00030 #include <list>
00031 #include <vector>
00032 #include <memory>
00033
00034 #include <omgui/eventloop.h>
00035
00036 namespace omgui {
00037
00038 class TopLevel;
00039 typedef std::list< Pointer<TopLevel> > TopLevelList;
00040
00041 class OMGUI_API App
00042 {
00043 public:
00047 typedef std::vector<string> cmd_line;
00048
00049 virtual bool init() = 0;
00050
00054 void run();
00055
00063 void quit();
00064
00068 void close_toplevel_windows();
00069
00075 static const TopLevelList &get_top_level_widgets();
00076
00080 omgui::EventLoop *get_event_loop();
00081
00085 const cmd_line &get_cmd_line();
00086 void set_cmd_line(const cmd_line &cmd);
00087
00091 static void add_top_level(TopLevel *t);
00092
00096 static void remove_top_level(TopLevel *t);
00097
00098 virtual ~App();
00099
00100 protected:
00101 App();
00102
00103 private:
00104 cmd_line m_cmd;
00105
00107 std::auto_ptr<omgui::EventLoop> m_event_loop;
00108
00115 void gui_init();
00116
00125 void _quit();
00126 };
00127
00128
00129
00130
00131
00132
00133
00134
00135 OMGUI_API App &get_app();
00136
00143 template<typename T> T &get_app()
00144 {
00145 return dynamic_cast<T&>(omgui::get_app());
00146 }
00147
00148 }
00149
00150 #endif // OMGUI_APP_H