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