]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/app.h
no message
[wxWidgets.git] / include / wx / gtk / app.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: app.h
3// Purpose:
4// Author: Robert Roebling
5// Created: 01/02/97
6// Id:
01111366 7// Copyright: (c) 1998 Robert Roebling, Julian Smart
a3622daa 8// Licence: wxWindows licence
c801d85f
KB
9/////////////////////////////////////////////////////////////////////////////
10
11#ifndef __GTKAPPH__
12#define __GTKAPPH__
13
14#ifdef __GNUG__
15#pragma interface
16#endif
17
bcf1fa6b 18#include "wx/defs.h"
c801d85f
KB
19#include "wx/window.h"
20#include "wx/frame.h"
21
22//-----------------------------------------------------------------------------
23// classes
24//-----------------------------------------------------------------------------
25
26class wxApp;
27class wxLog;
28
29//-----------------------------------------------------------------------------
30// global data
31//-----------------------------------------------------------------------------
32
33extern wxApp *wxTheApp;
34
35//-----------------------------------------------------------------------------
36// global functions
37//-----------------------------------------------------------------------------
38
39void wxExit(void);
40bool wxYield(void);
41
42//-----------------------------------------------------------------------------
43// constants
44//-----------------------------------------------------------------------------
45
46#define wxPRINT_WINDOWS 1
47#define wxPRINT_POSTSCRIPT 2
48
49//-----------------------------------------------------------------------------
50// wxApp
51//-----------------------------------------------------------------------------
52
53class wxApp: public wxEvtHandler
54{
55 DECLARE_DYNAMIC_CLASS(wxApp)
56
57 public:
a3622daa 58
c801d85f
KB
59 wxApp(void);
60 ~wxApp(void);
a3622daa 61
c801d85f
KB
62 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
63 static wxAppInitializerFunction GetInitializerFunction(void) { return m_appInitFn; }
a3622daa 64
c801d85f
KB
65 virtual bool OnInit(void);
66 virtual bool OnInitGui(void);
67 virtual int OnRun(void);
c801d85f 68 virtual int OnExit(void);
a3622daa 69
c801d85f
KB
70 wxWindow *GetTopWindow(void);
71 void SetTopWindow( wxWindow *win );
72 virtual int MainLoop(void);
73 void ExitMainLoop(void);
74 bool Initialized(void);
75 virtual bool Pending(void);
76 virtual void Dispatch(void);
53010e52
RR
77
78 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
79 inline bool GetWantDebugOutput(void) { return m_wantDebugOutput; }
80
a3622daa 81 void OnIdle( wxIdleEvent &event );
53010e52
RR
82 bool SendIdleEvents(void);
83 bool SendIdleEvents( wxWindow* win );
a3622daa 84
c801d85f
KB
85 inline wxString GetAppName(void) const {
86 if (m_appName != "")
87 return m_appName;
88 else return m_className;
89 }
90 inline void SetAppName(const wxString& name) { m_appName = name; };
91 inline wxString GetClassName(void) const { return m_className; }
92 inline void SetClassName(const wxString& name) { m_className = name; }
ad553268
VZ
93 const wxString& GetVendorName() const { return m_vendorName; }
94 void SetVendorName(const wxString& name) { m_vendorName = name; }
c801d85f
KB
95
96 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
97 inline bool GetExitOnFrameDelete(void) const { return m_exitOnFrameDelete; }
a3622daa
VZ
98
99 void SetPrintMode(int WXUNUSED(mode) ) {};
c801d85f 100 int GetPrintMode(void) const { return wxPRINT_POSTSCRIPT; };
a3622daa 101
c801d85f
KB
102 // override this function to create default log target of arbitrary
103 // user-defined classv (default implementation creates a wxLogGui object)
104 virtual wxLog *CreateLogTarget();
a3622daa 105
53010e52
RR
106 // GTK implementation
107
108 static void CommonInit(void);
a3622daa
VZ
109 static void CommonCleanUp(void);
110
53010e52
RR
111 bool ProcessIdle(void);
112 void DeletePendingObjects(void);
a3622daa 113
c801d85f
KB
114 bool m_initialized;
115 bool m_exitOnFrameDelete;
53010e52 116 bool m_wantDebugOutput;
c801d85f 117 wxWindow *m_topWindow;
c801d85f 118
53010e52 119 gint m_idleTag;
a3622daa 120
c801d85f
KB
121 int argc;
122 char **argv;
a3622daa 123
c801d85f 124 static wxAppInitializerFunction m_appInitFn;
53010e52 125
ad553268
VZ
126private:
127 wxString m_vendorName,
128 m_appName,
129 m_className;
130
53010e52 131 DECLARE_EVENT_TABLE()
c801d85f
KB
132};
133
134#endif // __GTKAPPH__