]> git.saurik.com Git - wxWidgets.git/blob - include/wx/qt/app.h
compilation fix
[wxWidgets.git] / include / wx / qt / app.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: app.h
3 // Purpose: wxApp class
4 // Author: AUTHOR
5 // Modified by:
6 // Created: ??/??/98
7 // RCS-ID: $Id$
8 // Copyright: (c) AUTHOR
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_APP_H_
13 #define _WX_APP_H_
14
15 #ifdef __GNUG__
16 #pragma interface "app.h"
17 #endif
18
19 #include "wx/defs.h"
20 #include "wx/object.h"
21
22 class WXDLLEXPORT wxFrame;
23 class WXDLLEXPORT wxWindow;
24 class WXDLLEXPORT wxApp ;
25 class WXDLLEXPORT wxKeyEvent;
26 class WXDLLEXPORT wxLog;
27
28 #define wxPRINT_WINDOWS 1
29 #define wxPRINT_POSTSCRIPT 2
30
31 WXDLLEXPORT_DATA(extern wxApp*) wxTheApp;
32
33 void WXDLLEXPORT wxCleanUp();
34 void WXDLLEXPORT wxCommonCleanUp(); // Call this from the platform's wxCleanUp()
35 void WXDLLEXPORT wxCommonInit(); // Call this from the platform's initialization
36
37 // Force an exit from main loop
38 void WXDLLEXPORT wxExit();
39
40 // Yield to other apps/messages
41 bool WXDLLEXPORT wxYield();
42
43 // Represents the application. Derive OnInit and declare
44 // a new App object to start application
45 class WXDLLEXPORT wxApp: public wxEvtHandler
46 {
47 DECLARE_DYNAMIC_CLASS(wxApp)
48 wxApp();
49 inline ~wxApp() {}
50
51 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
52 static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
53
54 virtual int MainLoop();
55 void ExitMainLoop();
56 bool Initialized();
57 virtual bool Pending() ;
58 virtual void Dispatch() ;
59
60 virtual void OnIdle(wxIdleEvent& event);
61
62 // Generic
63 virtual bool OnInit() { return FALSE; };
64
65 // No specific tasks to do here.
66 virtual bool OnInitGui() { return TRUE; }
67
68 // Called to set off the main loop
69 virtual int OnRun() { return MainLoop(); };
70 virtual int OnExit() { return 0; }
71 /** Returns the standard icons for the msg dialogs, implemented in
72 src/generic/msgdlgg.cpp and src/gtk/app.cpp. */
73 virtual wxIcon GetStdIcon(int which) const;
74
75 inline void SetPrintMode(int mode) { m_printMode = mode; }
76 inline int GetPrintMode() const { return m_printMode; }
77
78 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
79 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
80
81 inline wxString GetAppName() const {
82 if (m_appName != "")
83 return m_appName;
84 else return m_className;
85 }
86
87 inline void SetAppName(const wxString& name) { m_appName = name; };
88 inline wxString GetClassName() const { return m_className; }
89 inline void SetClassName(const wxString& name) { m_className = name; }
90
91 void SetVendorName(const wxString& vendorName) { m_vendorName = vendorName; }
92 const wxString& GetVendorName() const { return m_vendorName; }
93
94 wxWindow *GetTopWindow() const ;
95 inline void SetTopWindow(wxWindow *win) { m_topWindow = win; }
96
97 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
98 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
99
100 // Send idle event to all top-level windows.
101 // Returns TRUE if more idle time is requested.
102 bool SendIdleEvents();
103
104 // Send idle event to window and all subwindows
105 // Returns TRUE if more idle time is requested.
106 bool SendIdleEvents(wxWindow* win);
107
108 // Windows only, but for compatibility...
109 inline void SetAuto3D(bool flag) { m_auto3D = flag; }
110 inline bool GetAuto3D() const { return m_auto3D; }
111
112 // Creates a log object
113 virtual wxLog* CreateLogTarget();
114
115 public:
116 // Will always be set to the appropriate, main-style values.
117 int argc;
118 char ** argv;
119
120 protected:
121 bool m_wantDebugOutput ;
122 wxString m_className;
123 wxString m_appName,
124 m_vendorName;
125 wxWindow * m_topWindow;
126 bool m_exitOnFrameDelete;
127 bool m_showOnInit;
128 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
129 bool m_auto3D ; // Always use 3D controls, except
130 // where overriden
131 static wxAppInitializerFunction m_appInitFn;
132
133 public:
134
135 // Implementation
136 static void CommonInit();
137 static void CommonCleanUp();
138 void DeletePendingObjects();
139 bool ProcessIdle();
140
141 public:
142 static long sm_lastMessageTime;
143 int m_nCmdShow;
144
145 protected:
146 bool m_keepGoing ;
147
148 DECLARE_EVENT_TABLE()
149 };
150
151 // TODO: add platform-specific arguments
152 int WXDLLEXPORT wxEntry( int argc, char *argv[] );
153
154 #endif
155 // _WX_APP_H_
156