1. wxAppBase class appers, wxApp in wxGTK and wxMSW modified accordingly
[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 #include "wx/icon.h"
21
22 //-----------------------------------------------------------------------------
23 // classes
24 //-----------------------------------------------------------------------------
25
26 class wxApp;
27 class wxLog;
28
29 //-----------------------------------------------------------------------------
30 // global data
31 //-----------------------------------------------------------------------------
32
33 extern wxApp *wxTheApp;
34
35 //-----------------------------------------------------------------------------
36 // global functions
37 //-----------------------------------------------------------------------------
38
39 void wxExit(void);
40 bool wxYield(void);
41
42 //-----------------------------------------------------------------------------
43 // constants
44 //-----------------------------------------------------------------------------
45
46 #define wxPRINT_WINDOWS 1
47 #define wxPRINT_POSTSCRIPT 2
48
49 //-----------------------------------------------------------------------------
50 // wxApp
51 //-----------------------------------------------------------------------------
52
53 class wxApp: public wxAppBase
54 {
55 DECLARE_DYNAMIC_CLASS(wxApp)
56
57 public:
58 wxApp();
59 ~wxApp();
60
61 /* override for altering the way wxGTK intializes the GUI
62 * (palette/visual/colorcube). under wxMSW, OnInitGui() does nothing by
63 * default. when overriding this method, the code in it is likely to be
64 * platform dependent, otherwise use OnInit(). */
65 virtual bool OnInitGui();
66
67 // override base class (pure) virtuals
68 virtual int MainLoop();
69 virtual void ExitMainLoop();
70 virtual bool Initialized();
71 virtual bool Pending();
72 virtual void Dispatch();
73
74 virtual wxIcon GetStdIcon(int which) const;
75
76 // implementation only from now on
77 void OnIdle( wxIdleEvent &event );
78 bool SendIdleEvents();
79 bool SendIdleEvents( wxWindow* win );
80
81 static bool Initialize();
82 static bool InitialzeVisual();
83 static void CleanUp();
84
85 bool ProcessIdle();
86 #if wxUSE_THREADS
87 void ProcessPendingEvents();
88 #endif
89 void DeletePendingObjects();
90
91 // This can be used to suppress the generation of Idle events.
92 void SuppressIdleEvents(bool arg = TRUE) { m_suppressIdleEvents = arg; }
93 bool GetSuppressIdleEvents() const { return m_suppressIdleEvents; }
94
95 bool m_initialized;
96
97 gint m_idleTag;
98 #if wxUSE_THREADS
99 gint m_wakeUpTimerTag;
100 #endif
101 unsigned char *m_colorCube;
102
103 private:
104 /// Set to TRUE while we are in wxYield().
105 bool m_suppressIdleEvents;
106
107 DECLARE_EVENT_TABLE()
108 };
109
110 #endif // __GTKAPPH__