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