]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/app.h
use wxEventLoop in wxApp under wxMSW; factored out common code from wxX11/wxMotif...
[wxWidgets.git] / include / wx / x11 / 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 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "app.h"
17 #endif
18
19 // ----------------------------------------------------------------------------
20 // headers
21 // ----------------------------------------------------------------------------
22
23 #include "wx/gdicmn.h"
24 #include "wx/event.h"
25
26 // ----------------------------------------------------------------------------
27 // forward declarations
28 // ----------------------------------------------------------------------------
29
30 class WXDLLEXPORT wxFrame;
31 class WXDLLEXPORT wxWindow;
32 class WXDLLEXPORT wxApp;
33 class WXDLLEXPORT wxKeyEvent;
34 class WXDLLEXPORT wxLog;
35 class WXDLLEXPORT wxXVisualInfo;
36
37 // ----------------------------------------------------------------------------
38 // the wxApp class for wxX11 - see wxAppBase for more details
39 // ----------------------------------------------------------------------------
40
41 class WXDLLEXPORT wxApp : public wxAppBase
42 {
43 DECLARE_DYNAMIC_CLASS(wxApp)
44
45 public:
46 wxApp();
47 ~wxApp();
48
49 // override base class (pure) virtuals
50 // -----------------------------------
51
52 virtual int MainLoop();
53 virtual void ExitMainLoop();
54 virtual bool Initialized();
55 virtual bool Pending();
56 virtual void Dispatch();
57
58 virtual void Exit();
59
60 virtual bool Yield(bool onlyIfNeeded = FALSE);
61 virtual void WakeUpIdle();
62
63 virtual bool OnInitGui();
64
65 // implementation from now on
66 // --------------------------
67
68 // Processes an X event.
69 virtual bool ProcessXEvent(WXEvent* event);
70
71 #ifdef __WXDEBUG__
72 virtual void OnAssert(const wxChar *file, int line, const wxChar* cond, const wxChar *msg);
73 #endif // __WXDEBUG__
74
75 protected:
76 bool m_showOnInit;
77
78 public:
79 // Implementation
80 virtual bool Initialize(int& argc, wxChar **argv);
81 virtual void CleanUp();
82
83 WXWindow GetTopLevelWidget() const { return m_topLevelWidget; }
84 WXColormap GetMainColormap(WXDisplay* display);
85 long GetMaxRequestSize() const { return m_maxRequestSize; }
86
87 // This handler is called when a property change event occurs
88 virtual bool HandlePropertyChange(WXEvent *event);
89
90 // Values that can be passed on the command line.
91 // Returns -1, -1 if none specified.
92 const wxSize& GetInitialSize() const { return m_initialSize; }
93 bool GetShowIconic() const { return m_showIconic; }
94
95 #if wxUSE_UNICODE
96 // Global context for Pango layout. Either use X11
97 // or use Xft rendering according to GDK_USE_XFT
98 // environment variable
99 PangoContext* GetPangoContext();
100 #endif
101
102 wxXVisualInfo* GetVisualInfo(WXDisplay* display)
103 {
104 // this should be implemented correctly for wxBitmap to work
105 // with multiple display
106 return m_visualInfo;
107 }
108
109 // We need this before creating the app
110 static WXDisplay* GetDisplay() { return ms_display; }
111 static WXDisplay* ms_display;
112
113 public:
114 static long sm_lastMessageTime;
115 bool m_showIconic;
116 wxSize m_initialSize;
117
118 #if !wxUSE_NANOX
119 wxXVisualInfo* m_visualInfo;
120 #endif
121
122 protected:
123 bool m_keepGoing;
124
125 WXWindow m_topLevelWidget;
126 WXColormap m_mainColormap;
127 long m_maxRequestSize;
128
129 DECLARE_EVENT_TABLE()
130 };
131
132 #endif // _WX_APP_H_
133