1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxApp class
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
18 class WXDLLIMPEXP_CORE wxFrame
;
19 class WXDLLIMPEXP_CORE wxWindow
;
20 class WXDLLIMPEXP_CORE wxApp
;
21 class WXDLLIMPEXP_CORE wxKeyEvent
;
22 class WXDLLIMPEXP_BASE wxLog
;
24 // Represents the application. Derive OnInit and declare
25 // a new App object to start application
26 class WXDLLEXPORT wxApp
: public wxAppBase
28 DECLARE_DYNAMIC_CLASS(wxApp
)
34 // override base class (pure) virtuals
35 virtual bool Initialize(int& argc
, wxChar
**argv
);
36 virtual void CleanUp();
38 virtual bool Yield(bool onlyIfNeeded
= false);
39 virtual void WakeUpIdle();
41 virtual void SetPrintMode(int mode
) { m_printMode
= mode
; }
42 virtual int GetPrintMode() const { return m_printMode
; }
44 // implementation only
45 void OnIdle(wxIdleEvent
& event
);
46 void OnEndSession(wxCloseEvent
& event
);
47 void OnQueryEndSession(wxCloseEvent
& event
);
50 virtual bool OnExceptionInMainLoop();
51 #endif // wxUSE_EXCEPTIONS
53 // deprecated functions, use wxEventLoop directly instead
54 #if WXWIN_COMPATIBILITY_2_4
55 wxDEPRECATED( void DoMessage(WXMSG
*pMsg
) );
56 wxDEPRECATED( bool DoMessage() );
57 wxDEPRECATED( bool ProcessMessage(WXMSG
* pMsg
) );
58 #endif // WXWIN_COMPATIBILITY_2_4
61 int m_printMode
; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
65 static bool RegisterWindowClasses();
66 static bool UnregisterWindowClasses();
69 // initialize the richedit DLL of (at least) given version, return true if
70 // ok (Win95 has version 1, Win98/NT4 has 1 and 2, W2K has 3)
71 static bool InitRichEdit(int version
= 2);
72 #endif // wxUSE_RICHEDIT
74 // returns 400, 470, 471 for comctl32.dll 4.00, 4.70, 4.71 or 0 if it
75 // wasn't found at all
76 static int GetComCtl32Version();
78 // the SW_XXX value to be used for the frames opened by the application
79 // (currently seems unused which is a bug -- TODO)
80 static int m_nCmdShow
;
84 DECLARE_NO_COPY_CLASS(wxApp
)
87 // ----------------------------------------------------------------------------
88 // MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition
89 // ----------------------------------------------------------------------------
91 // we need HINSTANCE declaration to define WinMain()
92 #include "wx/msw/wrapwin.h"
95 #define SW_SHOWNORMAL 1
98 // WinMain() is always ANSI, even in Unicode build, under normal Windows
99 // but is always Unicode under CE
101 typedef wchar_t *wxCmdLineArgType
;
103 typedef char *wxCmdLineArgType
;
106 extern int WXDLLEXPORT
107 wxEntry(HINSTANCE hInstance
,
108 HINSTANCE hPrevInstance
= NULL
,
109 wxCmdLineArgType pCmdLine
= NULL
,
110 int nCmdShow
= SW_SHOWNORMAL
);
112 #define IMPLEMENT_WXWIN_MAIN \
113 extern "C" int WINAPI WinMain(HINSTANCE hInstance, \
114 HINSTANCE hPrevInstance, \
115 wxCmdLineArgType lpCmdLine, \
118 return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \