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