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