]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: app.h | |
3 | // Purpose: wxApp class | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
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 | #include "wx/event.h" | |
20 | #include "wx/icon.h" | |
21 | ||
22 | class WXDLLEXPORT wxFrame; | |
23 | class WXDLLEXPORT wxWindow; | |
24 | class WXDLLEXPORT wxApp ; | |
25 | class WXDLLEXPORT wxKeyEvent; | |
26 | class WXDLLEXPORT wxLog; | |
27 | ||
28 | // Represents the application. Derive OnInit and declare | |
29 | // a new App object to start application | |
30 | class WXDLLEXPORT wxApp : public wxAppBase | |
31 | { | |
32 | DECLARE_DYNAMIC_CLASS(wxApp) | |
33 | ||
34 | public: | |
35 | wxApp(); | |
36 | virtual ~wxApp(); | |
37 | ||
38 | // override base class (pure) virtuals | |
39 | virtual int MainLoop(); | |
40 | virtual void ExitMainLoop(); | |
41 | virtual bool Initialized(); | |
42 | virtual bool Pending(); | |
43 | virtual void Dispatch(); | |
44 | virtual bool Yield(bool onlyIfNeeded = FALSE); | |
45 | ||
46 | virtual wxIcon GetStdIcon(int which) const; | |
47 | ||
48 | virtual void SetPrintMode(int mode) { m_printMode = mode; } | |
49 | virtual int GetPrintMode() const { return m_printMode; } | |
50 | ||
51 | // implementation only | |
52 | void OnIdle(wxIdleEvent& event); | |
53 | void OnEndSession(wxCloseEvent& event); | |
54 | void OnQueryEndSession(wxCloseEvent& event); | |
55 | ||
56 | // Send idle event to all top-level windows. | |
57 | // Returns TRUE if more idle time is requested. | |
58 | bool SendIdleEvents(); | |
59 | ||
60 | // Send idle event to window and all subwindows | |
61 | // Returns TRUE if more idle time is requested. | |
62 | bool SendIdleEvents(wxWindow* win); | |
63 | ||
64 | void SetAuto3D(bool flag) { m_auto3D = flag; } | |
65 | bool GetAuto3D() const { return m_auto3D; } | |
66 | ||
67 | protected: | |
68 | bool m_showOnInit; | |
69 | int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT | |
70 | bool m_auto3D ; // Always use 3D controls, except where overriden | |
71 | ||
72 | /* Windows-specific wxApp definitions */ | |
73 | ||
74 | public: | |
75 | ||
76 | // Implementation | |
77 | static bool Initialize(); | |
78 | static void CleanUp(); | |
79 | ||
80 | static bool RegisterWindowClasses(); | |
81 | static bool UnregisterWindowClasses(); | |
82 | ||
83 | // Convert Windows to argc, argv style | |
84 | void ConvertToStandardCommandArgs(const char* p); | |
85 | ||
86 | // message processing | |
87 | // ------------------ | |
88 | ||
89 | // process the given message | |
90 | virtual void DoMessage(WXMSG *pMsg); | |
91 | ||
92 | // retrieve the next message from the queue and process it | |
93 | virtual bool DoMessage(); | |
94 | ||
95 | // preprocess the message | |
96 | virtual bool ProcessMessage(WXMSG* pMsg); | |
97 | ||
98 | // idle processing | |
99 | // --------------- | |
100 | ||
101 | void DeletePendingObjects(); | |
102 | bool ProcessIdle(); | |
103 | ||
104 | #if wxUSE_RICHEDIT | |
105 | // initialize the richedit DLL of (at least) given version, return TRUE if | |
106 | // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) | |
107 | static bool InitRichEdit(int version = 2); | |
108 | #endif // wxUSE_RICHEDIT | |
109 | ||
110 | // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it | |
111 | // wasn't found at all | |
112 | static int GetComCtl32Version(); | |
113 | ||
114 | public: | |
115 | int m_nCmdShow; | |
116 | ||
117 | protected: | |
118 | bool m_keepGoing; | |
119 | ||
120 | DECLARE_EVENT_TABLE() | |
121 | }; | |
122 | ||
123 | #if !defined(_WINDLL) || (defined(_WINDLL) && defined(WXMAKINGDLL)) | |
124 | int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance, WXHINSTANCE hPrevInstance, | |
125 | char *lpszCmdLine, int nCmdShow, bool enterLoop = TRUE); | |
126 | #else | |
127 | int WXDLLEXPORT wxEntry(WXHINSTANCE hInstance); | |
128 | #endif | |
129 | ||
130 | #endif | |
131 | // _WX_APP_H_ | |
132 |