]>
Commit | Line | Data |
---|---|---|
83df96d6 JS |
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 | ||
edf6a063 | 15 | #if defined(__GNUG__) && !defined(__APPLE__) |
83df96d6 JS |
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; | |
1b0fb34b | 35 | class WXDLLEXPORT wxEventLoop; |
9ce8d6a2 | 36 | class WXDLLEXPORT wxXVisualInfo; |
83df96d6 JS |
37 | |
38 | // ---------------------------------------------------------------------------- | |
256d631a | 39 | // the wxApp class for wxX11 - see wxAppBase for more details |
83df96d6 JS |
40 | // ---------------------------------------------------------------------------- |
41 | ||
42 | class WXDLLEXPORT wxApp : public wxAppBase | |
43 | { | |
44 | DECLARE_DYNAMIC_CLASS(wxApp) | |
45 | ||
46 | public: | |
47 | wxApp(); | |
dc4025af | 48 | ~wxApp(); |
83df96d6 JS |
49 | |
50 | // override base class (pure) virtuals | |
51 | // ----------------------------------- | |
52 | ||
53 | virtual int MainLoop(); | |
54 | virtual void ExitMainLoop(); | |
55 | virtual bool Initialized(); | |
56 | virtual bool Pending(); | |
57 | virtual void Dispatch(); | |
e2478fde VZ |
58 | |
59 | virtual void Exit(); | |
60 | ||
83df96d6 | 61 | virtual bool Yield(bool onlyIfNeeded = FALSE); |
90a1a975 | 62 | virtual bool ProcessIdle(); |
e2478fde | 63 | virtual void WakeUpIdle(); |
83df96d6 JS |
64 | |
65 | virtual bool OnInitGui(); | |
66 | ||
83df96d6 JS |
67 | // implementation from now on |
68 | // -------------------------- | |
69 | ||
70 | void OnIdle(wxIdleEvent& event); | |
71 | ||
72 | // Send idle event to all top-level windows. | |
73 | // Returns TRUE if more idle time is requested. | |
74 | bool SendIdleEvents(); | |
75 | ||
76 | // Send idle event to window and all subwindows | |
77 | // Returns TRUE if more idle time is requested. | |
78 | bool SendIdleEvents(wxWindow* win); | |
79 | ||
83df96d6 | 80 | // Processes an X event. |
086fd560 | 81 | virtual bool ProcessXEvent(WXEvent* event); |
83df96d6 | 82 | |
d715d419 | 83 | #ifdef __WXDEBUG__ |
5968a0dc | 84 | virtual void OnAssert(const wxChar *file, int line, const wxChar* cond, const wxChar *msg); |
d715d419 | 85 | #endif // __WXDEBUG__ |
7edcafa4 | 86 | |
83df96d6 JS |
87 | protected: |
88 | bool m_showOnInit; | |
89 | ||
90 | public: | |
91 | // Implementation | |
92 | static bool Initialize(); | |
93 | static void CleanUp(); | |
94 | ||
95 | void DeletePendingObjects(); | |
83df96d6 | 96 | |
7eaac9f5 | 97 | WXWindow GetTopLevelWidget() const { return m_topLevelWidget; } |
83df96d6 | 98 | WXColormap GetMainColormap(WXDisplay* display); |
83df96d6 JS |
99 | long GetMaxRequestSize() const { return m_maxRequestSize; } |
100 | ||
101 | // This handler is called when a property change event occurs | |
086fd560 | 102 | virtual bool HandlePropertyChange(WXEvent *event); |
83df96d6 | 103 | |
256d631a JS |
104 | // Values that can be passed on the command line. |
105 | // Returns -1, -1 if none specified. | |
106 | const wxSize& GetInitialSize() const { return m_initialSize; } | |
107 | bool GetShowIconic() const { return m_showIconic; } | |
a11672a4 | 108 | |
2b5f62a0 VZ |
109 | #if wxUSE_UNICODE |
110 | // Global context for Pango layout. Either use X11 | |
111 | // or use Xft rendering according to GDK_USE_XFT | |
112 | // environment variable | |
113 | PangoContext* GetPangoContext(); | |
114 | #endif | |
9ce8d6a2 MB |
115 | |
116 | wxXVisualInfo* GetVisualInfo(WXDisplay* display) | |
117 | { | |
118 | // this should be implemented correctly for wxBitmap to work | |
119 | // with multiple display | |
120 | return m_visualInfo; | |
121 | } | |
122 | ||
dc4025af RR |
123 | // We need this before creating the app |
124 | static WXDisplay* GetDisplay() { return ms_display; } | |
125 | static WXDisplay* ms_display; | |
126 | ||
83df96d6 | 127 | public: |
256d631a JS |
128 | static long sm_lastMessageTime; |
129 | bool m_showIconic; | |
130 | wxSize m_initialSize; | |
8601b2e1 | 131 | |
9ce8d6a2 MB |
132 | #if !wxUSE_NANOX |
133 | wxXVisualInfo* m_visualInfo; | |
8601b2e1 | 134 | #endif |
dc4025af | 135 | |
83df96d6 JS |
136 | protected: |
137 | bool m_keepGoing; | |
138 | ||
7eaac9f5 | 139 | WXWindow m_topLevelWidget; |
83df96d6 | 140 | WXColormap m_mainColormap; |
83df96d6 | 141 | long m_maxRequestSize; |
1b0fb34b | 142 | wxEventLoop* m_mainLoop; |
83df96d6 JS |
143 | |
144 | DECLARE_EVENT_TABLE() | |
145 | }; | |
146 | ||
147 | int WXDLLEXPORT wxEntry( int argc, char *argv[] ); | |
148 | ||
149 | #endif | |
150 | // _WX_APP_H_ | |
151 |