]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: app.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
dbf858b5 | 5 | // Id: $Id$ |
01111366 | 6 | // Copyright: (c) 1998 Robert Roebling, Julian Smart |
a3622daa | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | #ifndef __GTKAPPH__ | |
11 | #define __GTKAPPH__ | |
12 | ||
13 | #ifdef __GNUG__ | |
14 | #pragma interface | |
15 | #endif | |
16 | ||
bcf1fa6b | 17 | #include "wx/defs.h" |
c801d85f KB |
18 | #include "wx/window.h" |
19 | #include "wx/frame.h" | |
20 | ||
21 | //----------------------------------------------------------------------------- | |
22 | // classes | |
23 | //----------------------------------------------------------------------------- | |
24 | ||
25 | class wxApp; | |
26 | class wxLog; | |
27 | ||
28 | //----------------------------------------------------------------------------- | |
29 | // global data | |
30 | //----------------------------------------------------------------------------- | |
31 | ||
32 | extern wxApp *wxTheApp; | |
33 | ||
34 | //----------------------------------------------------------------------------- | |
35 | // global functions | |
36 | //----------------------------------------------------------------------------- | |
37 | ||
38 | void wxExit(void); | |
39 | bool wxYield(void); | |
40 | ||
41 | //----------------------------------------------------------------------------- | |
42 | // constants | |
43 | //----------------------------------------------------------------------------- | |
44 | ||
45 | #define wxPRINT_WINDOWS 1 | |
46 | #define wxPRINT_POSTSCRIPT 2 | |
47 | ||
48 | //----------------------------------------------------------------------------- | |
49 | // wxApp | |
50 | //----------------------------------------------------------------------------- | |
51 | ||
52 | class wxApp: public wxEvtHandler | |
53 | { | |
54 | DECLARE_DYNAMIC_CLASS(wxApp) | |
55 | ||
56 | public: | |
a3622daa | 57 | |
bbe0af5b RR |
58 | wxApp(); |
59 | ~wxApp(); | |
a3622daa | 60 | |
c801d85f | 61 | static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; } |
bbe0af5b RR |
62 | static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; } |
63 | ||
0d2a2b60 RR |
64 | /* override for altering the way wxGTK intializes the GUI (palette/visual/colorcube). |
65 | * under wxMSW, OnInitGui() does nothing by default. when overriding this method, | |
66 | * the code in it is likely to be platform dependent, otherwise use OnInit(). */ | |
bbe0af5b | 67 | virtual bool OnInitGui(); |
0d2a2b60 RR |
68 | |
69 | /* override to create top level frame, display splash screen etc. */ | |
70 | virtual bool OnInit() { return FALSE; } | |
71 | ||
72 | virtual int OnRun() { return MainLoop(); } | |
73 | virtual int OnExit() { return 0; } | |
a3622daa | 74 | |
bbe0af5b | 75 | wxWindow *GetTopWindow(); |
c801d85f | 76 | void SetTopWindow( wxWindow *win ); |
36b3b54a | 77 | |
bbe0af5b RR |
78 | virtual int MainLoop(); |
79 | void ExitMainLoop(); | |
80 | bool Initialized(); | |
81 | virtual bool Pending(); | |
82 | virtual void Dispatch(); | |
53010e52 | 83 | |
36b3b54a | 84 | inline void SetWantDebugOutput( bool flag ) { m_wantDebugOutput = flag; } |
bbe0af5b | 85 | inline bool GetWantDebugOutput() { return m_wantDebugOutput; } |
53010e52 | 86 | |
a3622daa | 87 | void OnIdle( wxIdleEvent &event ); |
bbe0af5b | 88 | bool SendIdleEvents(); |
53010e52 | 89 | bool SendIdleEvents( wxWindow* win ); |
a3622daa | 90 | |
bbe0af5b | 91 | inline wxString GetAppName() const |
36b3b54a RR |
92 | { if (m_appName != "") return m_appName; else return m_className; } |
93 | inline void SetAppName( const wxString& name ) { m_appName = name; } | |
bbe0af5b | 94 | |
bbe0af5b | 95 | inline wxString GetClassName() const { return m_className; } |
36b3b54a RR |
96 | inline void SetClassName( const wxString& name ) { m_className = name; } |
97 | ||
ad553268 | 98 | const wxString& GetVendorName() const { return m_vendorName; } |
36b3b54a | 99 | void SetVendorName( const wxString& name ) { m_vendorName = name; } |
c801d85f | 100 | |
36b3b54a | 101 | inline void SetExitOnFrameDelete( bool flag ) { m_exitOnFrameDelete = flag; } |
bbe0af5b | 102 | inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; } |
a3622daa | 103 | |
36b3b54a RR |
104 | void SetPrintMode( int WXUNUSED(mode) ) {} |
105 | int GetPrintMode() const { return wxPRINT_POSTSCRIPT; } | |
a3622daa | 106 | |
0d2a2b60 RR |
107 | /* override this function to create default log target of arbitrary |
108 | * user-defined classv (default implementation creates a wxLogGui object) */ | |
c801d85f | 109 | virtual wxLog *CreateLogTarget(); |
a3622daa | 110 | |
36b3b54a | 111 | // implementation |
53010e52 | 112 | |
0d2a2b60 RR |
113 | static bool Initialize(); |
114 | static bool InitialzeVisual(); | |
115 | static void CleanUp(); | |
a3622daa | 116 | |
bbe0af5b | 117 | bool ProcessIdle(); |
7214297d GL |
118 | #if wxUSE_THREADS |
119 | void ProcessPendingEvents(); | |
120 | #endif | |
bbe0af5b | 121 | void DeletePendingObjects(); |
a3622daa | 122 | |
f6fcbb63 RR |
123 | bool m_initialized; |
124 | bool m_exitOnFrameDelete; | |
125 | bool m_wantDebugOutput; | |
126 | wxWindow *m_topWindow; | |
c801d85f | 127 | |
f6fcbb63 RR |
128 | gint m_idleTag; |
129 | unsigned char *m_colorCube; | |
a3622daa | 130 | |
f6fcbb63 RR |
131 | int argc; |
132 | char **argv; | |
a3622daa | 133 | |
36b3b54a RR |
134 | wxString m_vendorName; |
135 | wxString m_appName; | |
136 | wxString m_className; | |
137 | ||
c801d85f | 138 | static wxAppInitializerFunction m_appInitFn; |
53010e52 RR |
139 | |
140 | DECLARE_EVENT_TABLE() | |
c801d85f KB |
141 | }; |
142 | ||
143 | #endif // __GTKAPPH__ |