ScummVM API documentation
afxwin.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef BAGEL_MFC_AFXWIN_H
23 #define BAGEL_MFC_AFXWIN_H
24 
25 #include "common/events.h"
26 #include "common/fs.h"
27 #include "graphics/palette.h"
28 #include "graphics/screen.h"
29 #include "bagel/mfc/minwindef.h"
30 #include "bagel/mfc/wingdi.h"
31 #include "bagel/mfc/afx.h"
32 #include "bagel/mfc/afxmsg.h"
33 #include "bagel/mfc/afxstr.h"
34 #include "bagel/mfc/atltypes.h"
35 #include "bagel/mfc/global_functions.h"
36 #include "bagel/mfc/gfx/surface.h"
37 #include "bagel/mfc/gfx/cursor.h"
38 #include "bagel/mfc/gfx/dialog_template.h"
39 #include "bagel/mfc/gfx/fonts.h"
40 #include "bagel/mfc/gfx/text_render.h"
41 #include "bagel/mfc/libs/array.h"
42 #include "bagel/mfc/libs/event_loop.h"
43 #include "bagel/mfc/libs/events.h"
44 #include "bagel/mfc/libs/list.h"
45 #include "bagel/mfc/libs/settings.h"
46 
47 namespace Bagel {
48 namespace MFC {
49 
50 constexpr uint32 DEFAULT_MODAL_RESULT = MKTAG('S', 'C', 'V', 'M');
51 
52 class CBitmap;
53 class CCmdTarget;
54 class CCmdUI;
55 class CDC;
56 class CDocTemplate;
57 class CDocument;
58 class CFrameWnd;
59 class CListBox;
60 class CScrollBar;
61 class CView;
62 class CWinThread;
63 class CWnd;
64 
65 // Dummy class definitions that may need replacing later
66 struct COPYDATASTRUCT {};
67 struct HELPINFO {};
69 struct NMHDR {};
70 struct WINDOWPOS {};
71 
72 /*============================================================================*/
73 // CMenu
74 
75 class CMenu : public CObject {
76 public:
77  // Constructors
78  CMenu();
79 
80  bool CreateMenu();
81  bool CreatePopupMenu();
82  bool LoadMenu(const char *lpszResourceName);
83  bool LoadMenu(unsigned int nIDResource);
84  bool LoadMenuIndirect(const void *lpMenuTemplate);
85  bool DestroyMenu();
86 
87  static CMenu *FromHandle(HMENU hMenu);
88 
89  unsigned int CheckMenuItem(unsigned int nIDCheckItem, unsigned int nCheck);
90 };
91 
92 /*============================================================================*/
93 // Window message map handling
94 
95 
96 enum AfxSig {
97  AfxSig_end = 0, // [marks end of message map]
98 
99  AfxSig_b_D_v, // bool (CDC*)
100  AfxSig_b_b_v, // bool (bool)
101  AfxSig_b_u_v, // bool (unsigned int)
102  AfxSig_b_h_v, // bool (HANDLE)
103  AfxSig_b_W_uu, // bool (CWnd*, unsigned int, unsigned int)
104  AfxSig_b_W_COPYDATASTRUCT, // bool (CWnd*, COPYDATASTRUCT*)
105  AfxSig_b_v_HELPINFO, // bool (LPHELPINFO);
106  AfxSig_CTLCOLOR, // HBRUSH (CDC*, CWnd*, unsigned int)
107  AfxSig_CTLCOLOR_REFLECT, // HBRUSH (CDC*, unsigned int)
108  AfxSig_i_u_W_u, // int (unsigned int, CWnd*, unsigned int) // ?TOITEM
109  AfxSig_i_uu_v, // int (unsigned int, unsigned int)
110  AfxSig_i_W_uu, // int (CWnd*, unsigned int, unsigned int)
111  AfxSig_i_v_s, // int (uint16 *)
112  AfxSig_l_w_l, // LRESULT (WPARAM, LPARAM)
113  AfxSig_l_uu_M, // LRESULT (unsigned int, unsigned int, CMenu*)
114  AfxSig_v_b_h, // void (bool, HANDLE)
115  AfxSig_v_h_v, // void (HANDLE)
116  AfxSig_v_h_h, // void (HANDLE, HANDLE)
117  AfxSig_v_v_v, // void ()
118  AfxSig_v_u_v, // void (unsigned int)
119  AfxSig_v_up_v, // void (uintptr)
120  AfxSig_v_u_u, // void (unsigned int, unsigned int)
121  AfxSig_v_uu_v, // void (unsigned int, unsigned int)
122  AfxSig_v_v_ii, // void (int, int)
123  AfxSig_v_u_uu, // void (unsigned int, unsigned int, unsigned int)
124  AfxSig_v_u_ii, // void (unsigned int, int, int)
125  AfxSig_v_u_W, // void (unsigned int, CWnd*)
126  AfxSig_i_u_v, // int (unsigned int)
127  AfxSig_u_u_v, // unsigned int (unsigned int)
128  AfxSig_b_v_v, // bool ()
129  AfxSig_v_w_l, // void (WPARAM, LPARAM)
130  AfxSig_MDIACTIVATE, // void (bool, CWnd*, CWnd*)
131  AfxSig_v_D_v, // void (CDC*)
132  AfxSig_v_M_v, // void (CMenu*)
133  AfxSig_v_M_ub, // void (CMenu*, unsigned int, bool)
134  AfxSig_v_W_v, // void (CWnd*)
135  AfxSig_v_v_W, // void (CWnd*)
136  AfxSig_v_W_uu, // void (CWnd*, unsigned int, unsigned int)
137  AfxSig_v_W_p, // void (CWnd*, CPoint)
138  AfxSig_v_W_h, // void (CWnd*, HANDLE)
139  AfxSig_C_v_v, // HCURSOR ()
140  AfxSig_ACTIVATE, // void (unsigned int, CWnd*, bool)
141  AfxSig_SCROLL, // void (unsigned int, unsigned int, CWnd*)
142  AfxSig_SCROLL_REFLECT, // void (unsigned int, unsigned int)
143  AfxSig_v_v_s, // void (uint16 *)
144  AfxSig_v_u_cs, // void (unsigned int, const char *)
145  AfxSig_OWNERDRAW, // void (int, uint16 *) force return true
146  AfxSig_i_i_s, // int (int, uint16 *)
147  AfxSig_u_v_p, // unsigned int (CPoint)
148  AfxSig_u_v_v, // unsigned int ()
149  AfxSig_v_b_NCCALCSIZEPARAMS, // void (bool, NCCALCSIZE_PARAMS*)
150  AfxSig_v_v_WINDOWPOS, // void (WINDOWPOS*)
151  AfxSig_v_uu_M, // void (unsigned int, unsigned int, HMENU)
152  AfxSig_v_u_p, // void (unsigned int, CPoint)
153  AfxSig_SIZING, // void (unsigned int, LPRECT)
154  AfxSig_MOUSEWHEEL, // bool (unsigned int, short, CPoint)
155  AfxSig_MOUSEHWHEEL, // void (unsigned int, short, CPoint)
156  AfxSigCmd_v, // void ()
157  AfxSigCmd_b, // bool ()
158  AfxSigCmd_RANGE, // void (unsigned int)
159  AfxSigCmd_EX, // bool (unsigned int)
160  AfxSigNotify_v, // void (NMHDR*, LRESULT*)
161  AfxSigNotify_b, // bool (NMHDR*, LRESULT*)
162  AfxSigNotify_RANGE, // void (unsigned int, NMHDR*, LRESULT*)
163  AfxSigNotify_EX, // bool (unsigned int, NMHDR*, LRESULT*)
164  AfxSigCmdUI, // void (CCmdUI*)
165  AfxSigCmdUI_RANGE, // void (CCmdUI*, unsigned int)
166  AfxSigCmd_v_pv, // void (void*)
167  AfxSigCmd_b_pv, // bool (void*)
168  AfxSig_l, // LRESULT ()
169  AfxSig_l_p, // LRESULT (CPOINT)
170  AfxSig_u_W_u, // unsigned int (CWnd*, unsigned int)
171  AfxSig_v_u_M, // void (unsigned int, CMenu* )
172  AfxSig_u_u_M, // unsigned int (unsigned int, CMenu* )
173  AfxSig_u_v_MENUGETOBJECTINFO, // unsigned int (MENUGETOBJECTINFO*)
174  AfxSig_v_M_u, // void (CMenu*, unsigned int)
175  AfxSig_v_u_LPMDINEXTMENU, // void (unsigned int, LPMDINEXTMENU)
176  AfxSig_APPCOMMAND, // void (CWnd*, unsigned int, unsigned int, unsigned int)
177  AfxSig_RAWINPUT, // void (unsigned int, HRAWINPUT)
178  AfxSig_u_u_u, // unsigned int (unsigned int, unsigned int)
179  AfxSig_MOUSE_XBUTTON, // void (unsigned int, unsigned int, CPoint)
180  AfxSig_MOUSE_NCXBUTTON, // void (short, unsigned int, CPoint)
181  AfxSig_INPUTLANGCHANGE, // void (unsigned int, unsigned int)
182  AfxSig_v_u_hkl, // void (unsigned int, HKL)
183  AfxSig_INPUTDEVICECHANGE, // void (unsigned short, HANDLE)
184  AfxSig_l_D_u, // LRESULT (CDC*, unsigned int)
185  AfxSig_i_v_S, // int (const char *)
186  AfxSig_vwpb, // void (HFONT, bool)
187  AfxSig_h_v_v, // HANDLE ()
188  AfxSig_h_b_h, // HANDLE (bool, HANDLE)
189  AfxSig_b_v_ii, // bool (int, int)
190  AfxSig_h_h_h, // HANDLE (HANDLE, HANDLE)
191  AfxSig_MDINext, // void (CWnd*, bool)
192  AfxSig_u_u_l, // unsigned int (unsigned int, LPARAM)
193 
194  // Old
195  AfxSig_bD = AfxSig_b_D_v, // bool (CDC*)
196  AfxSig_bb = AfxSig_b_b_v, // bool (bool)
197  AfxSig_bWww = AfxSig_b_W_uu, // bool (CWnd*, unsigned int, unsigned int)
198  AfxSig_hDWw = AfxSig_CTLCOLOR, // HBRUSH (CDC*, CWnd*, unsigned int)
199  AfxSig_hDw = AfxSig_CTLCOLOR_REFLECT, // HBRUSH (CDC*, unsigned int)
200  AfxSig_iwWw = AfxSig_i_u_W_u, // int (unsigned int, CWnd*, unsigned int)
201  AfxSig_iww = AfxSig_i_uu_v, // int (unsigned int, unsigned int)
202  AfxSig_iWww = AfxSig_i_W_uu, // int (CWnd*, unsigned int, unsigned int)
203  AfxSig_is = AfxSig_i_v_s, // int (uint16 *)
204  AfxSig_lwl = AfxSig_l_w_l, // LRESULT (WPARAM, LPARAM)
205  AfxSig_lwwM = AfxSig_l_uu_M, // LRESULT (unsigned int, unsigned int, CMenu*)
206  AfxSig_vv = AfxSig_v_v_v, // void ()
207 
208  AfxSig_vw = AfxSig_v_u_v, // void (unsigned int)
209  AfxSig_vww = AfxSig_v_u_u, // void (unsigned int, unsigned int)
210  AfxSig_vww2 = AfxSig_v_uu_v, // void (unsigned int, unsigned int) // both come from wParam
211  AfxSig_vvii = AfxSig_v_v_ii, // void (int, int) // wParam is ignored
212  AfxSig_vwww = AfxSig_v_u_uu, // void (unsigned int, unsigned int, unsigned int)
213  AfxSig_vwii = AfxSig_v_u_ii, // void (unsigned int, int, int)
214  AfxSig_vwl = AfxSig_v_w_l, // void (unsigned int, LPARAM)
215  AfxSig_vbWW = AfxSig_MDIACTIVATE, // void (bool, CWnd*, CWnd*)
216  AfxSig_vD = AfxSig_v_D_v, // void (CDC*)
217  AfxSig_vM = AfxSig_v_M_v, // void (CMenu*)
218  AfxSig_vMwb = AfxSig_v_M_ub, // void (CMenu*, unsigned int, bool)
219 
220  AfxSig_vW = AfxSig_v_W_v, // void (CWnd*)
221  AfxSig_vWww = AfxSig_v_W_uu, // void (CWnd*, unsigned int, unsigned int)
222  AfxSig_vWp = AfxSig_v_W_p, // void (CWnd*, CPoint)
223  AfxSig_vWh = AfxSig_v_W_h, // void (CWnd*, HANDLE)
224  AfxSig_vwW = AfxSig_v_u_W, // void (unsigned int, CWnd*)
225  AfxSig_vwWb = AfxSig_ACTIVATE, // void (unsigned int, CWnd*, bool)
226  AfxSig_vwwW = AfxSig_SCROLL, // void (unsigned int, unsigned int, CWnd*)
227  AfxSig_vwwx = AfxSig_SCROLL_REFLECT, // void (unsigned int, unsigned int)
228  AfxSig_vs = AfxSig_v_v_s, // void (uint16 *)
229  AfxSig_vOWNER = AfxSig_OWNERDRAW, // void (int, uint16 *), force return true
230  AfxSig_iis = AfxSig_i_i_s, // int (int, uint16 *)
231  AfxSig_wp = AfxSig_u_v_p, // unsigned int (CPoint)
232  AfxSig_wv = AfxSig_u_v_v, // unsigned int ()
233  AfxSig_vPOS = AfxSig_v_v_WINDOWPOS, // void (WINDOWPOS*)
234  AfxSig_vCALC = AfxSig_v_b_NCCALCSIZEPARAMS, // void (bool, NCCALCSIZE_PARAMS*)
235  AfxSig_vNMHDRpl = AfxSigNotify_v, // void (NMHDR*, LRESULT*)
236  AfxSig_bNMHDRpl = AfxSigNotify_b, // bool (NMHDR*, LRESULT*)
237  AfxSig_vwNMHDRpl = AfxSigNotify_RANGE, // void (unsigned int, NMHDR*, LRESULT*)
238  AfxSig_bwNMHDRpl = AfxSigNotify_EX, // bool (unsigned int, NMHDR*, LRESULT*)
239  AfxSig_bHELPINFO = AfxSig_b_v_HELPINFO, // bool (HELPINFO*)
240  AfxSig_vwSIZING = AfxSig_SIZING, // void (unsigned int, LPRECT) -- return true
241 
242  // signatures specific to CCmdTarget
243  AfxSig_cmdui = AfxSigCmdUI, // void (CCmdUI*)
244  AfxSig_cmduiw = AfxSigCmdUI_RANGE, // void (CCmdUI*, unsigned int)
245  AfxSig_vpv = AfxSigCmd_v_pv, // void (void*)
246  AfxSig_bpv = AfxSigCmd_b_pv, // bool (void*)
247 
248  // Other aliases (based on implementation)
249  AfxSig_vwwh = AfxSig_v_uu_M, // void (unsigned int, unsigned int, HMENU)
250  AfxSig_vwp = AfxSig_v_u_p, // void (unsigned int, CPoint)
251  AfxSig_bw = AfxSig_b_u_v, // bool (unsigned int)
252  AfxSig_bh = AfxSig_b_h_v, // bool (HANDLE)
253  AfxSig_iw = AfxSig_i_u_v, // int (unsigned int)
254  AfxSig_ww = AfxSig_u_u_v, // unsigned int (unsigned int)
255  AfxSig_bv = AfxSig_b_v_v, // bool ()
256  AfxSig_hv = AfxSig_C_v_v, // HANDLE ()
257  AfxSig_vb = AfxSig_vw, // void (bool)
258  AfxSig_vbh = AfxSig_v_b_h, // void (bool, HANDLE)
259  AfxSig_vbw = AfxSig_vww, // void (bool, unsigned int)
260  AfxSig_vhh = AfxSig_v_h_h, // void (HANDLE, HANDLE)
261  AfxSig_vh = AfxSig_v_h_v, // void (HANDLE)
262  AfxSig_viSS = AfxSig_vwl, // void (int, STYLESTRUCT*)
263  AfxSig_bwl = AfxSig_lwl,
264  AfxSig_vwMOVING = AfxSig_vwSIZING, // void (unsigned int, LPRECT) -- return true
265 
266  AfxSig_vW2 = AfxSig_v_v_W, // void (CWnd*) (CWnd* comes from lParam)
267  AfxSig_bWCDS = AfxSig_b_W_COPYDATASTRUCT, // bool (CWnd*, COPYDATASTRUCT*)
268  AfxSig_bwsp = AfxSig_MOUSEWHEEL, // bool (unsigned int, short, CPoint)
269  AfxSig_vws = AfxSig_v_u_cs,
270 };
271 
272 
273 #define CN_COMMAND 0 // void ()
274 #define CN_UPDATE_COMMAND_UI ((unsigned int)(-1)) // void (CCmdUI*)
275 #define CN_EVENT ((unsigned int)(-2)) // OLE event
276 #define CN_OLECOMMAND ((unsigned int)(-3)) // OLE document command
277 #define CN_OLE_UNREGISTER ((unsigned int)(-4)) // OLE unregister
278 // > 0 are control notifications
279 // < 0 are for MFC's use
280 
281 /*
282  * PeekMessage() Options
283  */
284 #define PM_NOREMOVE 0x0000
285 #define PM_REMOVE 0x0001
286 #define PM_NOYIELD 0x0002
287 
288 typedef void (CCmdTarget::*AFX_PMSG)();
289 typedef void (CWnd::*AFX_PMSGW)();
290 
291 #pragma warning(disable: 4121)
293  unsigned int nMessage; // windows message
294  unsigned int nCode; // control code or WM_NOTIFY code
295  unsigned int nID; // control ID (or 0 for windows messages)
296  unsigned int nLastID; // used for entries specifying a range of control id's
297  int nSig; // signature type (action) or pointer to message #
298  AFX_PMSG pfn; // routine to call (or special value)
299 };
300 #pragma warning(default: 4121)
301 
302 struct AFX_MSGMAP {
303  const AFX_MSGMAP *(*pfnGetBaseMap)();
304  const AFX_MSGMAP_ENTRY *lpEntries;
305 };
306 
307 #define afx_msg
308 
309 #ifndef AFX_MSG_CALL
310  #define AFX_MSG_CALL
311 #endif
312 typedef void (AFX_MSG_CALL CCmdTarget:: *AFX_PMSG)();
313 
314 #define DECLARE_MESSAGE_MAP() \
315  protected: \
316  static const AFX_MSGMAP *GetThisMessageMap(); \
317  const AFX_MSGMAP *GetMessageMap() const override; \
318 
319 
327 #ifdef __GNUC__
328 #define BEGIN_SILENCE_CAST \
329  _Pragma("GCC diagnostic push") \
330  _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"")
331 #define END_SILENCE_CAST \
332  _Pragma("GCC diagnostic pop")
333 #else
334 #define BEGIN_SILENCE_CAST
335 #define END_SILENCE_CAST
336 #endif
337 
338 #define BEGIN_TEMPLATE_MESSAGE_MAP(theClass, type_name, baseClass) \
339  template < typename type_name > \
340  const AFX_MSGMAP *theClass< type_name >::GetMessageMap() const \
341  { return GetThisMessageMap(); } \
342  template < typename type_name > \
343  const AFX_MSGMAP *theClass< type_name >::GetThisMessageMap() { \
344  typedef theClass< type_name > ThisClass; \
345  typedef baseClass TheBaseClass; \
346  BEGIN_SILENCE_CAST \
347  static const AFX_MSGMAP_ENTRY _messageEntries[] = \
348  {
349 
350 #define BEGIN_MESSAGE_MAP(theClass, baseClass) \
351  const AFX_MSGMAP *theClass::GetMessageMap() const \
352  { return GetThisMessageMap(); } \
353  const AFX_MSGMAP *theClass::GetThisMessageMap() { \
354  typedef theClass ThisClass; \
355  typedef baseClass TheBaseClass; \
356  { ThisClass *dummy; (void)dummy; } \
357  BEGIN_SILENCE_CAST \
358  static const AFX_MSGMAP_ENTRY _messageEntries[] = \
359  {
360 
361 #define END_MESSAGE_MAP() \
362  { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)nullptr } \
363  }; \
364  END_SILENCE_CAST \
365  static const AFX_MSGMAP messageMap = \
366  { &TheBaseClass::GetThisMessageMap, &_messageEntries[0] }; \
367  return &messageMap; \
368  } \
369 
370 #define DECLARE_DYNCREATE(class_name) \
371  DECLARE_DYNAMIC(class_name) \
372  static CObject *CreateObject();
373 
374 
376  AFX_PMSG pfn; // generic member function pointer
377 
378  // specific type safe variants for WM_COMMAND and WM_NOTIFY messages
379  void (AFX_MSG_CALL CCmdTarget:: *pfn_COMMAND)();
380  bool(AFX_MSG_CALL CCmdTarget:: *pfn_bCOMMAND)();
381  void (AFX_MSG_CALL CCmdTarget:: *pfn_COMMAND_RANGE)(unsigned int);
382  bool(AFX_MSG_CALL CCmdTarget:: *pfn_COMMAND_EX)(unsigned int);
383 
384  void (AFX_MSG_CALL CCmdTarget:: *pfn_UPDATE_COMMAND_UI)(CCmdUI *);
385  void (AFX_MSG_CALL CCmdTarget:: *pfn_UPDATE_COMMAND_UI_RANGE)(CCmdUI *, unsigned int);
386  void (AFX_MSG_CALL CCmdTarget:: *pfn_OTHER)(void *);
387  bool(AFX_MSG_CALL CCmdTarget:: *pfn_OTHER_EX)(void *);
388 
389  void (AFX_MSG_CALL CCmdTarget:: *pfn_NOTIFY)(NMHDR *, LRESULT *);
390  bool(AFX_MSG_CALL CCmdTarget:: *pfn_bNOTIFY)(NMHDR *, LRESULT *);
391  void (AFX_MSG_CALL CCmdTarget:: *pfn_NOTIFY_RANGE)(unsigned int, NMHDR *, LRESULT *);
392  bool(AFX_MSG_CALL CCmdTarget:: *pfn_NOTIFY_EX)(unsigned int, NMHDR *, LRESULT *);
393 
394  // Type safe variant for thread messages
395 
396  void (AFX_MSG_CALL CWinThread:: *pfn_THREAD)(WPARAM, LPARAM);
397 
398  // Specific type safe variants for WM-style messages
399  bool(AFX_MSG_CALL CWnd:: *pfn_bD)(CDC *);
400  bool(AFX_MSG_CALL CWnd:: *pfn_bb)(bool);
401  bool(AFX_MSG_CALL CWnd:: *pfn_bWww)(CWnd *, unsigned int, unsigned int);
402  bool(AFX_MSG_CALL CWnd:: *pfn_bHELPINFO)(HELPINFO *);
403  bool(AFX_MSG_CALL CWnd:: *pfn_bWCDS)(CWnd *, COPYDATASTRUCT *);
404  HBRUSH(AFX_MSG_CALL CWnd:: *pfn_hDWw)(CDC *, CWnd *, unsigned int);
405  HBRUSH(AFX_MSG_CALL CWnd:: *pfn_hDw)(CDC *, unsigned int);
406  int (AFX_MSG_CALL CWnd:: *pfn_iwWw)(unsigned int, CWnd *, unsigned int);
407  int (AFX_MSG_CALL CWnd:: *pfn_iww)(unsigned int, unsigned int);
408  int (AFX_MSG_CALL CWnd:: *pfn_iWww)(CWnd *, unsigned int, unsigned int);
409  int (AFX_MSG_CALL CWnd:: *pfn_is)(uint16 *);
410  LRESULT(AFX_MSG_CALL CWnd:: *pfn_lwl)(WPARAM, LPARAM);
411  LRESULT(AFX_MSG_CALL CWnd:: *pfn_lwwM)(unsigned int, unsigned int, CMenu *);
412  void (AFX_MSG_CALL CWnd:: *pfn_vv)();
413 
414  void (AFX_MSG_CALL CWnd:: *pfn_vw)(unsigned int);
415  void (AFX_MSG_CALL CWnd:: *pfn_vww)(unsigned int, unsigned int);
416  void (AFX_MSG_CALL CWnd:: *pfn_vvii)(int, int);
417  void (AFX_MSG_CALL CWnd:: *pfn_vwww)(unsigned int, unsigned int, unsigned int);
418  void (AFX_MSG_CALL CWnd:: *pfn_vwii)(unsigned int, int, int);
419  void (AFX_MSG_CALL CWnd:: *pfn_vwl)(WPARAM, LPARAM);
420  void (AFX_MSG_CALL CWnd:: *pfn_vbWW)(bool, CWnd *, CWnd *);
421  void (AFX_MSG_CALL CWnd:: *pfn_vD)(CDC *);
422  void (AFX_MSG_CALL CWnd:: *pfn_vM)(CMenu *);
423  void (AFX_MSG_CALL CWnd:: *pfn_vMwb)(CMenu *, unsigned int, bool);
424 
425  void (AFX_MSG_CALL CWnd:: *pfn_vW)(CWnd *);
426  void (AFX_MSG_CALL CWnd:: *pfn_vWww)(CWnd *, unsigned int, unsigned int);
427  void (AFX_MSG_CALL CWnd:: *pfn_vWp)(CWnd *, CPoint);
428  void (AFX_MSG_CALL CWnd:: *pfn_vWh)(CWnd *, HANDLE);
429  void (AFX_MSG_CALL CWnd:: *pfn_vwW)(unsigned int, CWnd *);
430  void (AFX_MSG_CALL CWnd:: *pfn_vwWb)(unsigned int, CWnd *, bool);
431  void (AFX_MSG_CALL CWnd:: *pfn_vwwW)(unsigned int, unsigned int, CWnd *);
432  void (AFX_MSG_CALL CWnd:: *pfn_vwwx)(unsigned int, unsigned int);
433  void (AFX_MSG_CALL CWnd:: *pfn_vs)(uint16 *);
434  void (AFX_MSG_CALL CWnd:: *pfn_vOWNER)(int, uint16 *); // force return true
435  int (AFX_MSG_CALL CWnd:: *pfn_iis)(int, uint16 *);
436  unsigned int(AFX_MSG_CALL CWnd:: *pfn_wp)(CPoint);
437  unsigned int(AFX_MSG_CALL CWnd:: *pfn_wv)();
438  void (AFX_MSG_CALL CWnd:: *pfn_vPOS)(WINDOWPOS *);
439  void (AFX_MSG_CALL CWnd:: *pfn_vCALC)(bool, NCCALCSIZE_PARAMS *);
440  void (AFX_MSG_CALL CWnd:: *pfn_vwp)(unsigned int, CPoint);
441  void (AFX_MSG_CALL CWnd:: *pfn_vwwh)(unsigned int, unsigned int, HANDLE);
442  bool(AFX_MSG_CALL CWnd:: *pfn_bwsp)(unsigned int, short, CPoint);
443  void (AFX_MSG_CALL CWnd:: *pfn_vws)(unsigned int, const char *);
444  void (AFX_MSG_CALL CWnd:: *pfn_vFb)(HFONT, bool);
445 };
446 
447 /*============================================================================*/
448 
449 class CArchive {
450 public:
451  bool IsStoring() const {
452  return false;
453  }
454 };
455 
456 /*============================================================================*/
457 
458 // Creation information structure
459 // All fields are optional and may be nullptr
461  // for creating new views
462  const CRuntimeClass *m_pNewViewClass = nullptr; // runtime class of view to create or nullptr
463  CDocument *m_pCurrentDoc = nullptr;
464 
465  // for creating MDI children (CMDIChildWnd::LoadFrame)
466  CDocTemplate *m_pNewDocTemplate = nullptr;
467 
468  // for sharing view/frame state from the original view/frame
469  CView *m_pLastView = nullptr;
470  CFrameWnd *m_pCurrentFrame = nullptr;
471 };
472 
473 /*============================================================================*/
474 // Implementation of command routing
475 
477  void (CCmdTarget::*pmf)();
478  CCmdTarget *pTarget;
479 };
480 
481 /*============================================================================*/
482 // WM_NOTIFY support
483 
484 struct AFX_NOTIFY {
485  LRESULT *pResult;
486  NMHDR *pNMHDR;
487 };
488 
489 /*============================================================================*/
490 
491 class CGdiObject : public CObject {
492  DECLARE_DYNCREATE(CGdiObject)
493 
494 private:
495  bool _permanent = false;
496 
497 protected:
498  void AfxHookObject();
499  void AfxUnhookObject();
500 
501 public:
502  HGDIOBJ m_hObject = nullptr;
503 
504  operator HGDIOBJ() const {
505  return m_hObject;
506  }
507 
508 public:
509  static CGdiObject *FromHandle(HGDIOBJ h);
510 
511 public:
512  ~CGdiObject() override;
513 
514  bool Attach(HGDIOBJ hObject);
515  HGDIOBJ Detach();
516  bool DeleteObject();
517 
518  bool operator==(const CGdiObject &obj) const {
519  return obj.m_hObject == m_hObject;
520  }
521  bool operator!=(const CGdiObject &obj) const {
522  return obj.m_hObject != m_hObject;
523  }
524 };
525 
526 class CPen : public CGdiObject {
527 public:
528  class Impl : public CGdiObjectImpl {
529  public:
530  int _penStyle;
531  int _width;
532  COLORREF _color;
533 
534  public:
535  Impl(int nPenStyle, int nWidth, COLORREF crColor) :
536  _penStyle(nPenStyle), _width(nWidth),
537  _color(crColor) {
538  }
539  };
540 
541  Impl *pen() const {
542  return (Impl *)m_hObject;
543  }
544 
545 public:
546  CPen() {}
547  CPen(int nPenStyle, int nWidth, COLORREF crColor);
548  ~CPen() override {}
549 
550  bool CreatePen(int nPenStyle, int nWidth, COLORREF crColor);
551 };
552 
553 class CBrush : public CGdiObject {
554 public:
555  struct Impl : public CGdiObjectImpl {
556  int _type;
557  COLORREF _color = 0;
558 
559  Impl();
560  Impl(COLORREF crColor);
561  Impl(int nIndex, COLORREF crColor);
562  Impl(CBitmap *pBitmap);
563  ~Impl() override {}
564 
565  byte getColor() const;
566  };
567 
568  Impl *brush() const {
569  return (Impl *)m_hObject;
570  }
571 
572 public:
573  static CBrush *FromHandle(HGDIOBJ h) {
574  return (CBrush *)CGdiObject::FromHandle(h);
575  }
576 
577 public:
578  CBrush();
579  CBrush(CBitmap *pBitmap);
580  CBrush(COLORREF crColor);
581  CBrush(int nIndex, COLORREF crColor);
582  ~CBrush() override {
583  }
584 
585  bool CreateSolidBrush(COLORREF crColor);
586  bool CreateBrushIndirect(const LOGBRUSH *lpLogBrush);
587  bool CreateStockObject(int nIndex);
588 };
589 
590 class CFont : public CGdiObject {
591 public:
592  struct Impl : public CGdiObjectImpl {
593  public:
594  Gfx::Font *_font;
595  public:
596  Impl(Gfx::Font *font) : _font(font) {}
597  ~Impl() override {}
598  operator Gfx::Font *() const {
599  return _font;
600  }
601  };
602 
603  Impl *font() const {
604  return (Impl *)m_hObject;
605  }
606 
607 public:
608  static CFont *FromHandle(HGDIOBJ h) {
609  return (CFont *)CGdiObject::FromHandle(h);
610  }
611 
612 public:
613  ~CFont() override {}
614 
615  bool CreateFont(int nHeight, int nWidth, int nEscapement,
616  int nOrientation, int nWeight, byte bItalic, byte bUnderline,
617  byte cStrikeOut, byte nCharSet, byte nOutPrecision,
618  byte nClipPrecision, byte nQuality, byte nPitchAndFamily,
619  const char *lpszFacename);
620  bool CreateFontIndirect(const LOGFONT *lpLogFont);
621 };
622 
623 class CBitmap : public CGdiObject {
624 public:
625  struct Impl : public CGdiObjectImpl,
626  public Gfx::Surface {
627  ~Impl() override {}
628  };
629 
630  Impl *bitmap() const {
631  return (Impl *)m_hObject;
632  }
633 
634 public:
635  static CBitmap *FromHandle(HGDIOBJ h) {
636  return (CBitmap *)CGdiObject::FromHandle(h);
637  }
638 
639 public:
640  ~CBitmap() override {
641  }
642 
643  bool Attach(HBITMAP hObject);
644  HBITMAP Detach();
645  bool CreateCompatibleBitmap(CDC *pDC, int nWidth, int nHeight);
646  bool CreateBitmap(int nWidth, int nHeight, unsigned int nPlanes,
647  unsigned int nBitcount, const void *lpBits);
648  int GetObject(int nCount, void *lpObject) const;
649  long GetBitmapBits(long dwCount, void *lpBits) const;
650  bool GetBitmap(BITMAP *pBitMap) const {
651  return GetObject(sizeof(BITMAP), pBitMap);
652  }
653 };
654 
655 class CPalette : public CGdiObject {
656 public:
657  struct Impl : public CGdiObjectImpl,
658  public Graphics::Palette {
659  Impl(const LPLOGPALETTE pal);
660  ~Impl() override {}
661  };
662 
663  Impl *palette() const {
664  return (Impl *)m_hObject;
665  }
666 
667 public:
668  static CPalette *FromHandle(HGDIOBJ h) {
669  return (CPalette *)CGdiObject::FromHandle(h);
670  }
671 
672 public:
673  ~CPalette() override {
674  }
675 
676  bool CreatePalette(LPLOGPALETTE lpLogPalette);
677  int GetObject(int nCount, void *lpObject) const;
678  unsigned int GetEntryCount() const;
679  unsigned int GetPaletteEntries(unsigned int nStartIndex, unsigned int nNumEntries,
680  LPPALETTEENTRY lpPaletteColors) const;
681  unsigned int SetPaletteEntries(unsigned int nStartIndex, unsigned int nNumEntries,
682  LPPALETTEENTRY lpPaletteColors);
683  unsigned int SetPaletteEntries(const Graphics::Palette &pal);
684  bool AnimatePalette(unsigned int nStartIndex, unsigned int nNumEntries,
685  const PALETTEENTRY *lpPaletteColors);
686  unsigned int GetNearestPaletteIndex(COLORREF crColor);
687  bool isEmpty() const {
688  return !palette() || palette()->empty();
689  }
690 };
691 
692 class CRgn : public CGdiObject {
693 public:
694  Common::Array<POINT> _points;
695  Common::Rect _rect;
696  int _polyFillMode = 0;
697 
698 public:
699  ~CRgn() override {
700  }
701 
702  bool CreateRectRgn(int x1, int y1, int x2, int y2);
703  bool CreateRectRgnIndirect(LPCRECT lpRect);
704  bool CreatePolygonRgn(const POINT *lpPoints,
705  int nCount, int nPolyFillMode);
706 };
707 
708 class CDC : public CObject {
709  DECLARE_DYNCREATE(CDC)
710  friend class CWnd;
711 
712 private:
713  bool _permanent = false;
714  int _stretchMode = STRETCH_ANDSCANS;
715 
716 protected:
717  void AfxHookObject();
718  void AfxUnhookObject();
719 
720 public:
721  class DefaultBitmap : public CBitmap {
722  public:
723  ~DefaultBitmap() override {
724  };
725  };
726 
727  class Impl : public Gfx::TextRender {
728  private:
729  CWnd *m_pWnd = nullptr;
730  DefaultBitmap _defaultBitmap;
731  Common::Point _linePos;
732  COLORREF _bkColor = RGB(255, 255, 255);
733  int _bkMode = TRANSPARENT;
734  COLORREF _textColor = 0;
735  uint _textAlign = TA_LEFT;
736  int _drawMode;
737 
738  uint getPenColor() const;
739  uint getBrushColor() const;
740 
741  public:
742  HBITMAP _bitmap;
743  HPEN _pen;
744  HFONT _font;
745  HBRUSH _brush;
746  HPALETTE _palette = nullptr;
747  CPalette *_cPalette = nullptr;
748  bool m_bForceBackground = false;
749 
750  public:
751  Impl(CWnd *wndOwner = nullptr);
752  Impl(HDC srcDc);
753 
754  HGDIOBJ Attach(HGDIOBJ gdiObj);
755  Gfx::Surface *getSurface() const;
756  const Graphics::PixelFormat &getFormat() const;
757  void setFormat(const Graphics::PixelFormat &format);
758  void setScreenRect();
759  void setScreenRect(const Common::Rect &r);
760 
761  HPALETTE selectPalette(HPALETTE pal, bool bForceBackground);
762  CPalette *selectPalette(CPalette *pal, bool bForceBackground);
763  unsigned int realizePalette();
764  COLORREF GetNearestColor(COLORREF crColor) const;
765 
766  void fillSolidRect(LPCRECT lpRect, COLORREF clr);
767  void fillSolidRect(int x, int y, int cx, int cy, COLORREF clr);
768  void fillRect(const Common::Rect &r, COLORREF crColor);
769  void drawRect(const Common::Rect &r, CBrush *brush);
770  void frameRect(const Common::Rect &r, CBrush *brush);
771  void frameRgn(const CRgn *pRgn, CBrush *brush, int nWidth, int nHeight);
772  void floodFill(int x, int y, COLORREF crColor);
773  void floodFill(int x, int y, COLORREF crColor,
774  unsigned int nFillType);
775  void rectangle(LPCRECT lpRect);
776  void rectangle(int x1, int y1, int x2, int y2);
777  void draw3dRect(const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
778  void drawFocusRect(const CRect &rect);
779 
780  void ellipse(const Common::Rect &r, COLORREF crColor);
781  void ellipse(LPCRECT lpRect);
782  void ellipse(int x1, int y1, int x2, int y2);
783 
784  void bitBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC,
785  int xSrc, int ySrc, uint32 dwRop);
786  void stretchBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC,
787  int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, uint32 dwRop);
788 
789  void moveTo(int x, int y);
790  void lineTo(int x, int y);
791  COLORREF getPixel(int x, int y) const;
792  int setROP2(int nDrawMode);
793 
794  // Text functions
795  COLORREF setBkColor(COLORREF crColor);
796  COLORREF getBkColor() const;
797  COLORREF getBkPixel() const;
798  int setBkMode(int nBkMode);
799  COLORREF setTextColor(COLORREF crColor);
800  bool textOut(int x, int y, const char *lpszString, int nCount,
801  int nTabPositions = 0, const int *lpnTabStopPositions = nullptr,
802  int nTabOrigin = 0, CSize *size = nullptr);
803  bool textOut(int x, int y, const CString &str,
804  int nTabPositions = 0, const int *lpnTabStopPositions = nullptr,
805  int nTabOrigin = 0, CSize *size = nullptr);
806  bool extTextOut(int x, int y, unsigned int nOptions, LPCRECT lpRect,
807  const char *lpszString, unsigned int nCount, int *lpDxWidths);
808  bool extTextOut(int x, int y, unsigned int nOptions, LPCRECT lpRect,
809  const CString &str, int *lpDxWidths);
810  CSize tabbedTextOut(int x, int y, const char *lpszString, int nCount,
811  int nTabPositions, const int *lpnTabStopPositions, int nTabOrigin);
812  CSize tabbedTextOut(int x, int y, const CString &str,
813  int nTabPositions, const int *lpnTabStopPositions, int nTabOrigin);
814 
815  int drawText(const char *lpszString, int nCount, LPRECT lpRect, unsigned int nFormat,
816  int nTabPositions = 0, const int *lpnTabStopPositions = nullptr,
817  int nTabOrigin = 0, CSize *size = nullptr);
818  int drawText(const CString &str, LPRECT lpRect, unsigned int nFormat,
819  int nTabPositions = 0, const int *lpnTabStopPositions = nullptr,
820  int nTabOrigin = 0, CSize *size = nullptr);
821 
822  CSize getTextExtent(const char *lpszString, int nCount) const;
823  CSize getTextExtent(const CString &str) const;
824  CSize getOutputTextExtent(const char *lpszString, int nCount) const;
825  CSize getOutputTextExtent(const CString &str) const;
826  CSize getTabbedTextExtent(const char *lpszString, int nCount,
827  int nTabPositions, int *lpnTabStopPositions) const;
828  CSize getTabbedTextExtent(const CString &str,
829  int nTabPositions, int *lpnTabStopPositions) const;
830  CSize getOutputTabbedTextExtent(const char *lpszString, int nCount,
831  int nTabPositions, int *lpnTabStopPositions) const;
832  CSize getOutputTabbedTextExtent(const CString &str,
833  int nTabPositions, int *lpnTabStopPositions) const;
834  bool grayString(CBrush *pBrush,
835  bool(CALLBACK *lpfnOutput)(HDC, LPARAM, int), LPARAM lpData,
836  int nCount, int x, int y, int nWidth, int nHeight);
837  unsigned int getTextAlign() const;
838  unsigned int setTextAlign(unsigned int nFlags);
839  bool getTextMetrics(LPTEXTMETRIC lpMetrics) const;
840  };
841 
842 public:
843  HDC m_hDC = nullptr;
844 
845  static CDC *FromHandle(HDC hDC);
846 
847 public:
848  ~CDC() override;
849 
850  operator HDC() const {
851  return m_hDC;
852  }
853  Impl *impl() const {
854  return static_cast<Impl *>(m_hDC);
855  }
856 
857  bool CreateDC(const char *lpszDriverName, const char *lpszDeviceName,
858  const char *lpszOutput, const void *lpInitData);
859  bool CreateCompatibleDC(CDC *pDC);
860  bool DeleteDC();
861  bool Attach(HDC hDC);
862  HDC Detach();
863  int SetStretchBltMode(int nStretchMode);
864  int GetDeviceCaps(int nIndex) const;
865 
866  // Mapping Functions
867  int GetMapMode() const;
868  CPoint GetViewportOrg() const;
869  virtual int SetMapMode(int nMapMode);
870  // Viewport Origin
871  virtual CPoint SetViewportOrg(int x, int y);
872  CPoint SetViewportOrg(POINT point);
873  virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
874 
875  // Clipping Functions
876  virtual int GetClipBox(LPRECT lpRect) const;
877  void setClipRect(const Common::Rect &r);
878  void resetClipRect();
879  virtual bool PtVisible(int x, int y);
880  bool PtVisible(POINT point);
881  virtual bool RectVisible(LPCRECT lpRect);
882  int SelectClipRgn(CRgn *pRgn);
883  int ExcludeClipRect(int x1, int y1, int x2, int y2);
884  int ExcludeClipRect(LPCRECT lpRect);
885  int ExcludeUpdateRgn(CWnd *pWnd);
886  int IntersectClipRect(int x1, int y1, int x2, int y2);
887  int IntersectClipRect(LPCRECT lpRect);
888  int OffsetClipRgn(int x, int y);
889  int OffsetClipRgn(SIZE size);
890  int SelectClipRgn(CRgn *pRgn, int nMode);
891 
892  int SetROP2(int nDrawMode);
893  bool DPtoLP(LPPOINT lpPoints, int nCount = 1);
894  bool DPtoLP(RECT *lpRect);
895  bool LPtoDP(LPPOINT lpPoints, int nCount = 1);
896  bool LPtoDP(RECT *lpRect);
897  bool BitBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC,
898  int xSrc, int ySrc, uint32 dwRop);
899  bool StretchBlt(int x, int y, int nWidth, int nHeight, CDC *pSrcDC,
900  int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, uint32 dwRop);
901  void Ellipse(LPCRECT lpRect);
902  void Ellipse(int x1, int y1, int x2, int y2);
903  void FrameRect(LPCRECT lpRect, CBrush *pBrush);
904  void Draw3dRect(const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
905  void DrawFocusRect(const CRect &rect);
906  void FillRect(LPCRECT lpRect, CBrush *pBrush);
907  void FillSolidRect(LPCRECT lpRect, COLORREF crColor);
908  bool FloodFill(int x, int y, COLORREF crColor);
909  bool FloodFill(int x, int y, COLORREF crColor,
910  unsigned int nFillType);
911  void Rectangle(LPCRECT lpRect);
912  void Rectangle(int x1, int y1, int x2, int y2);
913  bool DrawEdge(LPRECT lpRect, unsigned int nEdge, unsigned int nFlags);
914 
915  bool Pie(
916  int x1, int y1, // Upper-left corner of bounding rectangle
917  int x2, int y2, // Lower-right corner of bounding rectangle
918  int x3, int y3, // Starting point of the arc (on the ellipse)
919  int x4, int y4 // Ending point of the arc (on the ellipse)
920  );
921  bool Pie(
922  LPCRECT lpRect, // Pointer to bounding rectangle
923  const POINT &ptStart, // Start point of arc
924  const POINT &ptEnd // End point of arc
925  );
926  bool FrameRgn(CRgn *pRgn, CBrush *pBrush,
927  int nWidth, int nHeight);
928 
929  void MoveTo(int x, int y);
930  void LineTo(int x, int y);
931  COLORREF GetPixel(int x, int y) const;
932  COLORREF GetPixel(const POINT &point) const;
933 
934  virtual CGdiObject *SelectStockObject(int nIndex);
935  CPen *SelectObject(CPen *pPen);
936  CBrush *SelectObject(CBrush *pBrush);
937  virtual CFont *SelectObject(CFont *pFont);
938  CBitmap *SelectObject(CBitmap *pBitmap);
939  int SelectObject(CRgn *pRgn); // special return for regions
940  CGdiObject *SelectObject(CGdiObject *pObject);
941  HGDIOBJ SelectObject(HGDIOBJ hGdiObj);
942 
943  COLORREF GetNearestColor(COLORREF crColor) const;
944  CPalette *SelectPalette(CPalette *pPalette, bool bForceBackground);
945  unsigned int RealizePalette();
946  void UpdateColors();
947  virtual COLORREF SetBkColor(COLORREF crColor);
948  COLORREF GetBkColor() const;
949  int SetBkMode(int nBkMode);
950 
951  // Text Functions
952  virtual COLORREF SetTextColor(COLORREF crColor);
953  virtual bool TextOut(int x, int y, const char *lpszString, int nCount);
954  bool TextOut(int x, int y, const CString &str);
955  virtual bool ExtTextOut(int x, int y, unsigned int nOptions, LPCRECT lpRect,
956  const char *lpszString, unsigned int nCount, int *lpDxWidths);
957  bool ExtTextOut(int x, int y, unsigned int nOptions, LPCRECT lpRect,
958  const CString &str, int *lpDxWidths);
959  virtual CSize TabbedTextOut(int x, int y, const char *lpszString, int nCount,
960  int nTabPositions, int *lpnTabStopPositions, int nTabOrigin);
961  CSize TabbedTextOut(int x, int y, const CString &str,
962  int nTabPositions, int *lpnTabStopPositions, int nTabOrigin);
963  int DrawText(const char *lpszString, int nCount,
964  LPRECT lpRect, unsigned int nFormat);
965  int DrawText(const CString &str, LPRECT lpRect, unsigned int nFormat);
966 
967 
968  CSize GetTextExtent(const char *lpszString, int nCount) const;
969  CSize GetTextExtent(const CString &str) const;
970  CSize GetOutputTextExtent(const char *lpszString, int nCount) const;
971  CSize GetOutputTextExtent(const CString &str) const;
972  CSize GetTabbedTextExtent(const char *lpszString, int nCount,
973  int nTabPositions, int *lpnTabStopPositions) const;
974  CSize GetTabbedTextExtent(const CString &str,
975  int nTabPositions, int *lpnTabStopPositions) const;
976  CSize GetOutputTabbedTextExtent(const char *lpszString, int nCount,
977  int nTabPositions, int *lpnTabStopPositions) const;
978  CSize GetOutputTabbedTextExtent(const CString &str,
979  int nTabPositions, int *lpnTabStopPositions) const;
980  virtual bool GrayString(CBrush *pBrush,
981  bool(CALLBACK *lpfnOutput)(HDC, LPARAM, int), LPARAM lpData,
982  int nCount, int x, int y, int nWidth, int nHeight);
983  unsigned int GetTextAlign() const;
984  unsigned int SetTextAlign(unsigned int nFlags);
985  bool GetTextMetrics(LPTEXTMETRIC lpMetrics) const;
986 };
987 
988 /*============================================================================*/
989 // CDC Helpers
990 
991 class CPaintDC : public CDC {
992  DECLARE_DYNAMIC(CPaintDC)
993 
994 protected:
995  PAINTSTRUCT m_ps;
996  HWND m_hWnd = nullptr;
997 
998 public:
999  explicit CPaintDC(CWnd *pWnd);
1000  ~CPaintDC() override;
1001 };
1002 
1003 class CCmdTarget : public CObject {
1004  DECLARE_DYNAMIC(CCmdTarget)
1005 
1006 protected:
1007  const AFX_MSGMAP_ENTRY *LookupMessage(unsigned int message);
1008  const AFX_MSGMAP_ENTRY *AfxFindMessageEntry(
1009  const AFX_MSGMAP_ENTRY *lpEntry,
1010  unsigned int nMsg, unsigned int nCode, unsigned int nID);
1011  bool _AfxDispatchCmdMsg(CCmdTarget *pTarget,
1012  unsigned int nID, int nCode, AFX_PMSG pfn, void *pExtra,
1013  unsigned int nSig, AFX_CMDHANDLERINFO *pHandlerInfo);
1014 
1015 public:
1016  ~CCmdTarget() override {
1017  }
1018 
1019  static const AFX_MSGMAP *GetThisMessageMap();
1020  virtual const AFX_MSGMAP *GetMessageMap() const {
1021  return GetThisMessageMap();
1022  }
1023 
1028  virtual void DoWaitCursor(int nCode);
1029  void BeginWaitCursor();
1030  void EndWaitCursor();
1031  void RestoreWaitCursor();
1032 
1033  bool OnCmdMsg(unsigned int nID, int nCode, void *pExtra,
1034  AFX_CMDHANDLERINFO *pHandlerInfo);
1035 };
1036 
1037 class CCmdUI {
1038 public:
1039  bool m_bContinueRouting = false;
1040  int m_nID = 0;
1041 };
1042 
1044 
1045 class CDocument : public CCmdTarget {
1046  DECLARE_DYNAMIC(CDocument)
1047 private:
1048  CString _title;
1049  CString _unusedPathName;
1050  bool m_bModified = false;
1051  ViewArray m_viewList;
1052 
1053 public:
1054  bool m_bAutoDelete = true; // default to auto delete document
1055  bool m_bEmbedded = false; // default to file-based document
1056  CDocTemplate *m_pDocTemplate = nullptr;
1057 
1058 public:
1059  ~CDocument() override {}
1060 
1061  void UpdateAllViews(CView *pSender, LPARAM lHint = 0,
1062  CObject *pHint = nullptr);
1063  POSITION GetFirstViewPosition();
1064  CView *GetNextView(POSITION &rPosition) const;
1065 
1066  const CString &GetTitle() const;
1067  virtual void SetTitle(const char *lpszTitle);
1068  const CString &GetPathName() const;
1069  virtual void SetPathName(const char *lpszPathName, bool bAddToMRU = true);
1070  virtual void ClearPathName();
1071 
1072  virtual bool IsModified();
1073  virtual void SetModifiedFlag(bool bModified = true);
1074  virtual void ReportSaveLoadException(const char *lpszPathName,
1075  CException *e, bool bSaving, unsigned int nIDPDefault);
1076  bool SaveModified();
1077 
1078  void AddView(CView *pView);
1079  void RemoveView(CView *pView);
1080 
1081  // Delete doc items etc
1082  virtual void DeleteContents();
1083 
1084  virtual bool OnNewDocument() {
1085  return true;
1086  }
1087  virtual bool OnOpenDocument(const char *lpszPathName) {
1088  return true;
1089  }
1090  virtual void OnFileSaveAs() {}
1091  virtual void OnCloseDocument();
1092  virtual void OnChangedViewList();
1093  virtual void PreCloseFrame(CFrameWnd *pFrame) {}
1094  virtual void UpdateFrameCounts() {}
1095 
1096  DECLARE_MESSAGE_MAP()
1097 };
1098 
1099 
1100 typedef struct tagCREATESTRUCTA {
1101  void * lpCreateParams = nullptr;
1102  HINSTANCE hInstance = 0;
1103  HMENU hMenu = 0;
1104  HWND hwndParent = 0;
1105  int cy = 0;
1106  int cx = 0;
1107  int y = 0;
1108  int x = 0;
1109  long style = 0;
1110  const char * lpszName = nullptr;
1111  const char * lpszClass = nullptr;
1112  uint32 dwExStyle = 0;
1114 
1115 
1116 // CWnd::m_nFlags (generic to CWnd)
1117 #define WF_TOOLTIPS 0x0001 // window is enabled for tooltips
1118 #define WF_TEMPHIDE 0x0002 // window is temporarily hidden
1119 #define WF_STAYDISABLED 0x0004 // window should stay disabled
1120 #define WF_MODALLOOP 0x0008 // currently in modal loop
1121 #define WF_CONTINUEMODAL 0x0010 // modal loop should continue running
1122 #define WF_OLECTLCONTAINER 0x0100 // some descendant is an OLE control
1123 #define WF_TRACKINGTOOLTIPS 0x0400 // window is enabled for tracking tooltips
1124 
1125 class CWnd : public CCmdTarget {
1126  DECLARE_DYNCREATE(CWnd)
1127 
1128 protected:
1129  static const MSG *GetCurrentMessage();
1130 
1131  virtual void DoDataExchange(CDataExchange *dataExch) {}
1132  virtual bool PreCreateWindow(CREATESTRUCT &cs) {
1133  return true;
1134  }
1135  void createDialogIndirect(LPCDLGTEMPLATE dlgTemplate);
1136 
1137  DECLARE_MESSAGE_MAP()
1138 
1139 protected:
1140  Libs::Array<CWnd *> _ownedControls;
1141  CDC *_pDC = nullptr;
1142  HFONT _hFont;
1143  HBRUSH _hBrush;
1144  HPEN _hPen;
1145  HPALETTE _hPalette;
1146 
1147 protected:
1148  virtual bool OnCommand(WPARAM wParam, LPARAM lParam);
1149  virtual bool OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) {
1150  return false;
1151  }
1152  virtual void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized);
1153 
1154  virtual LRESULT DefWindowProc(unsigned int nMsg, WPARAM wParam, LPARAM lParam) {
1155  return 0;
1156  }
1157  virtual void OnSetFont(CFont *pFont) {
1158  }
1159 
1160  bool OnWndMsg(unsigned int message, WPARAM wParam, LPARAM lParam, LRESULT *pResult);
1161 
1162  afx_msg void OnActivateApp(bool bActive, uint32 dwThreadID) {}
1163  afx_msg LRESULT OnActivateTopLevel(WPARAM, LPARAM) {
1164  return 0;
1165  }
1166  afx_msg void OnCancelMode() {}
1167  afx_msg void OnChildActivate() {}
1168  afx_msg void OnClose();
1169  afx_msg void OnContextMenu(CWnd *pWnd, CPoint pos) {}
1170  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct) {
1171  return 0;
1172  }
1173 
1174  afx_msg HBRUSH OnCtlColor(CDC *pDC, CWnd *pWnd, unsigned int nCtlColor) {
1175  return 0;
1176  }
1177 
1178  afx_msg void OnDestroy() {}
1179  afx_msg void OnEnable(bool bEnable) {}
1180  afx_msg void OnEndSession(bool bEnding) {}
1181  afx_msg void OnEnterIdle(unsigned int nWhy, CWnd *pWho) {}
1182  afx_msg bool OnEraseBkgnd(CDC *pDC) {
1183  return false;
1184  }
1185  afx_msg void OnIconEraseBkgnd(CDC *pDC) {}
1186  afx_msg void OnKillFocus(CWnd *pNewWnd) {}
1187  afx_msg void OnMenuSelect(unsigned int nItemID, unsigned int nFlags, HMENU hSysMenu) {}
1188  afx_msg void OnMove(int x, int y) {}
1189  afx_msg void OnPaint() {}
1190  afx_msg void OnSyncPaint() {}
1191  afx_msg void OnParentNotify(unsigned int message, LPARAM lParam) {}
1192  afx_msg unsigned int OnNotifyFormat(CWnd *pWnd, unsigned int nCommand) {
1193  return 0;
1194  }
1195  afx_msg HCURSOR OnQueryDragIcon() {
1196  return 0;
1197  }
1198  afx_msg bool OnQueryEndSession() {
1199  return false;
1200  }
1201  afx_msg bool OnQueryNewPalette() {
1202  return false;
1203  }
1204  afx_msg bool OnQueryOpen() {
1205  return false;
1206  }
1207  afx_msg void OnSetFocus(CWnd *pOldWnd) {}
1208  afx_msg void OnShowWindow(bool bShow, unsigned int nStatus);
1209  afx_msg void OnSize(unsigned int nType, int cx, int cy) {}
1210  afx_msg void OnTCard(unsigned int idAction, uint32 dwActionData) {}
1211  afx_msg void OnSessionChange(unsigned int nSessionState, unsigned int nId) {}
1212 
1213  afx_msg void OnChangeUIState(unsigned int nAction, unsigned int nUIElement) {}
1214  afx_msg void OnUpdateUIState(unsigned int nAction, unsigned int nUIElement) {}
1215  afx_msg unsigned int OnQueryUIState() {
1216  return 0;
1217  }
1218 
1219  // Nonclient-Area message handler member functions
1220  afx_msg bool OnNcActivate(bool bActive) {
1221  return false;
1222  }
1223  afx_msg bool OnNcCreate(LPCREATESTRUCT lpCreateStruct) {
1224  return false;
1225  }
1226  afx_msg void OnNcDestroy();
1227  virtual afx_msg void PostNcDestroy() {}
1228  afx_msg LRESULT OnNcHitTest(CPoint point) {
1229  return 0;
1230  }
1231  afx_msg void OnNcLButtonDblClk(unsigned int nHitTest, CPoint point) {}
1232  afx_msg void OnNcLButtonDown(unsigned int nHitTest, CPoint point) {}
1233  afx_msg void OnNcLButtonUp(unsigned int nHitTest, CPoint point) {}
1234  afx_msg void OnNcMButtonDblClk(unsigned int nHitTest, CPoint point) {}
1235  afx_msg void OnNcMButtonDown(unsigned int nHitTest, CPoint point) {}
1236  afx_msg void OnNcMButtonUp(unsigned int nHitTest, CPoint point) {}
1237  afx_msg void OnNcMouseHover(unsigned int nHitTest, CPoint point) {}
1238  afx_msg void OnNcMouseLeave() {}
1239  afx_msg void OnNcMouseMove(unsigned int nHitTest, CPoint point) {}
1240  afx_msg void OnNcPaint() {}
1241  afx_msg void OnNcRButtonDblClk(unsigned int nHitTest, CPoint point) {}
1242  afx_msg void OnNcRButtonDown(unsigned int nHitTest, CPoint point) {}
1243  afx_msg void OnNcRButtonUp(unsigned int nHitTest, CPoint point) {}
1244  afx_msg void OnNcXButtonDown(short zHitTest, unsigned int nButton, CPoint point) {}
1245  afx_msg void OnNcXButtonUp(short zHitTest, unsigned int nButton, CPoint point) {}
1246  afx_msg void OnNcXButtonDblClk(short zHitTest, unsigned int nButton, CPoint point) {}
1247 
1248  // System message handler member functions
1249  afx_msg void OnDropFiles(HDROP hDropInfo) {}
1250  afx_msg void OnPaletteIsChanging(CWnd *pRealizeWnd) {}
1251  afx_msg void OnSysChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1252  afx_msg void OnSysCommand(unsigned int nID, LPARAM lParam) {}
1253  afx_msg void OnSysDeadChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1254  afx_msg void OnSysKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1255  afx_msg void OnSysKeyUp(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1256  afx_msg bool OnAppCommand(CWnd *pWnd, unsigned int nCmd, unsigned int nDevice, unsigned int nKey) {
1257  return false;
1258  }
1259  afx_msg void OnRawInput(unsigned int nInputCode, HRAWINPUT hRawInput) {}
1260  afx_msg void OnCompacting(unsigned int nCpuTime) {}
1261  afx_msg void OnDevModeChange(_In_z_ uint16 * lpDeviceName) {}
1262  afx_msg void OnFontChange() {}
1263  afx_msg void OnPaletteChanged(CWnd *pFocusWnd) {}
1264  afx_msg void OnSpoolerStatus(unsigned int nStatus, unsigned int nJobs) {}
1265  afx_msg void OnSysColorChange() {}
1266  afx_msg void OnTimeChange() {}
1267  afx_msg void OnSettingChange(unsigned int uFlags, const char *lpszSection) {}
1268  afx_msg void OnWinIniChange(const char *lpszSection) {}
1269  afx_msg unsigned int OnPowerBroadcast(unsigned int nPowerEvent, LPARAM lEventData) {
1270  return 0;
1271  }
1272  afx_msg void OnUserChanged() {}
1273  afx_msg void OnInputLangChange(unsigned int nCharSet, unsigned int nLocaleId) {}
1274  afx_msg void OnInputLangChangeRequest(unsigned int nFlags, unsigned int nLocaleId) {}
1275  afx_msg void OnInputDeviceChange(unsigned short nFlags, HANDLE hDevice) {}
1276 
1277  // Input message handler member functions
1278  afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1279  afx_msg void OnDeadChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1280  afx_msg void OnUniChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1281  afx_msg void OnHScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar *pScrollBar) {}
1282  afx_msg void OnVScroll(unsigned int nSBCode, unsigned int nPos, CScrollBar *pScrollBar) {}
1283  afx_msg void OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1284  afx_msg void OnKeyUp(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags) {}
1285  afx_msg void OnHotKey(unsigned int nHotKeyId, unsigned int nKey1, unsigned int nKey2) {}
1286  afx_msg void OnLButtonDblClk(unsigned int nFlags, CPoint point) {}
1287  afx_msg void OnLButtonDown(unsigned int nFlags, CPoint point) {}
1288  afx_msg void OnLButtonUp(unsigned int nFlags, CPoint point) {}
1289  afx_msg void OnMButtonDblClk(unsigned int nFlags, CPoint point) {}
1290  afx_msg void OnMButtonDown(unsigned int nFlags, CPoint point) {}
1291  afx_msg void OnMButtonUp(unsigned int nFlags, CPoint point) {}
1292  afx_msg void OnXButtonDblClk(unsigned int nFlags, unsigned int nButton, CPoint point) {}
1293  afx_msg void OnXButtonDown(unsigned int nFlags, unsigned int nButton, CPoint point) {}
1294  afx_msg void OnXButtonUp(unsigned int nFlags, unsigned int nButton, CPoint point) {}
1295  afx_msg int OnMouseActivate(CWnd *pDesktopWnd, unsigned int nHitTest, unsigned int message) {
1296  return 0;
1297  }
1298  afx_msg void OnMouseHover(unsigned int nFlags, CPoint point) {}
1299  afx_msg void OnMouseLeave() {}
1300  afx_msg void OnMouseMove(unsigned int nFlags, CPoint point) {}
1301  afx_msg void OnMouseHWheel(unsigned int nFlags, short zDelta, CPoint pt) {}
1302  afx_msg bool OnMouseWheel(unsigned int nFlags, short zDelta, CPoint pt) {
1303  return false;
1304  }
1305  afx_msg void OnRButtonDblClk(unsigned int nFlags, CPoint point) {}
1306  afx_msg void OnRButtonDown(unsigned int nFlags, CPoint point) {}
1307  afx_msg void OnRButtonUp(unsigned int nFlags, CPoint point) {}
1308  afx_msg bool OnSetCursor(CWnd *pWnd, unsigned int nHitTest, unsigned int message);
1309  afx_msg void OnTimer(uintptr nIDEvent) {}
1310 
1311  // Control message handler member functions
1312  afx_msg void OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct);
1313  afx_msg unsigned int OnGetDlgCode() {
1314  return 0;
1315  }
1316  afx_msg void OnMeasureItem(int nIDCtl, LPMEASUREITEMSTRUCT lpMeasureItemStruct) {}
1317  afx_msg int OnCharToItem(unsigned int nChar, CListBox *pListBox, unsigned int nIndex) {
1318  return 0;
1319  }
1320  afx_msg int OnVKeyToItem(unsigned int nKey, CListBox *pListBox, unsigned int nIndex) {
1321  return 0;
1322  }
1323  afx_msg void OnSetFont(HFONT hFont, bool bRedraw);
1324 
1325  virtual void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) {}
1326 
1327  HWND Detach();
1328 
1329 protected:
1330  Common::HashMap<int, CWnd *> _children;
1331  int m_nFlags = 0;
1332  int _itemState = 0;
1333  int _controlId = 0;
1334 
1335 protected:
1341  static bool isRecursiveMessage(unsigned int message);
1342 
1343 public:
1344  // For ScummVM the m_hWnd just points to the window itself,
1345  // so it'll be set up once in the constructor
1346  CWnd *m_hWnd = nullptr;
1347 
1348  CWnd *m_pParentWnd = nullptr;
1349  int m_nClassStyle = 0;
1350  int m_nStyle = 0;
1351  int _modalResult = DEFAULT_MODAL_RESULT;
1352  bool _hasFocus = false;
1353  CString _windowText;
1354  Common::Rect _windowRect;
1355  Common::Rect _updateRect;
1356  Common::Rect _updatingRect;
1357  bool _updateErase = false;
1358 
1359 public:
1363  static CWnd *FromHandlePermanent(HWND hWnd);
1364 
1373  static CWnd *FromHandle(HWND hWnd);
1374 
1375 public:
1376  CWnd();
1377  ~CWnd() override;
1378 
1379  bool Create(const char *lpszClassName, const char *lpszWindowName,
1380  uint32 dwStyle, const RECT &rect, CWnd *pParentWnd, unsigned int nID,
1381  CCreateContext *pContext = nullptr);
1382  bool CreateEx(uint32 dwExStyle, const char *lpszClassName,
1383  const char *lpszWindowName, uint32 dwStyle,
1384  int x, int y, int nWidth, int nHeight,
1385  HWND hWndParent, LPARAM nIDorHMenu, void *lpParam = nullptr);
1386  bool CreateEx(uint32 dwExStyle, const char *lpszClassName,
1387  const char *lpszWindowName, uint32 dwStyle,
1388  const RECT &rect, CWnd *pParentWnd, unsigned int nID,
1389  void *lpParam = nullptr);
1390 
1397  Common::Array<const CWnd *> GetSafeParents(bool includeSelf = true) const;
1398  Common::Array<CWnd *> GetSafeParents(bool includeSelf = true);
1399 
1400  CWnd *GetParent() const;
1401  CWnd *GetTopLevelFrame();
1402  HWND GetSafeHwnd() const;
1403 
1404  void ShowWindow(int nCmdShow);
1405  bool EnableWindow(bool bEnable = true);
1406  void UpdateWindow();
1407  bool RedrawWindow(
1408  LPCRECT lpRectUpdate = nullptr,
1409  CRgn *prgnUpdate = nullptr,
1410  unsigned int flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN
1411  );
1412  void SetActiveWindow();
1413  void SetFocus();
1414  CWnd *GetFocus() const;
1415  bool IsWindowVisible() const {
1416  return (GetStyle() & WS_VISIBLE) != 0;
1417  }
1418  void DestroyWindow();
1419  void Invalidate(bool bErase = true);
1420  int GetWindowText(CString &rString) const;
1421  int GetWindowText(char *lpszStringBuf, int nMaxCount) const;
1422  bool SetWindowText(const char *lpszString);
1423  unsigned int GetState() const;
1424  uint32 GetStyle() const {
1425  return m_nStyle;
1426  }
1427  void SetStyle(uint32 nStyle);
1428  bool IsWindowEnabled() const {
1429  return (_itemState & ODS_DISABLED) == 0;
1430  }
1431  bool IsActiveWindow() const;
1432 
1433  CDC *GetDC();
1434  int ReleaseDC(CDC *pDC);
1435 
1436  bool PostMessage(unsigned int message, WPARAM wParam = 0, LPARAM lParam = 0);
1437  LRESULT SendMessage(unsigned int message, WPARAM wParam = 0, LPARAM lParam = 0);
1438  void SendMessageToDescendants(unsigned int message,
1439  WPARAM wParam = 0, LPARAM lParam = 0,
1440  bool bDeep = true, bool bOnlyPerm = false);
1441  static void SendMessageToDescendants(HWND hWnd, unsigned int message,
1442  WPARAM wParam, LPARAM lParam, bool bDeep, bool bOnlyPerm);
1443 
1444  bool Validate();
1445  bool ValidateRect(LPCRECT lpRect = nullptr);
1446  bool InvalidateRect(LPCRECT lpRect, bool bErase = true);
1447  void GetWindowRect(LPRECT lpRect) const;
1448  bool GetUpdateRect(LPRECT lpRect, bool bErase = false);
1449  bool GetClientRect(LPRECT lpRect) const;
1450  RECT GetClientRect() const;
1451  bool PointInClientRect(const POINT &pt) const;
1452  void ClientToScreen(LPPOINT lpPoint) const;
1453  void ClientToScreen(LPRECT lpRect) const;
1454  void ScreenToClient(LPPOINT lpPoint) const;
1455  void ScreenToClient(LPRECT lpRect) const;
1456  RECT GetWindowRectInParentCoords() const;
1457 
1458  void MoveWindow(LPCRECT lpRect, bool bRepaint = true);
1459  void MoveWindow(int x, int y, int nWidth, int nHeight,
1460  bool bRepaint = true);
1461  HDC BeginPaint(LPPAINTSTRUCT lpPaint);
1462  bool EndPaint(const PAINTSTRUCT *lpPaint);
1463 
1464  CWnd *GetDlgItem(int nID) const;
1465  CWnd *GetNextDlgGroupItem(CWnd *pWndCtl, bool bPrevious = false) const;
1466  bool GotoDlgCtrl(CWnd *pWndCtrl);
1467  bool SubclassDlgItem(unsigned int nID, CWnd *pParent);
1468  bool SetDlgItemText(int nIDDlgItem, const char *lpString);
1469  int GetDlgCtrlID() const;
1470  void CheckDlgButton(int nIDButton, unsigned int nCheck);
1471  LRESULT SendDlgItemMessage(int nID, unsigned int message,
1472  WPARAM wParam = 0, LPARAM lParam = 0) const;
1473 
1474  uintptr SetTimer(uintptr nIDEvent, unsigned int nElapse,
1475  void (CALLBACK *lpfnTimer)(HWND, unsigned int, uintptr, uint32) = nullptr);
1476  bool KillTimer(uintptr nIDEvent);
1477 
1478  virtual bool PreTranslateMessage(MSG *pMsg) {
1479  return false;
1480  }
1481  virtual int GetScrollPos() const {
1482  return 0;
1483  }
1484  int GetScrollPosition() const {
1485  return GetScrollPos();
1486  }
1487  virtual int SetScrollPos(int nPos, bool bRedraw = true) {
1488  return 0;
1489  }
1490  virtual void GetScrollRange(int *lpMinPos, int *lpMaxPos) const {}
1491  void GetScrollRange(int /*nBar*/, int *lpMinPos, int *lpMaxPos) const {
1492  GetScrollRange(lpMinPos, lpMaxPos);
1493  }
1494  virtual void SetScrollRange(int nMinPos, int nMaxPos, bool bRedraw) {}
1495 
1496  void SetCapture();
1497  void ReleaseCapture();
1498 
1499  const Common::HashMap<int, CWnd *> &getChildren() const {
1500  return _children;
1501  }
1502  bool IsWindowDirty() const {
1503  return !_updateRect.isEmpty();
1504  }
1505 
1506  HFONT GetFont() const {
1507  return _hFont;
1508  }
1509  void SetFont(CFont *pFont, bool bRedraw = true);
1510 
1511  void pause();
1512 };
1513 
1514 class CFrameWnd : public CWnd {
1515  DECLARE_DYNCREATE(CFrameWnd)
1516 
1517 private:
1518  CString m_strTitle;
1519  unsigned int m_nIDHelp = 0;
1520  CView *m_pViewActive = nullptr;
1521 
1522  void ActivateFrame(int nCmdShow);
1523  void OnUpdateFrameTitle(bool bAddToTitle);
1524  CWnd *CreateView(CCreateContext *pContext, unsigned int nID);
1525 
1526 protected:
1527  bool PreCreateWindow(CREATESTRUCT &cCs) override {
1528  return true;
1529  }
1530  int OnCreate(LPCREATESTRUCT lpcs);
1531  int OnCreateHelper(LPCREATESTRUCT lpcs, CCreateContext *pContext);
1532  bool OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext *pContext);
1533  void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized) override;
1534 
1535  enum RepositionFlags {
1536  reposDefault = 0, reposQuery = 1, reposExtra = 2, reposNoPosLeftOver = 0x8000
1537  };
1538  bool RepositionBars(
1539  unsigned int nIDFirst,
1540  unsigned int nIDLast,
1541  unsigned int nIDLeftOver,
1542  unsigned int nFlag = reposDefault,
1543  LPRECT lpRectParam = nullptr,
1544  LPCRECT lpRectClient = nullptr,
1545  bool bStretch = true
1546  );
1547 
1548  DECLARE_MESSAGE_MAP()
1549 
1550 public:
1551  ~CFrameWnd() override {
1552  }
1553 
1554  bool Create(const char *lpszClassName,
1555  const char *lpszWindowName,
1556  uint32 dwStyle,
1557  const RECT &rect,
1558  CWnd *pParentWnd = nullptr,
1559  const char *lpszMenuName = nullptr,
1560  uint32 dwExStyle = 0,
1561  CCreateContext *pContext = nullptr);
1562  bool Create(const char *lpszClassName, const char *lpszWindowName,
1563  uint32 dwStyle = WS_OVERLAPPEDWINDOW) {
1564  CRect rectDefault;
1565  return Create(lpszClassName, lpszWindowName, dwStyle, rectDefault);
1566  }
1567 
1568  HMENU GetMenu() const;
1569  void RecalcLayout(bool bNotify = true);
1570  void InitialUpdateFrame(CDocument *pDoc, bool bMakeVisible);
1571 
1572  bool LoadFrame(unsigned int nIDResource, uint32 dwDefaultStyle,
1573  CWnd *pParentWnd, CCreateContext *pContext);
1574 
1575  CView *GetActiveView() const;
1576  void SetActiveView(CView *pViewNew, bool bNotify = true);
1577  void OnSetFocus(CWnd *pOldWnd);
1578  CDocument *GetActiveDocument();
1579 };
1580 
1581 class CDialog : public CWnd {
1582  DECLARE_DYNAMIC(CDialog)
1583  friend class CDialogTemplate;
1584 
1585 private:
1586  const char *m_lpszTemplateName = nullptr;
1587  unsigned int m_nIDHelp = 0;
1588  LPCDLGTEMPLATE m_lpDialogTemplate = nullptr;
1589  HGLOBAL m_hDialogTemplate = 0;
1590  int _defaultId = 0;
1591  CFont _dialogFont;
1592 
1593  void SetParent(CWnd *wnd);
1594  bool CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate, CWnd *pParentWnd,
1595  void *lpDialogInit, HINSTANCE hInst);
1596  bool CreateIndirect(HGLOBAL hDialogTemplate, CWnd *pParentWnd,
1597  HINSTANCE hInst);
1598  bool CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
1599  CWnd *pParentWnd, HINSTANCE hInst);
1600  CWnd *GetDefaultPushButton() const;
1601 
1602 protected:
1603  DECLARE_MESSAGE_MAP()
1604 
1605  virtual void OnOK();
1606  virtual void OnCancel();
1607  virtual void PostModal() {
1608  }
1609 
1610  void OnSysChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
1611  void OnActivate(unsigned int nState, CWnd *pWndOther, bool bMinimized) override;
1612 
1613 public:
1614  CDialog() {}
1615  explicit CDialog(const char *lpszTemplateName,
1616  CWnd *pParentWnd = nullptr);
1617  explicit CDialog(unsigned int nIDTemplate,
1618  CWnd *pParentWnd = nullptr);
1619  ~CDialog() override {}
1620  bool Create(const char *lpszTemplateName,
1621  CWnd *pParentWnd = nullptr);
1622  bool Create(unsigned int nIDTemplate,
1623  CWnd *pParentWnd = nullptr);
1624 
1625  int DoModal();
1626  virtual void PreInitDialog() {}
1627  virtual bool OnInitDialog() {
1628  return true;
1629  }
1630  bool PreTranslateMessage(MSG *pMsg) override;
1631 
1632  uint32 GetDefID() const;
1633  void SetDefID(unsigned int nID);
1634  LRESULT HandleInitDialog(WPARAM, LPARAM);
1635  LRESULT HandleSetFont(WPARAM, LPARAM);
1636  void AFXAPI DDX_Control(CDataExchange *pDX, int nIDC, CWnd &rControl);
1637  void AFXAPI DDX_Radio(CDataExchange *pDX,
1638  int nIDCButton1, int &value);
1639  void AFXAPI DDX_Text(CDataExchange *pDX,
1640  int nIDC, int &value);
1641  void AFXAPI DDX_Text(CDataExchange *pDX, int nIDC, CString &value);
1642  void AFXAPI DDX_Text(CDataExchange *pDX, int nIDC, unsigned int &value);
1643  void AFXAPI DDX_Text(CDataExchange *pDX, int nIDC, long &value);
1644  void AFXAPI DDX_Text(CDataExchange *pDX, int nIDC, double &value);
1645  void AFXAPI DDX_Check(CDataExchange *pDX,
1646  int nIDC, bool value);
1647  void AFXAPI DDV_MinMaxInt(CDataExchange *pDX,
1648  int value, int nMin, int nMax);
1649 
1650  // termination
1651  void EndDialog(int nResult);
1652 
1653  bool UpdateData(bool bSaveAndValidate = true);
1654 };
1655 
1656 class CStatic : public CWnd {
1657  DECLARE_DYNAMIC(CStatic)
1658 
1659 protected:
1660  DECLARE_MESSAGE_MAP()
1661 
1662 public:
1663  ~CStatic() override {
1664  }
1665 };
1666 
1667 class CButton : public CWnd {
1668  DECLARE_DYNAMIC(CButton)
1669 
1670 private:
1671  bool _pressed = false;
1672 
1673  void OnPushButtonPaint();
1674  void OnPushBoxPaint();
1675  void OnOwnerDrawPaint();
1676 
1677 protected:
1678  DECLARE_MESSAGE_MAP()
1679 
1680  void OnPaint();
1681  void OnLButtonDown(unsigned int nFlags, CPoint point);
1682  void OnLButtonUp(unsigned int nFlags, CPoint point);
1683  void OnMouseMove(unsigned int nFlags, CPoint point);
1684  LRESULT OnBnClicked(WPARAM wParam, LPARAM lParam);
1685  LRESULT OnBnSetCheck(WPARAM wParam, LPARAM lParam);
1686 
1687 public:
1688  ~CButton() override {
1689  }
1690  CVIRTUAL bool Create(const char *lpszCaption, uint32 dwStyle,
1691  const RECT &rect, CWnd *pParentWnd, unsigned int nID);
1692 
1693  int GetCheck() const;
1694  void SetCheck(int nCheck);
1695  void SetButtonStyle(unsigned int nStyle, bool bRedraw = true);
1696  unsigned int GetButtonStyle() const;
1697 };
1698 
1699 class CListBox : public CWnd {
1700  DECLARE_DYNAMIC(CListBox)
1701 
1702 protected:
1703  DECLARE_MESSAGE_MAP()
1704 
1705 public:
1706  ~CListBox() override {
1707  }
1708 };
1709 
1710 class CCheckListBox : public CListBox {
1711  DECLARE_DYNAMIC(CCheckListBox)
1712 public:
1713  ~CCheckListBox() override {
1714  }
1715 };
1716 
1717 class CEdit : public CWnd {
1718  DECLARE_DYNAMIC(CEdit)
1719 
1720 private:
1721  size_t _maxLength = 0;
1722  bool _cursorVisible = false;
1723 
1724 protected:
1725  DECLARE_MESSAGE_MAP()
1726 
1727 public:
1728  ~CEdit() override {
1729  }
1730  CVIRTUAL bool Create(uint32 dwStyle, const RECT &rect, CWnd *pParentWnd, unsigned int nID);
1731  void LimitText(int nChars);
1732  void SetSel(int nStartChar, int nEndChar, bool bNoScroll = false);
1733 
1734  afx_msg void OnPaint();
1735  afx_msg void OnKeyDown(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
1736  afx_msg void OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned int nFlags);
1737  afx_msg void OnSetFocus(CWnd *pOldWnd);
1738  afx_msg void OnKillFocus(CWnd *pNewWnd);
1739  afx_msg void OnTimer(uintptr nTimerId);
1740 };
1741 
1742 class CScrollBar : public CWnd {
1743  DECLARE_DYNAMIC(CScrollBar)
1744 
1745 private:
1746  int _minValue = 0;
1747  int _maxValue = 100;
1748  int _pageSize = 10;
1749  int _value = 0;
1750 
1751  void drawSquare(CPaintDC &dc, const CRect &r);
1752  void drawArrow(CPaintDC &dc, const CRect &r, bool leftArrow);
1753  CRect getThumbRect() const;
1754  int getIndexFromX(int xp) const;
1755  void scrollEvent(int action);
1756 
1757 protected:
1758  DECLARE_MESSAGE_MAP()
1759  void OnPaint();
1760  void OnLButtonDown(unsigned int nFlags, CPoint point);
1761  void OnLButtonUp(unsigned int nFlags, CPoint point);
1762  void OnMouseMove(unsigned int, CPoint point);
1763 
1764 public:
1765  ~CScrollBar() override { }
1766  CVIRTUAL bool Create(uint32 dwStyle, const RECT &rect, CWnd *pParentWnd, unsigned int nID);
1767 
1768  int GetScrollPos() const override;
1769  int SetScrollPos(int nPos, bool bRedraw = true) override;
1770  void GetScrollRange(int *lpMinPos, int *lpMaxPos) const override;
1771  void SetScrollRange(int nMinPos, int nMaxPos, bool bRedraw) override;
1772  void ShowScrollBar(bool bShow);
1773  bool SetScrollInfo(LPSCROLLINFO lpScrollInfo, bool bRedraw);
1774 };
1775 
1776 class CView : public CWnd {
1777  DECLARE_DYNAMIC(CView)
1778 
1779 protected:
1780  virtual bool PreCreateWindow(CREATESTRUCT &cCs) override;
1781  virtual void OnDraw(CDC *pDC) {}
1782  void OnPaint();
1783  void OnNcDestroy();
1784 
1785  DECLARE_MESSAGE_MAP()
1786 
1787 public:
1788  CDocument *m_pDocument = nullptr;
1789 
1790 public:
1791  ~CView() override {
1792  }
1793 
1794  int OnCreate(LPCREATESTRUCT lpcs);
1795  void OnDestroy();
1796  void PostNcDestroy() override;
1797 
1798  void OnInitialUpdate();
1799  virtual void OnUpdate(CView *pSender, LPARAM /*lHint*/, CObject * /*pHint*/);
1800  virtual void OnActivateView(bool, CView *, CView *) {}
1801  virtual void OnActivateFrame(unsigned int nState, CFrameWnd *pFrameWnd) {}
1802 
1803  CFrameWnd *GetParentFrame() const {
1804  return dynamic_cast<CFrameWnd *>(m_pParentWnd);
1805  }
1806  CDocument *GetDocument() const {
1807  return m_pDocument;
1808  }
1809 };
1810 
1811 class CScrollView : public CView {
1812  DECLARE_DYNAMIC(CScrollView)
1813 
1814 private:
1815  static const SIZE sizeNull;
1816 
1817 protected:
1818  DECLARE_MESSAGE_MAP()
1819 
1820 public:
1821  ~CScrollView() override {
1822  }
1823 
1824  void SetScrollSizes(
1825  int nMapMode,
1826  SIZE sizeTotal,
1827  const SIZE &sizePage = sizeNull,
1828  const SIZE &sizeLine = sizeNull
1829  );
1830 };
1831 
1832 /*============================================================================*/
1833 // class CDocTemplate creates documents
1834 
1835 class CDocTemplate : public CCmdTarget {
1836  DECLARE_DYNAMIC(CDocTemplate)
1837 private:
1838  unsigned int m_nIDResource = 0;
1839  const CRuntimeClass *m_pDocClass = nullptr;
1840  const CRuntimeClass *m_pFrameClass = nullptr;
1841  const CRuntimeClass *m_pViewClass = nullptr;
1842 
1843 protected:
1844  DECLARE_MESSAGE_MAP()
1845 
1846  CDocTemplate(unsigned int nIDResource, const CRuntimeClass *pDocClass,
1847  const CRuntimeClass *pFrameClass, const CRuntimeClass *pViewClass);
1848 
1849 public:
1856 
1857 public:
1863  virtual CDocument *OpenDocumentFile(const char *lpszPathName,
1864  bool bMakeVisible = true) = 0;
1865  virtual CDocument *CreateNewDocument();
1866  virtual CFrameWnd *CreateNewFrame(CDocument *pDoc, CFrameWnd *pOther);
1867  virtual void SetDefaultTitle(CDocument *pDocument) = 0;
1868  virtual void InitialUpdateFrame(CFrameWnd *pFrame, CDocument *pDoc,
1869  bool bMakeVisible = true);
1870 
1871  virtual void AddDocument(CDocument *pDoc); // must override
1872  virtual void RemoveDocument(CDocument *pDoc); // must override
1873  virtual void CloseAllDocuments(bool bEndSession);
1874  virtual POSITION GetFirstDocPosition() const = 0;
1875  virtual CDocument *GetNextDoc(POSITION &rPos) const = 0;
1876 
1877  void LoadTemplate();
1878 };
1879 
1881  DECLARE_DYNAMIC(CSingleDocTemplate)
1882 private:
1883  CDocument *m_pOnlyDoc = nullptr;
1884 
1885 public:
1886  DECLARE_MESSAGE_MAP()
1887 
1888 public:
1890  unsigned int nIDResource,
1891  const CRuntimeClass *pDocClass,
1892  const CRuntimeClass *pFrameClass,
1893  const CRuntimeClass *pViewClass
1894  ) : CDocTemplate(nIDResource, pDocClass,
1895  pFrameClass, pViewClass) {
1896  }
1897  ~CSingleDocTemplate();
1898 
1904  CDocument *OpenDocumentFile(const char *lpszPathName,
1905  bool bMakeVisible = true) override;
1906  void AddDocument(CDocument *pDoc) override;
1907 
1908  void SetDefaultTitle(CDocument *pDocument) override;
1909 
1910  POSITION GetFirstDocPosition() const override;
1911  CDocument *GetNextDoc(POSITION &rPos) const override;
1912 };
1913 
1915 
1917 private:
1918  CTemplateList pStaticList;
1919  bool bStaticInit = false;
1920 
1921 protected:
1922  CTemplateList m_templateList;
1923 
1924 public:
1925  virtual ~CDocManager() {}
1926  void AddDocTemplate(CDocTemplate *pTemplate);
1927  void OnFileNew();
1928  void OnFileOpen();
1929  virtual void CloseAllDocuments(bool bEndSession);
1930 };
1931 
1932 /*============================================================================*/
1933 
1934 template<class T>class CHandleMap;
1935 
1936 class CWinThread : public CCmdTarget {
1937  DECLARE_DYNAMIC(CWinThread)
1938 public:
1939  ~CWinThread() override {
1940  }
1941 };
1942 
1943 class CWinApp : public CWinThread, public Libs::EventLoop {
1944  DECLARE_DYNAMIC(CWinApp)
1945 
1946 private:
1947  CWinApp *_priorWinApp;
1948  Libs::Resources _resources;
1949  Libs::Settings _settings;
1950  Gfx::Cursors _cursors;
1951  Gfx::Fonts _fonts;
1952  Graphics::Screen _screen;
1953  int m_nWaitCursorCount = 0;
1954  HCURSOR m_hcurWaitCursorRestore = nullptr;
1955  HCURSOR _currentCursor = nullptr;
1956  Common::FSNode _currentDirectory;
1957  CHandleMap<CDC> *m_pmapHDC = nullptr;
1958  CHandleMap<CGdiObject> *m_pmapHGDIOBJ = nullptr;
1959  CHandleMap<CWnd> *m_pmapWnd = nullptr;
1960 
1961 protected:
1962  virtual bool InitInstance();
1963  virtual int ExitInstance();
1964 
1965 public:
1966  static CWinApp *_activeApp;
1967  int m_nCmdShow = SW_SHOWNORMAL;
1968  const char *m_lpCmdLine = "";
1969  CWnd *m_pMainWnd = nullptr;
1970  CPalette _systemPalette;
1971  CPalette _currentPalette;
1972  CFont _defaultFont;
1973  CPen _defaultPen;
1974  CBrush _defaultBrush;
1975  MSG _currentMessage;
1976  CDocManager *m_pDocManager = nullptr;
1977 
1978 public:
1979  CWinApp(const char *appName = nullptr);
1980  ~CWinApp() override;
1981 
1985  int Run();
1986 
1987  virtual bool InitApplication();
1988  virtual bool SaveAllModified();
1989 
1990  void SetDialogBkColor();
1991  HCURSOR LoadStandardCursor(const char *lpszCursorName);
1992  HCURSOR LoadCursor(const char *lpszResourceName);
1993  HCURSOR LoadCursor(unsigned int nIDResource);
1994  HCURSOR SetCursor(HCURSOR hCursor);
1995  void BeginWaitCursor();
1996  void EndWaitCursor();
1997 
2002  void DoWaitCursor(int nCode) override;
2003 
2004  void AddDocTemplate(CDocTemplate *pTemplate);
2005  void CloseAllDocuments(bool bEndSession);
2006 
2007  unsigned int GetProfileInt(const char *lpszSection,
2008  const char *lpszEntry, int nDefault);
2009  void WriteProfileInt(const char *lpszSection,
2010  const char *lpszEntry, int nValue);
2011  CString GetProfileString(const char *lpszSection,
2012  const char *lpszEntry, const char *lpszDefault = nullptr) ;
2013  bool WriteProfileString(const char *lpszSection,
2014  const char *lpszEntry, const char *lpszValue);
2015 
2016 
2017  virtual void OnFileNew();
2018  virtual void OnFileOpen();
2019  virtual void OnFilePrintSetup() {}
2020 
2021  CHandleMap<CGdiObject> *afxMapHGDIOBJ(bool bCreate = false);
2022  CHandleMap<CDC> *afxMapHDC(bool bCreate = false);
2023  CHandleMap<CWnd> *afxMapWnd(bool bCreate = false);
2024  void AfxUnlockTempMaps();
2025 
2026  /*== ScummVM added functions ==*/
2027  void setDirectory(const char *folder);
2028  void setPalette(const Graphics::Palette &pal);
2029  byte getColor(COLORREF color) const;
2030  Graphics::Screen *getScreen() {
2031  return &_screen;
2032  }
2033 
2034  // resource functions
2038  void addResources(const Common::Path &file) {
2039  _resources.addResources(file);
2040  }
2041  void removeResources(const Common::Path &file) {
2042  _resources.removeResources(file);
2043  }
2044  HRSRC findResource(const char *lpName, const char *lpType);
2045  size_t sizeofResource(HRSRC hResInfo);
2046  HGLOBAL loadResource(HRSRC hResInfo);
2047  void *lockResource(HGLOBAL hResData);
2048  void unlockResource(HGLOBAL hResData);
2049  bool freeResource(HGLOBAL hResData);
2050  const Libs::Resources &getResources() const {
2051  return _resources;
2052  }
2053 
2054  // Fonts
2055  int addFontResource(const char *fontName) {
2056  return _fonts.addFontResource(fontName);
2057  }
2058  bool removeFontResource(const char *fontName) {
2059  return _fonts.removeFontResource(fontName);
2060  }
2061  HFONT createFont(int nHeight, int nWidth, int nEscapement,
2062  int nOrientation, int nWeight, byte bItalic, byte bUnderline,
2063  byte cStrikeOut, byte nCharSet, byte nOutPrecision,
2064  byte nClipPrecision, byte nQuality, byte nPitchAndFamily,
2065  const char *lpszFacename) {
2066  return _fonts.createFont(nHeight, nWidth,
2067  nEscapement, nOrientation, nWeight, bItalic,
2068  bUnderline, cStrikeOut, nCharSet, nOutPrecision,
2069  nClipPrecision, nQuality, nPitchAndFamily,
2070  lpszFacename);
2071  }
2072  HFONT getFont(const char *lpszFacename, int nHeight);
2073  HFONT getDefaultFont() {
2074  assert(_defaultFont.m_hObject);
2075  return (HFONT)_defaultFont.m_hObject;
2076  }
2077  HPEN getDefaultPen() const {
2078  assert(_defaultPen.m_hObject);
2079  return (HPEN)_defaultPen.m_hObject;
2080  }
2081  HBRUSH getDefaultBrush() {
2082  assert(_defaultBrush.m_hObject);
2083  return (HBRUSH)_defaultBrush.m_hObject;
2084  }
2085  HPALETTE getSystemPalette() {
2086  assert(_systemPalette.m_hObject);
2087  return (HPALETTE)_systemPalette.m_hObject;
2088  }
2089 
2090  const char *AfxRegisterWndClass(unsigned int nClassStyle,
2091  HCURSOR hCursor, HBRUSH hbrBackground, HICON hIcon);
2092  bool GetClassInfo(HINSTANCE hInstance,
2093  const char * lpClassName, LPWNDCLASS lpWndClass);
2094 };
2095 
2096 } // namespace MFC
2097 } // namespace Bagel
2098 
2099 #endif
Definition: afx.h:64
Definition: afx.h:78
Definition: afxwin.h:553
Definition: minwindef.h:165
Definition: text_render.h:36
Definition: wingdi.h:702
Definition: afxwin.h:727
Definition: afxstr.h:31
Definition: wingdi.h:714
Definition: wingdi.h:656
Definition: afxwin.h:1936
Definition: array.h:52
Definition: fonts.h:47
Definition: pixelformat.h:138
Definition: afxwin.h:1717
Definition: afxwin.h:1125
Definition: afxwin.h:302
Definition: afxwin.h:375
Definition: afxwin.h:1934
Definition: afxwin.h:1514
Definition: afxwin.h:1916
Definition: atltypes.h:79
Definition: rect.h:524
Definition: path.h:52
Definition: afxwin.h:1037
Definition: afx.h:187
Definition: afxwin.h:66
Definition: screen.h:48
Definition: afxwin.h:655
Definition: afxwin.h:491
void addResources(const Common::Path &file)
Definition: afxwin.h:2038
Definition: minwindef.h:86
Definition: afxwin.h:484
Definition: afxwin.h:69
Definition: afxwin.h:692
Definition: dialog_template.h:55
Definition: minwindef.h:160
Definition: afxwin.h:1045
Definition: winnt.h:700
Definition: afxwin.h:449
Definition: afxwin.h:1835
Definition: minwindef.h:152
Definition: minwindef.h:238
Definition: afxwin.h:526
Definition: afxwin.h:991
Definition: afxwin.h:67
Definition: hashmap.h:85
Definition: afxwin.h:657
Definition: afxwin.h:70
Definition: afxwin.h:1656
Definition: afxwin.h:75
Definition: fonts.h:90
Definition: minwindef.h:150
Definition: winnt.h:655
Definition: afxwin.h:1581
Definition: cursor.h:86
Definition: settings.h:33
Definition: fs.h:69
Definition: atltypes.h:40
Definition: afxwin.h:476
bool isEmpty() const
Definition: rect.h:373
Definition: afxwin.h:1667
void removeResources(const Common::Path &file)
Definition: rect.h:144
Definition: afxwin.h:592
Definition: minwindef.h:178
Definition: minwindef.h:291
Definition: resources.h:60
Definition: minwindef.h:278
Definition: afxwin.h:1943
Definition: afxwin.h:27
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: wingdi.h:727
Definition: afxwin.h:590
Definition: afxwin.h:1003
Definition: afxwin.h:1742
Definition: afxwin.h:1710
Definition: afxwin.h:460
Definition: winnt.h:682
Definition: event_loop.h:70
Definition: afxwin.h:292
Definition: afxwin.h:528
Definition: afxwin.h:623
Definition: afxwin.h:721
Simple class for handling a palette data.
Definition: palette.h:55
CString m_strDocStrings
Definition: afxwin.h:1855
Definition: afxwin.h:1880
Definition: afxwin.h:555
Definition: wingdi.h:692
Definition: afxwin.h:1811
Definition: afxwin.h:68
Definition: afxwin.h:625
Definition: atltypes.h:131
Definition: wingdi.h:685
Definition: afxwin.h:708
Definition: afxwin.h:1776
Definition: minwindef.h:250
void addResources(const Common::Path &file)
Definition: afxwin.h:1699
Definition: afxwin.h:1100
Definition: surface.h:37