]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/app.h
don't pass unnecessary arguments to FindOrCreateBrush/Pen()
[wxWidgets.git] / include / wx / msw / app.h
CommitLineData
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
a3ef5bf5 15#include "wx/event.h"
ebea0891 16#include "wx/icon.h"
2bda0e17 17
b5dbe15d
VS
18class WXDLLIMPEXP_FWD_CORE wxFrame;
19class WXDLLIMPEXP_FWD_CORE wxWindow;
20class WXDLLIMPEXP_FWD_CORE wxApp;
21class WXDLLIMPEXP_FWD_CORE wxKeyEvent;
22class WXDLLIMPEXP_FWD_BASE wxLog;
2bda0e17 23
2bda0e17
KB
24// Represents the application. Derive OnInit and declare
25// a new App object to start application
094637f6 26class WXDLLEXPORT wxApp : public wxAppBase
2bda0e17 27{
094637f6 28 DECLARE_DYNAMIC_CLASS(wxApp)
c085e333 29
094637f6
VZ
30public:
31 wxApp();
32 virtual ~wxApp();
580c10e3 33
094637f6 34 // override base class (pure) virtuals
05e2b077 35 virtual bool Initialize(int& argc, wxChar **argv);
94826170
VZ
36 virtual void CleanUp();
37
77c46f00 38 virtual bool Yield(bool onlyIfNeeded = false);
e2478fde 39 virtual void WakeUpIdle();
2bda0e17 40
094637f6
VZ
41 virtual void SetPrintMode(int mode) { m_printMode = mode; }
42 virtual int GetPrintMode() const { return m_printMode; }
2bda0e17 43
094637f6
VZ
44 // implementation only
45 void OnIdle(wxIdleEvent& event);
46 void OnEndSession(wxCloseEvent& event);
47 void OnQueryEndSession(wxCloseEvent& event);
2bda0e17 48
6046e57a
VZ
49#if wxUSE_EXCEPTIONS
50 virtual bool OnExceptionInMainLoop();
51#endif // wxUSE_EXCEPTIONS
52
2bda0e17 53protected:
1e6feb95 54 int m_printMode; // wxPRINT_WINDOWS, wxPRINT_POSTSCRIPT
094637f6 55
2bda0e17 56public:
094637f6 57 // Implementation
094637f6 58 static bool RegisterWindowClasses();
9787a4b6 59 static bool UnregisterWindowClasses();
ed45e263 60
6d167489 61#if wxUSE_RICHEDIT
77c46f00 62 // initialize the richedit DLL of (at least) given version, return true if
6d167489
VZ
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();
2bda0e17 70
5e9b921d
VZ
71 // the same for shell32.dll: returns 400, 471, 500, 600, ... (4.70 not
72 // currently detected)
73 static int GetShell32Version();
74
94826170
VZ
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;
2bda0e17
KB
78
79protected:
094637f6 80 DECLARE_EVENT_TABLE()
fc7a2a60 81 DECLARE_NO_COPY_CLASS(wxApp)
2bda0e17
KB
82};
83
6b4296f7
VZ
84#ifdef __WXWINCE__
85
86// under CE provide a dummy implementation of GetComCtl32Version() returning
87// the value passing all ">= 470" tests (which are the only ones used in our
88// code currently) as commctrl.dll under CE 2.0 and later support comctl32.dll
89// functionality
90inline int wxApp::GetComCtl32Version()
91{
92 return 471;
93}
94
95// this is not currently used at all under CE so it's not really clear what do
96// we need to return from here
97inline int wxApp::GetShell32Version()
98{
99 return 0;
100}
101
102#endif // __WXWINCE__
103
956495ca
VZ
104// ----------------------------------------------------------------------------
105// MSW-specific wxEntry() overload and IMPLEMENT_WXWIN_MAIN definition
106// ----------------------------------------------------------------------------
107
108// we need HINSTANCE declaration to define WinMain()
109#include "wx/msw/wrapwin.h"
110
111#ifndef SW_SHOWNORMAL
112 #define SW_SHOWNORMAL 1
113#endif
114
115// WinMain() is always ANSI, even in Unicode build, under normal Windows
116// but is always Unicode under CE
117#ifdef __WXWINCE__
118 typedef wchar_t *wxCmdLineArgType;
119#else
120 typedef char *wxCmdLineArgType;
121#endif
122
d76a558d
VZ
123// wxMSW-only overloads of wxEntry() and wxEntryStart() which take the
124// parameters passed to WinMain() instead of those passed to main()
125extern bool WXDLLEXPORT
126wxEntryStart(HINSTANCE hInstance,
127 HINSTANCE hPrevInstance = NULL,
128 wxCmdLineArgType pCmdLine = NULL,
129 int nCmdShow = SW_SHOWNORMAL);
130
956495ca
VZ
131extern int WXDLLEXPORT
132wxEntry(HINSTANCE hInstance,
133 HINSTANCE hPrevInstance = NULL,
134 wxCmdLineArgType pCmdLine = NULL,
135 int nCmdShow = SW_SHOWNORMAL);
136
137#define IMPLEMENT_WXWIN_MAIN \
138 extern "C" int WINAPI WinMain(HINSTANCE hInstance, \
139 HINSTANCE hPrevInstance, \
140 wxCmdLineArgType lpCmdLine, \
141 int nCmdShow) \
142 { \
143 return wxEntry(hInstance, hPrevInstance, lpCmdLine, nCmdShow); \
144 }
2bda0e17 145
94826170 146#endif // _WX_APP_H_
2bda0e17 147