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