]>
Commit | Line | Data |
---|---|---|
2bda0e17 KB |
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$ | |
bbcdf8bc | 8 | // Copyright: (c) Julian Smart |
65571936 | 9 | // Licence: wxWindows licence |
2bda0e17 KB |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
bbcdf8bc JS |
12 | #ifndef _WX_APP_H_ |
13 | #define _WX_APP_H_ | |
2bda0e17 | 14 | |
12028905 | 15 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
2bda0e17 KB |
16 | #pragma interface "app.h" |
17 | #endif | |
18 | ||
a3ef5bf5 | 19 | #include "wx/event.h" |
ebea0891 | 20 | #include "wx/icon.h" |
2bda0e17 | 21 | |
62a9d04c VS |
22 | class WXDLLIMPEXP_CORE wxFrame; |
23 | class WXDLLIMPEXP_CORE wxWindow; | |
24 | class WXDLLIMPEXP_CORE wxApp; | |
25 | class WXDLLIMPEXP_CORE wxKeyEvent; | |
26 | class WXDLLIMPEXP_BASE wxLog; | |
2bda0e17 | 27 | |
2bda0e17 KB |
28 | // Represents the application. Derive OnInit and declare |
29 | // a new App object to start application | |
094637f6 | 30 | class WXDLLEXPORT wxApp : public wxAppBase |
2bda0e17 | 31 | { |
094637f6 | 32 | DECLARE_DYNAMIC_CLASS(wxApp) |
c085e333 | 33 | |
094637f6 VZ |
34 | public: |
35 | wxApp(); | |
36 | virtual ~wxApp(); | |
580c10e3 | 37 | |
094637f6 | 38 | // override base class (pure) virtuals |
05e2b077 | 39 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 VZ |
40 | virtual void CleanUp(); |
41 | ||
77c46f00 | 42 | virtual bool Yield(bool onlyIfNeeded = false); |
e2478fde | 43 | virtual void WakeUpIdle(); |
2bda0e17 | 44 | |
094637f6 VZ |
45 | virtual void SetPrintMode(int mode) { m_printMode = mode; } |
46 | virtual int GetPrintMode() const { return m_printMode; } | |
2bda0e17 | 47 | |
094637f6 VZ |
48 | // implementation only |
49 | void OnIdle(wxIdleEvent& event); | |
50 | void OnEndSession(wxCloseEvent& event); | |
51 | void OnQueryEndSession(wxCloseEvent& event); | |
2bda0e17 | 52 | |
6046e57a VZ |
53 | #if wxUSE_EXCEPTIONS |
54 | virtual bool OnExceptionInMainLoop(); | |
55 | #endif // wxUSE_EXCEPTIONS | |
56 | ||
13fc164d VZ |
57 | // deprecated functions, use wxEventLoop directly instead |
58 | #if WXWIN_COMPATIBILITY_2_4 | |
59 | wxDEPRECATED( void DoMessage(WXMSG *pMsg) ); | |
60 | wxDEPRECATED( bool DoMessage() ); | |
61 | wxDEPRECATED( bool ProcessMessage(WXMSG* pMsg) ); | |
62 | #endif // WXWIN_COMPATIBILITY_2_4 | |
63 | ||
2bda0e17 | 64 | protected: |
1e6feb95 | 65 | int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT |
094637f6 | 66 | |
2bda0e17 | 67 | public: |
094637f6 | 68 | // Implementation |
094637f6 | 69 | static bool RegisterWindowClasses(); |
9787a4b6 | 70 | static bool UnregisterWindowClasses(); |
ed45e263 | 71 | |
6d167489 | 72 | #if wxUSE_RICHEDIT |
77c46f00 | 73 | // initialize the richedit DLL of (at least) given version, return true if |
6d167489 VZ |
74 | // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) |
75 | static bool InitRichEdit(int version = 2); | |
76 | #endif // wxUSE_RICHEDIT | |
77 | ||
78 | // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it | |
79 | // wasn't found at all | |
80 | static int GetComCtl32Version(); | |
2bda0e17 | 81 | |
94826170 VZ |
82 | // the SW_XXX value to be used for the frames opened by the application |
83 | // (currently seems unused which is a bug -- TODO) | |
84 | static int m_nCmdShow; | |
2bda0e17 KB |
85 | |
86 | protected: | |
094637f6 | 87 | DECLARE_EVENT_TABLE() |
fc7a2a60 | 88 | DECLARE_NO_COPY_CLASS(wxApp) |
2bda0e17 KB |
89 | }; |
90 | ||
956495ca VZ |
91 | // ---------------------------------------------------------------------------- |
92 | // MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition | |
93 | // ---------------------------------------------------------------------------- | |
94 | ||
95 | // we need HINSTANCE declaration to define WinMain() | |
96 | #include "wx/msw/wrapwin.h" | |
97 | ||
98 | #ifndef SW_SHOWNORMAL | |
99 | #define SW_SHOWNORMAL 1 | |
100 | #endif | |
101 | ||
102 | // WinMain() is always ANSI, even in Unicode build, under normal Windows | |
103 | // but is always Unicode under CE | |
104 | #ifdef __WXWINCE__ | |
105 | typedef wchar_t *wxCmdLineArgType; | |
106 | #else | |
107 | typedef char *wxCmdLineArgType; | |
108 | #endif | |
109 | ||
110 | extern int WXDLLEXPORT | |
111 | wxEntry(HINSTANCE hInstance, | |
112 | HINSTANCE hPrevInstance = NULL, | |
113 | wxCmdLineArgType pCmdLine = NULL, | |
114 | int nCmdShow = SW_SHOWNORMAL); | |
115 | ||
116 | #define IMPLEMENT_WXWIN_MAIN \ | |
117 | extern "C" int WINAPI WinMain(HINSTANCE hInstance, \ | |
118 | HINSTANCE hPrevInstance, \ | |
119 | wxCmdLineArgType lpCmdLine, \ | |
120 | int nCmdShow) \ | |
121 | { \ | |
122 | return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \ | |
123 | } | |
2bda0e17 | 124 | |
94826170 | 125 | #endif // _WX_APP_H_ |
2bda0e17 | 126 |