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