22 #ifndef GRAPHICS_MFC_AFXWIN_H 23 #define GRAPHICS_MFC_AFXWIN_H 25 #include "common/events.h" 26 #include "common/fs.h" 27 #include "graphics/palette.h" 28 #include "graphics/screen.h" 29 #include "graphics/mfc/minwindef.h" 30 #include "graphics/mfc/wingdi.h" 31 #include "graphics/mfc/afx.h" 32 #include "graphics/mfc/afxmsg.h" 33 #include "graphics/mfc/afxstr.h" 34 #include "graphics/mfc/atltypes.h" 35 #include "graphics/mfc/global_functions.h" 36 #include "graphics/mfc/gfx/surface.h" 37 #include "graphics/mfc/gfx/cursor.h" 38 #include "graphics/mfc/gfx/dialog_template.h" 39 #include "graphics/mfc/gfx/fonts.h" 40 #include "graphics/mfc/gfx/text_render.h" 41 #include "graphics/mfc/libs/array.h" 42 #include "graphics/mfc/libs/event_loop.h" 43 #include "graphics/mfc/libs/events.h" 44 #include "graphics/mfc/libs/list.h" 45 #include "graphics/mfc/libs/settings.h" 50 constexpr uint32 DEFAULT_MODAL_RESULT =
MKTAG(
'S',
'C',
'V',
'M');
82 bool CreatePopupMenu();
83 bool LoadMenu(
const char *lpszResourceName);
84 bool LoadMenu(
unsigned int nIDResource);
85 bool LoadMenuIndirect(
const void *lpMenuTemplate);
88 static CMenu *FromHandle(HMENU hMenu);
90 unsigned int CheckMenuItem(
unsigned int nIDCheckItem,
unsigned int nCheck);
105 AfxSig_b_W_COPYDATASTRUCT,
108 AfxSig_CTLCOLOR_REFLECT,
143 AfxSig_SCROLL_REFLECT,
150 AfxSig_v_b_NCCALCSIZEPARAMS,
151 AfxSig_v_v_WINDOWPOS,
174 AfxSig_u_v_MENUGETOBJECTINFO,
176 AfxSig_v_u_LPMDINEXTMENU,
180 AfxSig_MOUSE_XBUTTON,
181 AfxSig_MOUSE_NCXBUTTON,
182 AfxSig_INPUTLANGCHANGE,
184 AfxSig_INPUTDEVICECHANGE,
196 AfxSig_bD = AfxSig_b_D_v,
197 AfxSig_bb = AfxSig_b_b_v,
198 AfxSig_bWww = AfxSig_b_W_uu,
199 AfxSig_hDWw = AfxSig_CTLCOLOR,
200 AfxSig_hDw = AfxSig_CTLCOLOR_REFLECT,
201 AfxSig_iwWw = AfxSig_i_u_W_u,
202 AfxSig_iww = AfxSig_i_uu_v,
203 AfxSig_iWww = AfxSig_i_W_uu,
204 AfxSig_is = AfxSig_i_v_s,
205 AfxSig_lwl = AfxSig_l_w_l,
206 AfxSig_lwwM = AfxSig_l_uu_M,
207 AfxSig_vv = AfxSig_v_v_v,
209 AfxSig_vw = AfxSig_v_u_v,
210 AfxSig_vww = AfxSig_v_u_u,
211 AfxSig_vww2 = AfxSig_v_uu_v,
212 AfxSig_vvii = AfxSig_v_v_ii,
213 AfxSig_vwww = AfxSig_v_u_uu,
214 AfxSig_vwii = AfxSig_v_u_ii,
215 AfxSig_vwl = AfxSig_v_w_l,
216 AfxSig_vbWW = AfxSig_MDIACTIVATE,
217 AfxSig_vD = AfxSig_v_D_v,
218 AfxSig_vM = AfxSig_v_M_v,
219 AfxSig_vMwb = AfxSig_v_M_ub,
221 AfxSig_vW = AfxSig_v_W_v,
222 AfxSig_vWww = AfxSig_v_W_uu,
223 AfxSig_vWp = AfxSig_v_W_p,
224 AfxSig_vWh = AfxSig_v_W_h,
225 AfxSig_vwW = AfxSig_v_u_W,
226 AfxSig_vwWb = AfxSig_ACTIVATE,
227 AfxSig_vwwW = AfxSig_SCROLL,
228 AfxSig_vwwx = AfxSig_SCROLL_REFLECT,
229 AfxSig_vs = AfxSig_v_v_s,
230 AfxSig_vOWNER = AfxSig_OWNERDRAW,
231 AfxSig_iis = AfxSig_i_i_s,
232 AfxSig_wp = AfxSig_u_v_p,
233 AfxSig_wv = AfxSig_u_v_v,
234 AfxSig_vPOS = AfxSig_v_v_WINDOWPOS,
235 AfxSig_vCALC = AfxSig_v_b_NCCALCSIZEPARAMS,
236 AfxSig_vNMHDRpl = AfxSigNotify_v,
237 AfxSig_bNMHDRpl = AfxSigNotify_b,
238 AfxSig_vwNMHDRpl = AfxSigNotify_RANGE,
239 AfxSig_bwNMHDRpl = AfxSigNotify_EX,
240 AfxSig_bHELPINFO = AfxSig_b_v_HELPINFO,
241 AfxSig_vwSIZING = AfxSig_SIZING,
244 AfxSig_cmdui = AfxSigCmdUI,
245 AfxSig_cmduiw = AfxSigCmdUI_RANGE,
246 AfxSig_vpv = AfxSigCmd_v_pv,
247 AfxSig_bpv = AfxSigCmd_b_pv,
250 AfxSig_vwwh = AfxSig_v_uu_M,
251 AfxSig_vwp = AfxSig_v_u_p,
252 AfxSig_bw = AfxSig_b_u_v,
253 AfxSig_bh = AfxSig_b_h_v,
254 AfxSig_iw = AfxSig_i_u_v,
255 AfxSig_ww = AfxSig_u_u_v,
256 AfxSig_bv = AfxSig_b_v_v,
257 AfxSig_hv = AfxSig_C_v_v,
258 AfxSig_vb = AfxSig_vw,
259 AfxSig_vbh = AfxSig_v_b_h,
260 AfxSig_vbw = AfxSig_vww,
261 AfxSig_vhh = AfxSig_v_h_h,
262 AfxSig_vh = AfxSig_v_h_v,
263 AfxSig_viSS = AfxSig_vwl,
264 AfxSig_bwl = AfxSig_lwl,
265 AfxSig_vwMOVING = AfxSig_vwSIZING,
267 AfxSig_vW2 = AfxSig_v_v_W,
268 AfxSig_bWCDS = AfxSig_b_W_COPYDATASTRUCT,
269 AfxSig_bwsp = AfxSig_MOUSEWHEEL,
270 AfxSig_vws = AfxSig_v_u_cs,
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 285 #define PM_NOREMOVE 0x0000 286 #define PM_REMOVE 0x0001 287 #define PM_NOYIELD 0x0002 290 typedef void (
CWnd::*AFX_PMSGW)();
292 #pragma warning(disable: 4121) 294 unsigned int nMessage;
297 unsigned int nLastID;
301 #pragma warning(default: 4121) 313 typedef void (AFX_MSG_CALL
CCmdTarget:: *AFX_PMSG)();
315 #define DECLARE_MESSAGE_MAP() \ 317 static const AFX_MSGMAP *GetThisMessageMap(); \ 318 const AFX_MSGMAP *GetMessageMap() const override; \ 329 #if defined(__clang__) && defined(__has_warning) 330 # if __has_warning("-Wcast-function-type") 331 # define COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 1 333 #elif GCC_ATLEAST(8, 1) 334 # define COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 1 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 345 # define BEGIN_SILENCE_CAST 346 # define END_SILENCE_CAST 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; \ 358 static const AFX_MSGMAP_ENTRY _messageEntries[] = \ 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; } \ 369 static const AFX_MSGMAP_ENTRY _messageEntries[] = \ 372 #define END_MESSAGE_MAP() \ 373 { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)nullptr } \ 376 static const AFX_MSGMAP messageMap = \ 377 { &TheBaseClass::GetThisMessageMap, &_messageEntries[0] }; \ 378 return &messageMap; \ 381 #define DECLARE_DYNCREATE(class_name) \ 382 DECLARE_DYNAMIC(class_name) \ 383 static CObject *CreateObject(); 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);
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 *);
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 *);
407 void (AFX_MSG_CALL
CWinThread:: *pfn_THREAD)(WPARAM, LPARAM);
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);
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)();
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);
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 *);
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 *);
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);
463 bool IsStoring()
const {
481 CView *m_pLastView =
nullptr;
507 bool _permanent =
false;
510 void AfxHookObject();
511 void AfxUnhookObject();
530 bool operator==(
const CGdiObject &obj)
const {
531 return obj.m_hObject == m_hObject;
533 bool operator!=(
const CGdiObject &obj)
const {
534 return obj.m_hObject != m_hObject;
547 Impl(
int nPenStyle,
int nWidth, COLORREF crColor) :
548 _penStyle(nPenStyle), _width(nWidth),
554 return (
Impl *)m_hObject;
559 CPen(
int nPenStyle,
int nWidth, COLORREF crColor);
562 bool CreatePen(
int nPenStyle,
int nWidth, COLORREF crColor);
572 Impl(COLORREF crColor);
573 Impl(
int nIndex, COLORREF crColor);
577 byte getColor()
const;
580 Impl *brush()
const {
581 return (
Impl *)m_hObject;
586 return (
CBrush *)CGdiObject::FromHandle(h);
593 CBrush(
int nIndex, COLORREF crColor);
597 bool CreateSolidBrush(COLORREF crColor);
598 bool CreateBrushIndirect(
const LOGBRUSH *lpLogBrush);
599 bool CreateStockObject(
int nIndex);
616 return (
Impl *)m_hObject;
621 return (
CFont *)CGdiObject::FromHandle(h);
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);
642 Impl *bitmap()
const {
643 return (
Impl *)m_hObject;
648 return (
CBitmap *)CGdiObject::FromHandle(h);
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);
676 Impl *palette()
const {
677 return (
Impl *)m_hObject;
682 return (
CPalette *)CGdiObject::FromHandle(h);
690 int GetObject(
int nCount,
void *lpObject)
const;
691 unsigned int GetEntryCount()
const;
692 unsigned int GetPaletteEntries(
unsigned int nStartIndex,
unsigned int nNumEntries,
694 unsigned int SetPaletteEntries(
unsigned int nStartIndex,
unsigned int nNumEntries,
697 bool AnimatePalette(
unsigned int nStartIndex,
unsigned int nNumEntries,
699 unsigned int GetNearestPaletteIndex(COLORREF crColor);
700 bool isEmpty()
const {
701 return !palette() || palette()->empty();
709 int _polyFillMode = 0;
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);
722 DECLARE_DYNCREATE(
CDC)
726 bool _permanent =
false;
727 int _stretchMode = STRETCH_ANDSCANS;
730 void AfxHookObject();
731 void AfxUnhookObject();
742 CWnd *m_pWnd =
nullptr;
745 COLORREF _bkColor = RGB(255, 255, 255);
746 int _bkMode = TRANSPARENT;
747 COLORREF _textColor = 0;
748 uint _textAlign = TA_LEFT;
750 bool _paletteRealized =
false;
752 uint getPenColor()
const;
753 uint getBrushColor()
const;
754 uint32 *getPaletteMap(
const CDC::Impl *srcImpl);
763 bool m_bForceBackground =
false;
764 bool _hasLogicalPalette =
false;
774 void setScreenRect();
779 unsigned int realizePalette();
780 COLORREF GetNearestColor(COLORREF crColor)
const;
782 void fillSolidRect(
LPCRECT lpRect, COLORREF clr);
783 void fillSolidRect(
int x,
int y,
int cx,
int cy, COLORREF clr);
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);
798 void ellipse(
int x1,
int y1,
int x2,
int y2);
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);
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);
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);
829 int nTabPositions,
const int *lpnTabStopPositions,
int nTabOrigin);
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);
838 CSize getTextExtent(
const char *lpszString,
int nCount)
const;
840 CSize getOutputTextExtent(
const char *lpszString,
int nCount)
const;
842 CSize getTabbedTextExtent(
const char *lpszString,
int nCount,
843 int nTabPositions,
int *lpnTabStopPositions)
const;
845 int nTabPositions,
int *lpnTabStopPositions)
const;
846 CSize getOutputTabbedTextExtent(
const char *lpszString,
int nCount,
847 int nTabPositions,
int *lpnTabStopPositions)
const;
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);
861 static CDC *FromHandle(HDC hDC);
866 operator HDC()
const {
870 return static_cast<Impl *
>(m_hDC);
873 bool CreateDC(
const char *lpszDriverName,
const char *lpszDeviceName,
874 const char *lpszOutput,
const void *lpInitData);
875 bool CreateCompatibleDC(
CDC *pDC);
877 bool Attach(HDC hDC);
879 int SetStretchBltMode(
int nStretchMode);
880 int GetDeviceCaps(
int nIndex)
const;
883 int GetMapMode()
const;
884 CPoint GetViewportOrg()
const;
885 virtual int SetMapMode(
int nMapMode);
887 virtual CPoint SetViewportOrg(
int x,
int y);
889 virtual CPoint OffsetViewportOrg(
int nWidth,
int nHeight);
892 virtual int GetClipBox(
LPRECT lpRect)
const;
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);
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);
918 void Ellipse(
int x1,
int y1,
int x2,
int y2);
920 void Draw3dRect(
const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
921 void DrawFocusRect(
const CRect &rect);
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);
939 const POINT &ptStart,
943 int nWidth,
int nHeight);
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;
950 virtual CGdiObject *SelectStockObject(
int nIndex);
955 int SelectObject(
CRgn *pRgn);
959 COLORREF GetNearestColor(COLORREF crColor)
const;
961 unsigned int RealizePalette();
963 virtual COLORREF SetBkColor(COLORREF crColor);
964 COLORREF GetBkColor()
const;
965 int SetBkMode(
int nBkMode);
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);
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);
984 CSize GetTextExtent(
const char *lpszString,
int nCount)
const;
986 CSize GetOutputTextExtent(
const char *lpszString,
int nCount)
const;
988 CSize GetTabbedTextExtent(
const char *lpszString,
int nCount,
989 int nTabPositions,
int *lpnTabStopPositions)
const;
991 int nTabPositions,
int *lpnTabStopPositions)
const;
992 CSize GetOutputTabbedTextExtent(
const char *lpszString,
int nCount,
993 int nTabPositions,
int *lpnTabStopPositions)
const;
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);
1012 HWND m_hWnd =
nullptr;
1026 unsigned int nMsg,
unsigned int nCode,
unsigned int nID);
1028 unsigned int nID,
int nCode, AFX_PMSG pfn,
void *pExtra,
1035 static const AFX_MSGMAP *GetThisMessageMap();
1036 virtual const AFX_MSGMAP *GetMessageMap()
const {
1037 return GetThisMessageMap();
1044 virtual void DoWaitCursor(
int nCode);
1045 void BeginWaitCursor();
1046 void EndWaitCursor();
1047 void RestoreWaitCursor();
1049 bool OnCmdMsg(
unsigned int nID,
int nCode,
void *pExtra,
1055 bool m_bContinueRouting =
false;
1066 bool m_bModified =
false;
1067 ViewArray m_viewList;
1070 bool m_bAutoDelete =
true;
1071 bool m_bEmbedded =
false;
1077 void UpdateAllViews(
CView *pSender, LPARAM lHint = 0,
1079 POSITION GetFirstViewPosition();
1080 CView *GetNextView(POSITION &rPosition)
const;
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();
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();
1094 void AddView(
CView *pView);
1095 void RemoveView(
CView *pView);
1098 virtual void DeleteContents();
1100 virtual bool OnNewDocument() {
1103 virtual bool OnOpenDocument(
const char *lpszPathName) {
1106 virtual void OnFileSaveAs() {}
1107 virtual void OnCloseDocument();
1108 virtual void OnChangedViewList();
1109 virtual void PreCloseFrame(
CFrameWnd *pFrame) {}
1110 virtual void UpdateFrameCounts() {}
1112 DECLARE_MESSAGE_MAP()
1117 void * lpCreateParams =
nullptr;
1120 HWND hwndParent = 0;
1126 const char * lpszName =
nullptr;
1127 const char * lpszClass =
nullptr;
1128 uint32 dwExStyle = 0;
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 1142 DECLARE_DYNCREATE(
CWnd)
1145 static const MSG *GetCurrentMessage();
1151 void createDialogIndirect(LPCDLGTEMPLATE dlgTemplate);
1153 DECLARE_MESSAGE_MAP()
1157 CDC *_pDC =
nullptr;
1164 virtual bool OnCommand(WPARAM wParam, LPARAM lParam);
1165 virtual bool OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) {
1168 virtual void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized);
1170 virtual LRESULT DefWindowProc(
unsigned int nMsg, WPARAM wParam, LPARAM lParam) {
1173 virtual void OnSetFont(
CFont *pFont) {
1176 bool OnWndMsg(
unsigned int message, WPARAM wParam, LPARAM lParam, LRESULT *pResult);
1178 afx_msg
void OnActivateApp(
bool bActive, uint32 dwThreadID) {}
1179 afx_msg LRESULT OnActivateTopLevel(WPARAM, LPARAM) {
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) {
1190 afx_msg
HBRUSH OnCtlColor(
CDC *pDC,
CWnd *pWnd,
unsigned int nCtlColor) {
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) {
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) {
1211 afx_msg HCURSOR OnQueryDragIcon() {
1214 afx_msg
bool OnQueryEndSession() {
1217 afx_msg
bool OnQueryOpen() {
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) {}
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() {
1231 afx_msg
bool OnQueryNewPalette();
1234 afx_msg
bool OnNcActivate(
bool bActive) {
1237 afx_msg
bool OnNcCreate(LPCREATESTRUCT lpCreateStruct) {
1240 afx_msg
void OnNcDestroy();
1241 virtual afx_msg
void PostNcDestroy() {}
1242 afx_msg LRESULT OnNcHitTest(
CPoint point) {
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) {}
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) {
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) {
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) {}
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) {
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) {
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) {}
1327 afx_msg
unsigned int OnGetDlgCode() {
1331 afx_msg
int OnCharToItem(
unsigned int nChar,
CListBox *pListBox,
unsigned int nIndex) {
1334 afx_msg
int OnVKeyToItem(
unsigned int nKey,
CListBox *pListBox,
unsigned int nIndex) {
1337 afx_msg
void OnSetFont(
HFONT hFont,
bool bRedraw);
1355 static bool isRecursiveMessage(
unsigned int message);
1360 CWnd *m_hWnd =
nullptr;
1362 CWnd *m_pParentWnd =
nullptr;
1363 int m_nClassStyle = 0;
1365 int _modalResult = DEFAULT_MODAL_RESULT;
1366 bool _hasFocus =
false;
1371 bool _updateErase =
false;
1377 static CWnd *FromHandlePermanent(
HWND hWnd);
1387 static CWnd *FromHandle(
HWND hWnd);
1393 bool Create(
const char *lpszClassName,
const char *lpszWindowName,
1394 uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID,
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);
1414 CWnd *GetParent()
const;
1415 CWnd *GetTopLevelFrame();
1416 HWND GetSafeHwnd()
const;
1418 void ShowWindow(
int nCmdShow);
1419 bool EnableWindow(
bool bEnable =
true);
1420 void UpdateWindow();
1422 LPCRECT lpRectUpdate =
nullptr,
1423 CRgn *prgnUpdate =
nullptr,
1424 unsigned int flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN
1426 void SetActiveWindow();
1428 CWnd *GetFocus()
const;
1429 bool IsWindowVisible()
const {
1430 return (GetStyle() & WS_VISIBLE) != 0;
1432 void DestroyWindow();
1433 void Invalidate(
bool bErase =
true);
1436 virtual bool IsDialogMessage(
LPMSG lpMsg) {
return false; }
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 {
1445 void SetStyle(uint32 nStyle);
1446 bool IsWindowEnabled()
const {
1447 return (_itemState & ODS_DISABLED) == 0;
1449 bool IsActiveWindow()
const;
1452 int ReleaseDC(
CDC *pDC);
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);
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;
1476 void MoveWindow(
LPCRECT lpRect,
bool bRepaint =
true);
1477 void MoveWindow(
int x,
int y,
int nWidth,
int nHeight,
1478 bool bRepaint =
true);
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;
1492 uintptr SetTimer(uintptr nIDEvent,
unsigned int nElapse,
1493 void (CALLBACK *lpfnTimer)(
HWND,
unsigned int, uintptr, uint32) =
nullptr);
1494 bool KillTimer(uintptr nIDEvent);
1496 virtual bool PreTranslateMessage(
MSG *pMsg) {
1499 virtual int GetScrollPos()
const {
1502 int GetScrollPosition()
const {
1503 return GetScrollPos();
1505 virtual int SetScrollPos(
int nPos,
bool bRedraw =
true) {
1508 virtual void GetScrollRange(
int *lpMinPos,
int *lpMaxPos)
const {}
1509 void GetScrollRange(
int ,
int *lpMinPos,
int *lpMaxPos)
const {
1510 GetScrollRange(lpMinPos, lpMaxPos);
1512 virtual void SetScrollRange(
int nMinPos,
int nMaxPos,
bool bRedraw) {}
1515 void ReleaseCapture();
1520 bool IsWindowDirty()
const {
1521 return !_updateRect.
isEmpty();
1524 HFONT GetFont()
const {
1527 void SetFont(
CFont *pFont,
bool bRedraw =
true);
1537 unsigned int m_nIDHelp = 0;
1538 CView *m_pViewActive =
nullptr;
1540 void ActivateFrame(
int nCmdShow);
1541 void OnUpdateFrameTitle(
bool bAddToTitle);
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;
1553 enum RepositionFlags {
1554 reposDefault = 0, reposQuery = 1, reposExtra = 2, reposNoPosLeftOver = 0x8000
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 1566 DECLARE_MESSAGE_MAP()
1572 bool Create(
const char *lpszClassName,
1573 const char *lpszWindowName,
1576 CWnd *pParentWnd =
nullptr,
1577 const char *lpszMenuName =
nullptr,
1578 uint32 dwExStyle = 0,
1580 bool Create(
const char *lpszClassName,
const char *lpszWindowName,
1581 uint32 dwStyle = WS_OVERLAPPEDWINDOW) {
1583 return Create(lpszClassName, lpszWindowName, dwStyle, rectDefault);
1586 HMENU GetMenu()
const;
1587 void RecalcLayout(
bool bNotify =
true);
1588 void InitialUpdateFrame(
CDocument *pDoc,
bool bMakeVisible);
1590 bool LoadFrame(
unsigned int nIDResource, uint32 dwDefaultStyle,
1593 CView *GetActiveView()
const;
1594 void SetActiveView(
CView *pViewNew,
bool bNotify =
true);
1595 void OnSetFocus(
CWnd *pOldWnd);
1604 const char *m_lpszTemplateName =
nullptr;
1605 unsigned int m_nIDHelp = 0;
1606 LPCDLGTEMPLATE m_lpDialogTemplate =
nullptr;
1607 HGLOBAL m_hDialogTemplate = 0;
1611 void SetParent(
CWnd *wnd);
1612 bool CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd *pParentWnd,
1614 bool CreateIndirect(HGLOBAL hDialogTemplate,
CWnd *pParentWnd,
1616 bool CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
1618 CButton *GetDefaultPushButton()
const;
1620 bool handleEnterKey(
LPMSG lpMsg);
1621 bool handleEscapeKey(
LPMSG lpMsg);
1622 void sendButtonClicked(
CButton *btn);
1625 DECLARE_MESSAGE_MAP()
1627 virtual void OnOK();
1628 virtual void OnCancel();
1629 virtual void PostModal() {
1632 void OnSysChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1633 void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized)
override;
1637 explicit CDialog(
const char *lpszTemplateName,
1638 CWnd *pParentWnd =
nullptr);
1639 explicit CDialog(
unsigned int nIDTemplate,
1640 CWnd *pParentWnd =
nullptr);
1642 bool Create(
const char *lpszTemplateName,
1643 CWnd *pParentWnd =
nullptr);
1644 bool Create(
unsigned int nIDTemplate,
1645 CWnd *pParentWnd =
nullptr);
1648 virtual void PreInitDialog() {}
1649 virtual bool OnInitDialog() {
1652 bool IsDialogMessage(
LPMSG lpMsg)
override;
1654 uint32 GetDefID()
const;
1655 void SetDefID(
unsigned int nID);
1656 LRESULT HandleInitDialog(WPARAM, LPARAM);
1657 LRESULT HandleSetFont(WPARAM, LPARAM);
1660 int nIDCButton1,
int &value);
1662 int nIDC,
int &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);
1668 int nIDC,
bool value);
1670 int value,
int nMin,
int nMax);
1673 void EndDialog(
int nResult);
1675 bool UpdateData(
bool bSaveAndValidate =
true);
1682 DECLARE_MESSAGE_MAP()
1693 bool _pressed =
false;
1695 void OnPushButtonPaint();
1696 void OnPushBoxPaint();
1697 void OnOwnerDrawPaint();
1700 DECLARE_MESSAGE_MAP()
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);
1712 CVIRTUAL
bool Create(
const char *lpszCaption, uint32 dwStyle,
1713 const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1715 int GetCheck()
const;
1716 void SetCheck(
int nCheck);
1717 void SetButtonStyle(
unsigned int nStyle,
bool bRedraw =
true);
1718 unsigned int GetButtonStyle()
const;
1725 DECLARE_MESSAGE_MAP()
1740 DECLARE_DYNAMIC(
CEdit)
1743 size_t _maxLength = 0;
1744 bool _cursorVisible =
false;
1747 DECLARE_MESSAGE_MAP()
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);
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();
1770 int _maxValue = 100;
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);
1781 DECLARE_MESSAGE_MAP()
1783 void OnLButtonDown(
unsigned int nFlags,
CPoint point);
1784 void OnLButtonUp(
unsigned int nFlags,
CPoint point);
1785 void OnMouseMove(
unsigned int,
CPoint point);
1789 CVIRTUAL
bool Create(uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
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);
1800 DECLARE_DYNAMIC(
CView)
1803 virtual bool PreCreateWindow(
CREATESTRUCT &cCs)
override;
1804 virtual void OnDraw(
CDC *pDC) {}
1808 DECLARE_MESSAGE_MAP()
1817 int OnCreate(LPCREATESTRUCT lpcs);
1819 void PostNcDestroy()
override;
1821 void OnInitialUpdate();
1822 virtual void OnUpdate(
CView *pSender, LPARAM ,
CObject * );
1823 virtual void OnActivateView(
bool,
CView *,
CView *) {}
1824 virtual void OnActivateFrame(
unsigned int nState,
CFrameWnd *pFrameWnd) {}
1827 return dynamic_cast<CFrameWnd *
>(m_pParentWnd);
1838 static const SIZE sizeNull;
1841 DECLARE_MESSAGE_MAP()
1847 void SetScrollSizes(
1850 const SIZE &sizePage = sizeNull,
1851 const SIZE &sizeLine = sizeNull
1861 unsigned int m_nIDResource = 0;
1867 DECLARE_MESSAGE_MAP()
1886 virtual CDocument *OpenDocumentFile(
const char *lpszPathName,
1887 bool bMakeVisible =
true) = 0;
1890 virtual void SetDefaultTitle(
CDocument *pDocument) = 0;
1892 bool bMakeVisible =
true);
1894 virtual void AddDocument(
CDocument *pDoc);
1895 virtual void RemoveDocument(
CDocument *pDoc);
1896 virtual void CloseAllDocuments(
bool bEndSession);
1897 virtual POSITION GetFirstDocPosition()
const = 0;
1898 virtual CDocument *GetNextDoc(POSITION &rPos)
const = 0;
1900 void LoadTemplate();
1909 DECLARE_MESSAGE_MAP()
1913 unsigned int nIDResource,
1918 pFrameClass, pViewClass) {
1927 CDocument *OpenDocumentFile(
const char *lpszPathName,
1928 bool bMakeVisible =
true)
override;
1929 void AddDocument(
CDocument *pDoc)
override;
1931 void SetDefaultTitle(
CDocument *pDocument)
override;
1933 POSITION GetFirstDocPosition()
const override;
1934 CDocument *GetNextDoc(POSITION &rPos)
const override;
1941 CTemplateList pStaticList;
1942 bool bStaticInit =
false;
1945 CTemplateList m_templateList;
1952 virtual void CloseAllDocuments(
bool bEndSession);
1976 int m_nWaitCursorCount = 0;
1977 HCURSOR m_hcurWaitCursorRestore =
nullptr;
1978 HCURSOR _currentCursor =
nullptr;
1985 virtual bool InitInstance();
1986 virtual int ExitInstance();
1990 int m_nCmdShow = SW_SHOWNORMAL;
1991 const char *m_lpCmdLine =
"";
1992 CWnd *m_pMainWnd =
nullptr;
1998 MSG _currentMessage;
2002 CWinApp(
const char *appName =
nullptr);
2010 virtual bool InitApplication();
2011 virtual bool SaveAllModified();
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();
2025 void DoWaitCursor(
int nCode)
override;
2028 void CloseAllDocuments(
bool bEndSession);
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);
2040 virtual void OnFileNew();
2041 virtual void OnFileOpen();
2042 virtual void OnFilePrintSetup() {}
2047 void AfxUnlockTempMaps();
2050 void setDirectory(
const char *folder);
2052 byte getColor(COLORREF color)
const;
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);
2078 int addFontResource(
const char *fontName) {
2079 return _fonts.addFontResource(fontName);
2081 bool removeFontResource(
const char *fontName) {
2082 return _fonts.removeFontResource(fontName);
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,
2095 HFONT getFont(
const char *lpszFacename,
int nHeight);
2096 HFONT getDefaultFont() {
2097 assert(_defaultFont.m_hObject);
2098 return (
HFONT)_defaultFont.m_hObject;
2100 HPEN getDefaultPen()
const {
2101 assert(_defaultPen.m_hObject);
2102 return (
HPEN)_defaultPen.m_hObject;
2104 HBRUSH getDefaultBrush() {
2105 assert(_defaultBrush.m_hObject);
2106 return (
HBRUSH)_defaultBrush.m_hObject;
2108 HPALETTE getCurrentPalette()
const {
2109 assert(_currentPalette.m_hObject);
2110 return (
HPALETTE)_currentPalette.m_hObject;
2112 HPALETTE getSystemDefaultPalette()
const {
2113 assert(_systemPalette.m_hObject);
2114 return (
HPALETTE)_systemPalette.m_hObject;
2117 const char *AfxRegisterWndClass(
unsigned int nClassStyle,
2118 HCURSOR hCursor,
HBRUSH hbrBackground, HICON hIcon);
2120 const char * lpClassName,
LPWNDCLASS lpWndClass);
Definition: afxwin.h:1903
Definition: event_loop.h:72
Definition: afxwin.h:1141
Definition: minwindef.h:292
Definition: afxwin.h:1116
Definition: afxwin.h:1532
Definition: minwindef.h:153
Definition: afxwin.h:1053
Definition: minwindef.h:279
Definition: afxwin.h:1599
Definition: minwindef.h:166
Definition: minwindef.h:239
Definition: afxwin.h:1732
Definition: surface.h:631
Definition: text_render.h:36
Definition: afxwin.h:1959
Definition: dialog_template.h:55
void removeResources(const Common::Path &file)
Definition: atltypes.h:40
Definition: afxwin.h:1966
Definition: afxwin.h:1799
Definition: minwindef.h:251
Definition: afxwin.h:1957
Definition: settings.h:33
Definition: minwindef.h:161
Definition: minwindef.h:179
Definition: afxwin.h:1721
CString m_strDocStrings
Definition: afxwin.h:1878
Definition: afxwin.h:1858
Definition: afxwin.h:1061
void addResources(const Common::Path &file)
Definition: afxwin.h:2061
Definition: formatinfo.h:28
bool isEmpty() const
Definition: rect.h:373
Definition: minwindef.h:151
Definition: resources.h:60
Definition: afxwin.h:1678
Definition: afxwin.h:1007
Definition: minwindef.h:87
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: afxwin.h:1019
Definition: afxwin.h:1739
Definition: atltypes.h:131
Definition: afxwin.h:1939
Simple class for handling a palette data.
Definition: palette.h:61
Definition: atltypes.h:79
void addResources(const Common::Path &file)