]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/app.h
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / include / wx / msw / app.h
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 #include "wx/event.h"
16 #include "wx/icon.h"
17
18 class WXDLLIMPEXP_FWD_CORE wxFrame;
19 class WXDLLIMPEXP_FWD_CORE wxWindow;
20 class WXDLLIMPEXP_FWD_CORE wxApp;
21 class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
22 class WXDLLIMPEXP_FWD_BASE wxLog;
23
24 // Represents the application. Derive OnInit and declare
25 // a new App object to start application
26 class WXDLLEXPORT wxApp : public wxAppBase
27 {
28 DECLARE_DYNAMIC_CLASS(wxApp)
29
30 public:
31 wxApp();
32 virtual ~wxApp();
33
34 // override base class (pure) virtuals
35 virtual bool Initialize(int& argc, wxChar **argv);
36 virtual void CleanUp();
37
38 virtual bool Yield(bool onlyIfNeeded = false);
39 virtual void WakeUpIdle();
40
41 virtual void SetPrintMode(int mode) { m_printMode = mode; }
42 virtual int GetPrintMode() const { return m_printMode; }
43
44 // implementation only
45 void OnIdle(wxIdleEvent& event);
46 void OnEndSession(wxCloseEvent& event);
47 void OnQueryEndSession(wxCloseEvent& event);
48
49 #if wxUSE_EXCEPTIONS
50 virtual bool OnExceptionInMainLoop();
51 #endif // wxUSE_EXCEPTIONS
52
53 protected:
54 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
55
56 public:
57 // Implementation
58 static bool RegisterWindowClasses();
59 static bool UnregisterWindowClasses();
60
61 #if wxUSE_RICHEDIT
62 // initialize the richedit DLL of (at least) given version, return true if
63 // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
64 static bool InitRichEdit(int version = 2);
65 #endif // wxUSE_RICHEDIT
66
67 // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
68 // wasn't found at all
69 static int GetComCtl32Version();
70
71 // the same for shell32.dll: returns 400, 471, 500, 600, ... (4.70 not
72 // currently detected)
73 static int GetShell32Version();
74
75 // the SW_XXX value to be used for the frames opened by the application
76 // (currently seems unused which is a bug -- TODO)
77 static int m_nCmdShow;
78
79 protected:
80 DECLARE_EVENT_TABLE()
81 DECLARE_NO_COPY_CLASS(wxApp)
82 };
83
84 // ----------------------------------------------------------------------------
85 // MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition
86 // ----------------------------------------------------------------------------
87
88 // we need HINSTANCE declaration to define WinMain()
89 #include "wx/msw/wrapwin.h"
90
91 #ifndef SW_SHOWNORMAL
92 #define SW_SHOWNORMAL 1
93 #endif
94
95 // WinMain() is always ANSI, even in Unicode build, under normal Windows
96 // but is always Unicode under CE
97 #ifdef __WXWINCE__
98 typedef wchar_t *wxCmdLineArgType;
99 #else
100 typedef char *wxCmdLineArgType;
101 #endif
102
103 // wxMSW-only overloads of wxEntry() and wxEntryStart() which take the
104 // parameters passed to WinMain() instead of those passed to main()
105 extern bool WXDLLEXPORT
106 wxEntryStart(HINSTANCE hInstance,
107 HINSTANCE hPrevInstance = NULL,
108 wxCmdLineArgType pCmdLine = NULL,
109 int nCmdShow = SW_SHOWNORMAL);
110
111 extern int WXDLLEXPORT
112 wxEntry(HINSTANCE hInstance,
113 HINSTANCE hPrevInstance = NULL,
114 wxCmdLineArgType pCmdLine = NULL,
115 int nCmdShow = SW_SHOWNORMAL);
116
117 #define IMPLEMENT_WXWIN_MAIN \
118 extern "C" int WINAPI WinMain(HINSTANCE hInstance, \
119 HINSTANCE hPrevInstance, \
120 wxCmdLineArgType lpCmdLine, \
121 int nCmdShow) \
122 { \
123 return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \
124 }
125
126 #endif // _WX_APP_H_
127