]>
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(); | |
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 | virtual bool Yield(bool onlyIfNeeded = FALSE); | |
58 | ||
59 | virtual bool OnInitGui(); | |
60 | ||
61 | virtual wxIcon GetStdIcon(int which) const; | |
62 | ||
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 JS |
76 | // Processes an X event. |
77 | virtual void ProcessXEvent(WXEvent* event); | |
78 | ||
7edcafa4 JS |
79 | virtual void OnAssert(const wxChar *file, int line, const wxChar *msg); |
80 | ||
83df96d6 JS |
81 | protected: |
82 | bool m_showOnInit; | |
83 | ||
84 | public: | |
85 | // Implementation | |
86 | static bool Initialize(); | |
87 | static void CleanUp(); | |
88 | ||
89 | void DeletePendingObjects(); | |
90 | bool ProcessIdle(); | |
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 | |
97 | virtual void HandlePropertyChange(WXEvent *event); | |
98 | ||
a11672a4 RR |
99 | // We need this before create the app |
100 | static WXDisplay* GetDisplay() { return ms_display; } | |
101 | static WXDisplay* ms_display; | |
256d631a JS |
102 | |
103 | // Values that can be passed on the command line. | |
104 | // Returns -1, -1 if none specified. | |
105 | const wxSize& GetInitialSize() const { return m_initialSize; } | |
106 | bool GetShowIconic() const { return m_showIconic; } | |
a11672a4 | 107 | |
83df96d6 | 108 | public: |
256d631a JS |
109 | static long sm_lastMessageTime; |
110 | bool m_showIconic; | |
111 | wxSize m_initialSize; | |
83df96d6 JS |
112 | protected: |
113 | bool m_keepGoing; | |
114 | ||
7eaac9f5 | 115 | WXWindow m_topLevelWidget; |
83df96d6 | 116 | WXColormap m_mainColormap; |
83df96d6 | 117 | long m_maxRequestSize; |
1b0fb34b | 118 | wxEventLoop* m_mainLoop; |
83df96d6 JS |
119 | |
120 | DECLARE_EVENT_TABLE() | |
121 | }; | |
122 | ||
123 | int WXDLLEXPORT wxEntry( int argc, char *argv[] ); | |
124 | ||
125 | #endif | |
126 | // _WX_APP_H_ | |
127 |