]>
Commit | Line | Data |
---|---|---|
2bda0e17 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/msw/app.h |
2bda0e17 KB |
3 | // Purpose: wxApp class |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 01/02/97 | |
bbcdf8bc | 7 | // Copyright: (c) Julian Smart |
65571936 | 8 | // Licence: wxWindows licence |
2bda0e17 KB |
9 | ///////////////////////////////////////////////////////////////////////////// |
10 | ||
bbcdf8bc JS |
11 | #ifndef _WX_APP_H_ |
12 | #define _WX_APP_H_ | |
2bda0e17 | 13 | |
a3ef5bf5 | 14 | #include "wx/event.h" |
ebea0891 | 15 | #include "wx/icon.h" |
2bda0e17 | 16 | |
b5dbe15d VS |
17 | class WXDLLIMPEXP_FWD_CORE wxFrame; |
18 | class WXDLLIMPEXP_FWD_CORE wxWindow; | |
19 | class WXDLLIMPEXP_FWD_CORE wxApp; | |
20 | class WXDLLIMPEXP_FWD_CORE wxKeyEvent; | |
21 | class WXDLLIMPEXP_FWD_BASE wxLog; | |
2bda0e17 | 22 | |
2bda0e17 KB |
23 | // Represents the application. Derive OnInit and declare |
24 | // a new App object to start application | |
53a2db12 | 25 | class WXDLLIMPEXP_CORE wxApp : public wxAppBase |
2bda0e17 | 26 | { |
094637f6 VZ |
27 | public: |
28 | wxApp(); | |
29 | virtual ~wxApp(); | |
580c10e3 | 30 | |
094637f6 | 31 | // override base class (pure) virtuals |
05e2b077 | 32 | virtual bool Initialize(int& argc, wxChar **argv); |
94826170 VZ |
33 | virtual void CleanUp(); |
34 | ||
e2478fde | 35 | virtual void WakeUpIdle(); |
2bda0e17 | 36 | |
094637f6 VZ |
37 | virtual void SetPrintMode(int mode) { m_printMode = mode; } |
38 | virtual int GetPrintMode() const { return m_printMode; } | |
2bda0e17 | 39 | |
094637f6 VZ |
40 | // implementation only |
41 | void OnIdle(wxIdleEvent& event); | |
42 | void OnEndSession(wxCloseEvent& event); | |
43 | void OnQueryEndSession(wxCloseEvent& event); | |
2bda0e17 | 44 | |
6046e57a VZ |
45 | #if wxUSE_EXCEPTIONS |
46 | virtual bool OnExceptionInMainLoop(); | |
47 | #endif // wxUSE_EXCEPTIONS | |
48 | ||
d9698bd4 VZ |
49 | // MSW-specific from now on |
50 | // ------------------------ | |
51 | ||
52 | // this suffix should be appended to all our Win32 class names to obtain a | |
53 | // variant registered without CS_[HV]REDRAW styles | |
9a83f860 | 54 | static const wxChar *GetNoRedrawClassSuffix() { return wxT("NR"); } |
d9698bd4 VZ |
55 | |
56 | // get the name of the registered Win32 class with the given (unique) base | |
57 | // name: this function constructs the unique class name using this name as | |
58 | // prefix, checks if the class is already registered and registers it if it | |
59 | // isn't and returns the name it was registered under (or NULL if it failed) | |
60 | // | |
61 | // the registered class will always have CS_[HV]REDRAW and CS_DBLCLKS | |
62 | // styles as well as any additional styles specified as arguments here; and | |
63 | // there will be also a companion registered class identical to this one | |
64 | // but without CS_[HV]REDRAW whose name will be the same one but with | |
65 | // GetNoRedrawClassSuffix() | |
66 | // | |
67 | // the background brush argument must be either a COLOR_XXX standard value | |
68 | // or (default) -1 meaning that the class paints its background itself | |
69 | static const wxChar *GetRegisteredClassName(const wxChar *name, | |
70 | int bgBrushCol = -1, | |
71 | int extraStyles = 0); | |
72 | ||
73 | // return true if this name corresponds to one of the classes we registered | |
74 | // in the previous GetRegisteredClassName() calls | |
75 | static bool IsRegisteredClassName(const wxString& name); | |
76 | ||
2bda0e17 | 77 | protected: |
1e6feb95 | 78 | int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT |
094637f6 | 79 | |
2bda0e17 | 80 | public: |
d9698bd4 VZ |
81 | // unregister any window classes registered by GetRegisteredClassName() |
82 | static void UnregisterWindowClasses(); | |
ed45e263 | 83 | |
6d167489 | 84 | #if wxUSE_RICHEDIT |
77c46f00 | 85 | // initialize the richedit DLL of (at least) given version, return true if |
6d167489 VZ |
86 | // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3) |
87 | static bool InitRichEdit(int version = 2); | |
88 | #endif // wxUSE_RICHEDIT | |
89 | ||
90 | // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it | |
91 | // wasn't found at all | |
92 | static int GetComCtl32Version(); | |
2bda0e17 | 93 | |
5e9b921d VZ |
94 | // the same for shell32.dll: returns 400, 471, 500, 600, ... (4.70 not |
95 | // currently detected) | |
96 | static int GetShell32Version(); | |
97 | ||
94826170 VZ |
98 | // the SW_XXX value to be used for the frames opened by the application |
99 | // (currently seems unused which is a bug -- TODO) | |
100 | static int m_nCmdShow; | |
2bda0e17 KB |
101 | |
102 | protected: | |
094637f6 | 103 | DECLARE_EVENT_TABLE() |
c0c133e1 | 104 | wxDECLARE_NO_COPY_CLASS(wxApp); |
d9698bd4 | 105 | DECLARE_DYNAMIC_CLASS(wxApp) |
2bda0e17 KB |
106 | }; |
107 | ||
6b4296f7 VZ |
108 | #ifdef __WXWINCE__ |
109 | ||
110 | // under CE provide a dummy implementation of GetComCtl32Version() returning | |
111 | // the value passing all ">= 470" tests (which are the only ones used in our | |
112 | // code currently) as commctrl.dll under CE 2.0 and later support comctl32.dll | |
113 | // functionality | |
114 | inline int wxApp::GetComCtl32Version() | |
115 | { | |
116 | return 471; | |
117 | } | |
118 | ||
119 | // this is not currently used at all under CE so it's not really clear what do | |
120 | // we need to return from here | |
121 | inline int wxApp::GetShell32Version() | |
122 | { | |
123 | return 0; | |
124 | } | |
125 | ||
126 | #endif // __WXWINCE__ | |
127 | ||
94826170 | 128 | #endif // _WX_APP_H_ |
2bda0e17 | 129 |