]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/app.h
Added some tentative wxMotif clipboard code; did some file formatting
[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
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
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
64 /* this may have to be overwritten when special, non-default visuals have
65 to be set. it is also platform dependent as only X knows about displays
aae24d21 66 and visuals. */
bbe0af5b 67 virtual bool InitVisual();
a3622daa 68
bbe0af5b
RR
69 virtual bool OnInit();
70 virtual bool OnInitGui();
71 virtual int OnRun();
72 virtual int OnExit();
a3622daa 73
bbe0af5b 74 wxWindow *GetTopWindow();
c801d85f 75 void SetTopWindow( wxWindow *win );
bbe0af5b
RR
76 virtual int MainLoop();
77 void ExitMainLoop();
78 bool Initialized();
79 virtual bool Pending();
80 virtual void Dispatch();
53010e52
RR
81
82 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
bbe0af5b 83 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
53010e52 84
a3622daa 85 void OnIdle( wxIdleEvent &event );
bbe0af5b 86 bool SendIdleEvents();
53010e52 87 bool SendIdleEvents( wxWindow* win );
a3622daa 88
bbe0af5b
RR
89 inline wxString GetAppName() const
90 {
c801d85f
KB
91 if (m_appName != "")
92 return m_appName;
93 else return m_className;
94 }
bbe0af5b 95
c801d85f 96 inline void SetAppName(const wxString& name) { m_appName = name; };
bbe0af5b 97 inline wxString GetClassName() const { return m_className; }
c801d85f 98 inline void SetClassName(const wxString& name) { m_className = name; }
ad553268
VZ
99 const wxString& GetVendorName() const { return m_vendorName; }
100 void SetVendorName(const wxString& name) { m_vendorName = name; }
c801d85f
KB
101
102 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
bbe0af5b 103 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
a3622daa
VZ
104
105 void SetPrintMode(int WXUNUSED(mode) ) {};
bbe0af5b 106 int GetPrintMode() const { return wxPRINT_POSTSCRIPT; };
a3622daa 107
c801d85f
KB
108 // override this function to create default log target of arbitrary
109 // user-defined classv (default implementation creates a wxLogGui object)
110 virtual wxLog *CreateLogTarget();
a3622daa 111
53010e52
RR
112 // GTK implementation
113
bbe0af5b
RR
114 static void CommonInit();
115 static void CommonCleanUp();
a3622daa 116
bbe0af5b
RR
117 bool ProcessIdle();
118 void DeletePendingObjects();
a3622daa 119
f6fcbb63
RR
120 bool m_initialized;
121 bool m_exitOnFrameDelete;
122 bool m_wantDebugOutput;
123 wxWindow *m_topWindow;
c801d85f 124
f6fcbb63
RR
125 gint m_idleTag;
126 unsigned char *m_colorCube;
a3622daa 127
f6fcbb63
RR
128 int argc;
129 char **argv;
a3622daa 130
c801d85f 131 static wxAppInitializerFunction m_appInitFn;
53010e52 132
ad553268
VZ
133private:
134 wxString m_vendorName,
135 m_appName,
136 m_className;
137
53010e52 138 DECLARE_EVENT_TABLE()
c801d85f
KB
139};
140
141#endif // __GTKAPPH__