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