00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _uappli_hpp_
00022 #define _uappli_hpp_
00023
00024 #include <ubit/udisp.hpp>
00025 #include <ubit/uconf.hpp>
00026 #include <ubit/uerror.hpp>
00027 namespace ubit {
00028
00029
00032 typedef std::vector<UEventFlow*> UFlowList;
00033 typedef std::vector<UDisp*> UDispList;
00034
00035
00081 class UAppli: public UDisp {
00082 public:
00083 static UConf conf;
00093 UAppli(int& argc, char** argv,
00094 UOption* command_line_options = null,
00095 const char* configuration_file = null);
00118 virtual ~UAppli();
00119
00120 static bool usingGL() {return conf.using_gl;}
00122
00123 static bool using3D() {return conf.using_3d;}
00125
00126 static UAppli& getApp() throw (UFatalError);
00132 static UFrame* getMainFrame();
00137 static const UStr& getName();
00139
00140 static const char* getVersion();
00142
00143
00144 static void setTitle(const UStr& title);
00149 static const UStr& getImaPath();
00150 static void setImaPath(const UStr& pathname);
00156 static USelection* getSelection(int ID = 0);
00164
00165
00166
00167 static int start();
00168 static int mainLoop() {return start();}
00173 static void quit(int status = 0);
00178 static bool isRunning();
00179
00180
00181 static UTime getTime();
00183
00184 static void setMotionLag(UTime app_lag, UTime nat_lag);
00190
00191
00192
00193 virtual void add(UWin&);
00210 virtual void remove(UWin& child, bool auto_delete);
00215 virtual void updateAll(const UUpdate& upatemode = UUpdate::layoutAndPaint);
00220
00221
00222
00223 static UErrorLog log;
00233 static void error(const char* location, const char* format, ...);
00234 static void warning(const char* location, const char* format, ...);
00235 static void fatalError(const char* location, const char* format, ...) throw (UFatalError);
00245
00246
00247
00248 static UStyleSheet& getStyleSheet();
00250
00251 static const UStyle& getDefaultStyle();
00253
00254
00255
00256
00257 static void postpone(UCall& callback);
00267 static void onTimeout(UTime msec_delay, int ntimes, UCall& callback);
00280
00281
00282
00283 static void onMessage(const UStr& port_name, UCall& callback);
00289 static UMessagePort& getMessagePort(const UStr& name);
00290 static UMessagePort* findMessagePort(const UStr& name);
00292
00293
00294
00295
00296 static const UDispList& getDispList();
00297
00298
00299 static UDisp* getDisp(int ID);
00300
00301
00302 static UDisp* openDisp(const UStr& display);
00314 static void closeDisp(UDisp*);
00316
00317
00318
00319
00320 static const UFlowList& getFlowList();
00322
00323 static UEventFlow* getFlow(int ID);
00333
00334
00335
00336 UNatAppli* getNatAppli() const;
00338
00339 UGroup* getOpenedMenu();
00341
00342 static bool hasTelePointers();
00344
00345 static bool isTerminated();
00347
00348 virtual bool isRealized() const;
00350
00351 virtual void realize();
00353
00354 #ifndef NO_DOC
00355 friend class UEventFlow;
00356
00357 static void internalError(const char* location, const char* format, ...);
00358
00359 virtual UConf& initConf(int& argc, char** argv, UOption*, const char* confile);
00361
00362 virtual void constructs();
00364
00365 static void deleteNotify(UView* deleted_view);
00366 static void deleteNotify(UGroup* deleted_group);
00367 static void deleteNotify(UDisp* deleted_disp);
00369
00370 void addModalwin(UWin*);
00371 void removeModalwin(UWin*);
00373
00374 int startSubLoop();
00375 void quitSubLoop(int status);
00377
00378 static class UAppliImpl& impl;
00379 #endif
00380 };
00381
00382 }
00383 #endif
00384
00385