]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/app.h
1. registry files corresponding to the recent registry.h changes
[wxWidgets.git] / include / wx / gtk / app.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: app.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKAPPH__
11 #define __GTKAPPH__
12
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "wx/defs.h"
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:
57
58 wxApp();
59 ~wxApp();
60
61 static void SetInitializerFunction(wxAppInitializerFunction fn) { m_appInitFn = fn; }
62 static wxAppInitializerFunction GetInitializerFunction() { return m_appInitFn; }
63
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(). */
67 virtual bool OnInitGui();
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; }
74
75 wxWindow *GetTopWindow();
76 void SetTopWindow( wxWindow *win );
77 virtual int MainLoop();
78 void ExitMainLoop();
79 bool Initialized();
80 virtual bool Pending();
81 virtual void Dispatch();
82
83 inline void SetWantDebugOutput(bool flag) { m_wantDebugOutput = flag; }
84 inline bool GetWantDebugOutput() { return m_wantDebugOutput; }
85
86 void OnIdle( wxIdleEvent &event );
87 bool SendIdleEvents();
88 bool SendIdleEvents( wxWindow* win );
89
90 inline wxString GetAppName() const
91 {
92 if (m_appName != "")
93 return m_appName;
94 else return m_className;
95 }
96
97 inline void SetAppName(const wxString& name) { m_appName = name; };
98 inline wxString GetClassName() const { return m_className; }
99 inline void SetClassName(const wxString& name) { m_className = name; }
100 const wxString& GetVendorName() const { return m_vendorName; }
101 void SetVendorName(const wxString& name) { m_vendorName = name; }
102
103 inline void SetExitOnFrameDelete(bool flag) { m_exitOnFrameDelete = flag; }
104 inline bool GetExitOnFrameDelete() const { return m_exitOnFrameDelete; }
105
106 void SetPrintMode(int WXUNUSED(mode) ) {};
107 int GetPrintMode() const { return wxPRINT_POSTSCRIPT; };
108
109 /* override this function to create default log target of arbitrary
110 * user-defined classv (default implementation creates a wxLogGui object) */
111 virtual wxLog *CreateLogTarget();
112
113 /* GTK implementation */
114
115 static bool Initialize();
116 static bool InitialzeVisual();
117 static void CleanUp();
118
119 bool ProcessIdle();
120 void DeletePendingObjects();
121
122 bool m_initialized;
123 bool m_exitOnFrameDelete;
124 bool m_wantDebugOutput;
125 wxWindow *m_topWindow;
126
127 gint m_idleTag;
128 unsigned char *m_colorCube;
129
130 int argc;
131 char **argv;
132
133 static wxAppInitializerFunction m_appInitFn;
134
135 private:
136 wxString m_vendorName,
137 m_appName,
138 m_className;
139
140 DECLARE_EVENT_TABLE()
141 };
142
143 #endif // __GTKAPPH__