guit  0.1
 All Classes Functions Variables Typedefs Enumerations Friends
gapp.hpp
1 //
2 // The application context, must be created first.
3 // guit GUI Toolkit
4 // Copyright © 2019 Eric Lecolinet. All rights reserved.
5 // http://www.telecom-paristech.fr/~elc
6 //
7 
8 #ifndef GuitApp_hpp
9 #define GuitApp_hpp
10 #include <gtypes.hpp>
11 namespace guit {
12 
92 class GApp {
93 public:
95  GApp(int argc, const char** argv);
96 
100  int start(GWindow& main_window);
101  int start(GWindow* main_window);
103 
110  static void close();
111  static void quit() {exit(0);}
112  static void exit(int status = 0);
114 
116  static int status();
117 
120  static bool addCssFile(GString const& css_file);
121  static bool addCssRules(GString const& css_rules);
122  GApp& operator<<(GString const& css);
124 
126 
128  static GStrings const& resourceDirs();
129 
135  static GString const& guitDir();
136 
139  static GString const& appDir();
140 
144  static GString execName();
145  static GString execPath();
147 
152  static int argc();
153  static GString argv(int n);
155 
158  static bool hasArg(GString const& name);
159 
165  static bool hasArg(GString const& name, GString& value,
166  GString const& assign = "=");
167 
169  static GDim screenSize();
170 
173  static GWindow* mainWindow();
174 
176  static Gadget* currentFocus();
177 
180  static void updateAll();
181 
184  static void paintAll();
185 
189  static void exec(GFunction const& fun);
190 
193  static void sleep(GTime milliseconds);
194 
198  static void error(GString const& where, GString const& message, GObject const* = {});
199 
204  static void onError(std::function<void(GString const& where, GString const& message,
205  GObject const* object)> fun);
206 
212  static void onException(std::function<void(GString const& type, GString const& message,
213  bool isGFatalError)> fun);
214 
217  static class GInspector& inspector();
218 
220  static void showInspector();
221 };
222 
223 }
224 #endif