use wxEventLoop in wxApp under wxMSW; factored out common code from wxX11/wxMotif...
[wxWidgets.git] / include / wx / motif / app.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: app.h
3 // Purpose: wxApp class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_APP_H_
13 #define _WX_APP_H_
14
15 #ifdef __GNUG__
16 #pragma interface "app.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers
21 // ----------------------------------------------------------------------------
22
23 #include "wx/event.h"
24
25 // ----------------------------------------------------------------------------
26 // forward declarations
27 // ----------------------------------------------------------------------------
28
29 class WXDLLEXPORT wxFrame;
30 class WXDLLEXPORT wxWindow;
31 class WXDLLEXPORT wxApp;
32 class WXDLLEXPORT wxKeyEvent;
33 class WXDLLEXPORT wxLog;
34 class WXDLLEXPORT wxEventLoop;
35 class WXDLLEXPORT wxXVisualInfo;
36 class wxPerDisplayDataMap;
37
38 // ----------------------------------------------------------------------------
39 // the wxApp class for Motif - see wxAppBase for more details
40 // ----------------------------------------------------------------------------
41
42 class WXDLLEXPORT wxApp : public wxAppBase
43 {
44 DECLARE_DYNAMIC_CLASS(wxApp)
45
46 public:
47 wxApp();
48 virtual ~wxApp();
49
50 // override base class (pure) virtuals
51 // -----------------------------------
52
53 virtual int MainLoop();
54 virtual void ExitMainLoop();
55 virtual bool Initialized();
56
57 virtual void Exit();
58
59 virtual bool Yield(bool onlyIfNeeded = FALSE);
60 virtual void WakeUpIdle(); // implemented in motif/evtloop.cpp
61
62 virtual bool OnInitGui();
63
64 // implementation from now on
65 // --------------------------
66
67 protected:
68 bool m_showOnInit;
69
70 public:
71 // Implementation
72 virtual bool Initialize(int& argc, wxChar **argv);
73 virtual void CleanUp();
74
75 // Motif-specific
76 WXAppContext GetAppContext() const { return m_appContext; }
77 WXWidget GetTopLevelWidget();
78 WXColormap GetMainColormap(WXDisplay* display);
79 WXDisplay* GetInitialDisplay() const { return m_initialDisplay; }
80
81 void SetTopLevelWidget(WXDisplay* display, WXWidget widget);
82
83 // This handler is called when a property change event occurs
84 virtual void HandlePropertyChange(WXEvent *event);
85
86 wxXVisualInfo* GetVisualInfo(WXDisplay* display);
87
88 private:
89 wxEventLoop* m_eventLoop;
90
91 // Motif-specific
92 WXAppContext m_appContext;
93 WXColormap m_mainColormap;
94 WXDisplay* m_initialDisplay;
95 wxPerDisplayDataMap* m_perDisplayData;
96
97 DECLARE_EVENT_TABLE()
98 };
99
100 #endif
101 // _WX_APP_H_
102