00001
00002
00014 #ifndef QtApp_H
00015 #define QtApp_H
00016
00017 #include "qt/libqthippo.h"
00018
00019 #include <qapplication.h>
00020
00021 #include <string>
00022
00023 #ifdef Q_OS_MACX
00024 #if QT_VERSION < 0x040000
00025 #include <Carbon/Carbon.h>
00026 #endif
00027 #endif
00028
00029 namespace hippodraw {
00030
00031 class CanvasWindow;
00032
00039 class MDL_QTHIPPOPLOT_API QtApp : public QApplication
00040 {
00041 private:
00042
00044 static QtApp * s_instance;
00045
00048 void init ();
00049
00056 #ifdef Q_OS_MACX
00057 #if QT_VERSION < 0x040000
00058 static OSErr appleEventHandler ( const AppleEvent * event,
00059 AppleEvent *,
00060 long );
00061 #endif
00062 #endif
00063
00067 bool tryOpenFile ( const std::string & name );
00068
00069 protected:
00070
00071 #ifdef Q_OS_MACX
00072
00075 virtual void customEvent ( QCustomEvent * event );
00076 #endif
00077
00078 public:
00079
00082 QtApp ( int argc, char ** argv );
00083
00086 QtApp ( int argc, char ** argv, bool gui );
00087
00089 ~QtApp();
00090
00092 static QtApp * instance ();
00093
00105 void setFirstWindow ( );
00106
00108 CanvasWindow * currentCanvas ();
00109
00110 };
00111
00112 }
00113
00114 #endif // QtApp_H