]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/app.h
changes for wxMSW compilation
[wxWidgets.git] / include / wx / gtk / app.h
CommitLineData
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
25class wxApp;
26class wxLog;
27
28//-----------------------------------------------------------------------------
29// global data
30//-----------------------------------------------------------------------------
31
32extern wxApp *wxTheApp;
33
bbe0af5b
RR
34extern GdkVisual *wxVisualSetByExternal;
35extern GdkColormap *wxColormapSetByExternal;
36
c801d85f
KB
37//-----------------------------------------------------------------------------
38// global functions
39//-----------------------------------------------------------------------------
40
41void wxExit(void);
42bool wxYield(void);
43
44//-----------------------------------------------------------------------------
45// constants
46//-----------------------------------------------------------------------------
47
48#define wxPRINT_WINDOWS 1
49#define wxPRINT_POSTSCRIPT 2
50
51//-----------------------------------------------------------------------------
52// wxApp
53//-----------------------------------------------------------------------------
54
55class wxApp: public wxEvtHandler
56{
57 DECLARE_DYNAMIC_CLASS(wxApp)
58
59 public:
a3622daa 60
bbe0af5b
RR
61 wxApp();
62 ~wxApp();
a3622daa 63
c801d85f 64 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
bbe0af5b
RR
65 static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
66
67 /* this may have to be overwritten when special, non-default visuals have
68 to be set. it is also platform dependent as only X knows about displays
69 and visuals. by standard, this routine looks at wxVisualSetByExternal
70 which might have been set in the wxModule code of the OpenGL canvas */
71 virtual bool InitVisual();
a3622daa 72
bbe0af5b
RR
73 virtual bool OnInit();
74 virtual bool OnInitGui();
75 virtual int OnRun();
76 virtual int OnExit();
a3622daa 77
bbe0af5b 78 wxWindow *GetTopWindow();
c801d85f 79 void SetTopWindow( wxWindow *win );
bbe0af5b
RR
80 virtual int MainLoop();
81 void ExitMainLoop();
82 bool Initialized();
83 virtual bool Pending();
84 virtual void Dispatch();
53010e52
RR
85
86 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
bbe0af5b 87 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
53010e52 88
a3622daa 89 void OnIdle( wxIdleEvent &event );
bbe0af5b 90 bool SendIdleEvents();
53010e52 91 bool SendIdleEvents( wxWindow* win );
a3622daa 92
bbe0af5b
RR
93 inline wxString GetAppName() const
94 {
c801d85f
KB
95 if (m_appName != "")
96 return m_appName;
97 else return m_className;
98 }
bbe0af5b 99
c801d85f 100 inline void SetAppName(const wxString& name) { m_appName = name; };
bbe0af5b 101 inline wxString GetClassName() const { return m_className; }
c801d85f 102 inline void SetClassName(const wxString& name) { m_className = name; }
ad553268
VZ
103 const wxString& GetVendorName() const { return m_vendorName; }
104 void SetVendorName(const wxString& name) { m_vendorName = name; }
c801d85f
KB
105
106 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
bbe0af5b 107 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
a3622daa
VZ
108
109 void SetPrintMode(int WXUNUSED(mode) ) {};
bbe0af5b 110 int GetPrintMode() const { return wxPRINT_POSTSCRIPT; };
a3622daa 111
c801d85f
KB
112 // override this function to create default log target of arbitrary
113 // user-defined classv (default implementation creates a wxLogGui object)
114 virtual wxLog *CreateLogTarget();
a3622daa 115
53010e52
RR
116 // GTK implementation
117
bbe0af5b
RR
118 static void CommonInit();
119 static void CommonCleanUp();
a3622daa 120
bbe0af5b
RR
121 bool ProcessIdle();
122 void DeletePendingObjects();
a3622daa 123
c801d85f
KB
124 bool m_initialized;
125 bool m_exitOnFrameDelete;
53010e52 126 bool m_wantDebugOutput;
c801d85f 127 wxWindow *m_topWindow;
c801d85f 128
53010e52 129 gint m_idleTag;
a3622daa 130
c801d85f
KB
131 int argc;
132 char **argv;
a3622daa 133
c801d85f 134 static wxAppInitializerFunction m_appInitFn;
53010e52 135
ad553268
VZ
136private:
137 wxString m_vendorName,
138 m_appName,
139 m_className;
140
53010e52 141 DECLARE_EVENT_TABLE()
c801d85f
KB
142};
143
144#endif // __GTKAPPH__