22 #ifndef BAGEL_MFC_AFXWIN_H 23 #define BAGEL_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 "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" 50 constexpr uint32 DEFAULT_MODAL_RESULT =
MKTAG(
'S',
'C',
'V',
'M');
81 bool CreatePopupMenu();
82 bool LoadMenu(
const char *lpszResourceName);
83 bool LoadMenu(
unsigned int nIDResource);
84 bool LoadMenuIndirect(
const void *lpMenuTemplate);
87 static CMenu *FromHandle(HMENU hMenu);
89 unsigned int CheckMenuItem(
unsigned int nIDCheckItem,
unsigned int nCheck);
104 AfxSig_b_W_COPYDATASTRUCT,
107 AfxSig_CTLCOLOR_REFLECT,
142 AfxSig_SCROLL_REFLECT,
149 AfxSig_v_b_NCCALCSIZEPARAMS,
150 AfxSig_v_v_WINDOWPOS,
173 AfxSig_u_v_MENUGETOBJECTINFO,
175 AfxSig_v_u_LPMDINEXTMENU,
179 AfxSig_MOUSE_XBUTTON,
180 AfxSig_MOUSE_NCXBUTTON,
181 AfxSig_INPUTLANGCHANGE,
183 AfxSig_INPUTDEVICECHANGE,
195 AfxSig_bD = AfxSig_b_D_v,
196 AfxSig_bb = AfxSig_b_b_v,
197 AfxSig_bWww = AfxSig_b_W_uu,
198 AfxSig_hDWw = AfxSig_CTLCOLOR,
199 AfxSig_hDw = AfxSig_CTLCOLOR_REFLECT,
200 AfxSig_iwWw = AfxSig_i_u_W_u,
201 AfxSig_iww = AfxSig_i_uu_v,
202 AfxSig_iWww = AfxSig_i_W_uu,
203 AfxSig_is = AfxSig_i_v_s,
204 AfxSig_lwl = AfxSig_l_w_l,
205 AfxSig_lwwM = AfxSig_l_uu_M,
206 AfxSig_vv = AfxSig_v_v_v,
208 AfxSig_vw = AfxSig_v_u_v,
209 AfxSig_vww = AfxSig_v_u_u,
210 AfxSig_vww2 = AfxSig_v_uu_v,
211 AfxSig_vvii = AfxSig_v_v_ii,
212 AfxSig_vwww = AfxSig_v_u_uu,
213 AfxSig_vwii = AfxSig_v_u_ii,
214 AfxSig_vwl = AfxSig_v_w_l,
215 AfxSig_vbWW = AfxSig_MDIACTIVATE,
216 AfxSig_vD = AfxSig_v_D_v,
217 AfxSig_vM = AfxSig_v_M_v,
218 AfxSig_vMwb = AfxSig_v_M_ub,
220 AfxSig_vW = AfxSig_v_W_v,
221 AfxSig_vWww = AfxSig_v_W_uu,
222 AfxSig_vWp = AfxSig_v_W_p,
223 AfxSig_vWh = AfxSig_v_W_h,
224 AfxSig_vwW = AfxSig_v_u_W,
225 AfxSig_vwWb = AfxSig_ACTIVATE,
226 AfxSig_vwwW = AfxSig_SCROLL,
227 AfxSig_vwwx = AfxSig_SCROLL_REFLECT,
228 AfxSig_vs = AfxSig_v_v_s,
229 AfxSig_vOWNER = AfxSig_OWNERDRAW,
230 AfxSig_iis = AfxSig_i_i_s,
231 AfxSig_wp = AfxSig_u_v_p,
232 AfxSig_wv = AfxSig_u_v_v,
233 AfxSig_vPOS = AfxSig_v_v_WINDOWPOS,
234 AfxSig_vCALC = AfxSig_v_b_NCCALCSIZEPARAMS,
235 AfxSig_vNMHDRpl = AfxSigNotify_v,
236 AfxSig_bNMHDRpl = AfxSigNotify_b,
237 AfxSig_vwNMHDRpl = AfxSigNotify_RANGE,
238 AfxSig_bwNMHDRpl = AfxSigNotify_EX,
239 AfxSig_bHELPINFO = AfxSig_b_v_HELPINFO,
240 AfxSig_vwSIZING = AfxSig_SIZING,
243 AfxSig_cmdui = AfxSigCmdUI,
244 AfxSig_cmduiw = AfxSigCmdUI_RANGE,
245 AfxSig_vpv = AfxSigCmd_v_pv,
246 AfxSig_bpv = AfxSigCmd_b_pv,
249 AfxSig_vwwh = AfxSig_v_uu_M,
250 AfxSig_vwp = AfxSig_v_u_p,
251 AfxSig_bw = AfxSig_b_u_v,
252 AfxSig_bh = AfxSig_b_h_v,
253 AfxSig_iw = AfxSig_i_u_v,
254 AfxSig_ww = AfxSig_u_u_v,
255 AfxSig_bv = AfxSig_b_v_v,
256 AfxSig_hv = AfxSig_C_v_v,
257 AfxSig_vb = AfxSig_vw,
258 AfxSig_vbh = AfxSig_v_b_h,
259 AfxSig_vbw = AfxSig_vww,
260 AfxSig_vhh = AfxSig_v_h_h,
261 AfxSig_vh = AfxSig_v_h_v,
262 AfxSig_viSS = AfxSig_vwl,
263 AfxSig_bwl = AfxSig_lwl,
264 AfxSig_vwMOVING = AfxSig_vwSIZING,
266 AfxSig_vW2 = AfxSig_v_v_W,
267 AfxSig_bWCDS = AfxSig_b_W_COPYDATASTRUCT,
268 AfxSig_bwsp = AfxSig_MOUSEWHEEL,
269 AfxSig_vws = AfxSig_v_u_cs,
273 #define CN_COMMAND 0 // void () 274 #define CN_UPDATE_COMMAND_UI ((unsigned int)(-1)) // void (CCmdUI*) 275 #define CN_EVENT ((unsigned int)(-2)) // OLE event 276 #define CN_OLECOMMAND ((unsigned int)(-3)) // OLE document command 277 #define CN_OLE_UNREGISTER ((unsigned int)(-4)) // OLE unregister 284 #define PM_NOREMOVE 0x0000 285 #define PM_REMOVE 0x0001 286 #define PM_NOYIELD 0x0002 289 typedef void (
CWnd::*AFX_PMSGW)();
291 #pragma warning(disable: 4121) 293 unsigned int nMessage;
296 unsigned int nLastID;
300 #pragma warning(default: 4121) 312 typedef void (AFX_MSG_CALL
CCmdTarget:: *AFX_PMSG)();
314 #define DECLARE_MESSAGE_MAP() \ 316 static const AFX_MSGMAP *GetThisMessageMap(); \ 317 const AFX_MSGMAP *GetMessageMap() const override; \ 328 #if defined(__clang__) && defined(__has_warning) 329 # if __has_warning("-Wcast-function-type") 330 # define COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 1 332 #elif GCC_ATLEAST(8, 1) 333 # define COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 1 336 #ifdef COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 337 # define BEGIN_SILENCE_CAST \ 338 _Pragma("GCC diagnostic push") \ 339 _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") 340 # define END_SILENCE_CAST \ 341 _Pragma("GCC diagnostic pop") 342 # undef COMPILER_HAS_CAST_FUNCTION_TYPE_WARNING 344 # define BEGIN_SILENCE_CAST 345 # define END_SILENCE_CAST 348 #define BEGIN_TEMPLATE_MESSAGE_MAP(theClass, type_name, baseClass) \ 349 template < typename type_name > \ 350 const AFX_MSGMAP *theClass< type_name >::GetMessageMap() const \ 351 { return GetThisMessageMap(); } \ 352 template < typename type_name > \ 353 const AFX_MSGMAP *theClass< type_name >::GetThisMessageMap() { \ 354 typedef theClass< type_name > ThisClass; \ 355 typedef baseClass TheBaseClass; \ 357 static const AFX_MSGMAP_ENTRY _messageEntries[] = \ 360 #define BEGIN_MESSAGE_MAP(theClass, baseClass) \ 361 const AFX_MSGMAP *theClass::GetMessageMap() const \ 362 { return GetThisMessageMap(); } \ 363 const AFX_MSGMAP *theClass::GetThisMessageMap() { \ 364 typedef theClass ThisClass; \ 365 typedef baseClass TheBaseClass; \ 366 { ThisClass *dummy; (void)dummy; } \ 368 static const AFX_MSGMAP_ENTRY _messageEntries[] = \ 371 #define END_MESSAGE_MAP() \ 372 { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)nullptr } \ 375 static const AFX_MSGMAP messageMap = \ 376 { &TheBaseClass::GetThisMessageMap, &_messageEntries[0] }; \ 377 return &messageMap; \ 380 #define DECLARE_DYNCREATE(class_name) \ 381 DECLARE_DYNAMIC(class_name) \ 382 static CObject *CreateObject(); 389 void (AFX_MSG_CALL
CCmdTarget:: *pfn_COMMAND)();
390 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_bCOMMAND)();
391 void (AFX_MSG_CALL
CCmdTarget:: *pfn_COMMAND_RANGE)(
unsigned int);
392 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_COMMAND_EX)(
unsigned int);
395 void (AFX_MSG_CALL
CCmdTarget:: *pfn_UPDATE_COMMAND_UI_RANGE)(
CCmdUI *,
unsigned int);
396 void (AFX_MSG_CALL
CCmdTarget:: *pfn_OTHER)(
void *);
397 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_OTHER_EX)(
void *);
401 void (AFX_MSG_CALL
CCmdTarget:: *pfn_NOTIFY_RANGE)(
unsigned int,
NMHDR *, LRESULT *);
402 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_NOTIFY_EX)(
unsigned int, NMHDR *, LRESULT *);
406 void (AFX_MSG_CALL
CWinThread:: *pfn_THREAD)(WPARAM, LPARAM);
409 bool(AFX_MSG_CALL
CWnd:: *pfn_bD)(
CDC *);
410 bool(AFX_MSG_CALL
CWnd:: *pfn_bb)(bool);
411 bool(AFX_MSG_CALL
CWnd:: *pfn_bWww)(
CWnd *,
unsigned int,
unsigned int);
415 HBRUSH(AFX_MSG_CALL CWnd:: *pfn_hDw)(
CDC *,
unsigned int);
416 int (AFX_MSG_CALL CWnd:: *pfn_iwWw)(
unsigned int, CWnd *,
unsigned int);
417 int (AFX_MSG_CALL CWnd:: *pfn_iww)(
unsigned int,
unsigned int);
418 int (AFX_MSG_CALL CWnd:: *pfn_iWww)(CWnd *,
unsigned int,
unsigned int);
419 int (AFX_MSG_CALL CWnd:: *pfn_is)(uint16 *);
420 LRESULT(AFX_MSG_CALL CWnd:: *pfn_lwl)(WPARAM, LPARAM);
421 LRESULT(AFX_MSG_CALL CWnd:: *pfn_lwwM)(
unsigned int,
unsigned int,
CMenu *);
422 void (AFX_MSG_CALL CWnd:: *pfn_vv)();
424 void (AFX_MSG_CALL CWnd:: *pfn_vw)(
unsigned int);
425 void (AFX_MSG_CALL CWnd:: *pfn_vww)(
unsigned int,
unsigned int);
426 void (AFX_MSG_CALL CWnd:: *pfn_vvii)(int, int);
427 void (AFX_MSG_CALL CWnd:: *pfn_vwww)(
unsigned int,
unsigned int,
unsigned int);
428 void (AFX_MSG_CALL CWnd:: *pfn_vwii)(
unsigned int, int, int);
429 void (AFX_MSG_CALL CWnd:: *pfn_vwl)(WPARAM, LPARAM);
430 void (AFX_MSG_CALL CWnd:: *pfn_vbWW)(bool, CWnd *, CWnd *);
431 void (AFX_MSG_CALL CWnd:: *pfn_vD)(
CDC *);
432 void (AFX_MSG_CALL CWnd:: *pfn_vM)(
CMenu *);
433 void (AFX_MSG_CALL CWnd:: *pfn_vMwb)(
CMenu *,
unsigned int, bool);
435 void (AFX_MSG_CALL CWnd:: *pfn_vW)(CWnd *);
436 void (AFX_MSG_CALL CWnd:: *pfn_vWww)(CWnd *,
unsigned int,
unsigned int);
437 void (AFX_MSG_CALL CWnd:: *pfn_vWp)(CWnd *,
CPoint);
438 void (AFX_MSG_CALL CWnd:: *pfn_vWh)(CWnd *, HANDLE);
439 void (AFX_MSG_CALL CWnd:: *pfn_vwW)(
unsigned int, CWnd *);
440 void (AFX_MSG_CALL CWnd:: *pfn_vwWb)(
unsigned int, CWnd *, bool);
441 void (AFX_MSG_CALL CWnd:: *pfn_vwwW)(
unsigned int,
unsigned int, CWnd *);
442 void (AFX_MSG_CALL CWnd:: *pfn_vwwx)(
unsigned int,
unsigned int);
443 void (AFX_MSG_CALL CWnd:: *pfn_vs)(uint16 *);
444 void (AFX_MSG_CALL CWnd:: *pfn_vOWNER)(int, uint16 *);
445 int (AFX_MSG_CALL CWnd:: *pfn_iis)(int, uint16 *);
446 unsigned int(AFX_MSG_CALL CWnd:: *pfn_wp)(
CPoint);
447 bool(AFX_MSG_CALL CWnd:: *pfn_bv)();
448 unsigned int(AFX_MSG_CALL CWnd:: *pfn_wv)();
449 void (AFX_MSG_CALL CWnd:: *pfn_vPOS)(
WINDOWPOS *);
451 void (AFX_MSG_CALL CWnd:: *pfn_vwp)(
unsigned int,
CPoint);
452 void (AFX_MSG_CALL CWnd:: *pfn_vwwh)(
unsigned int,
unsigned int, HANDLE);
453 bool(AFX_MSG_CALL CWnd:: *pfn_bwsp)(
unsigned int, short,
CPoint);
454 void (AFX_MSG_CALL CWnd:: *pfn_vws)(
unsigned int,
const char *);
455 void (AFX_MSG_CALL CWnd:: *pfn_vFb)(
HFONT, bool);
462 bool IsStoring()
const {
480 CView *m_pLastView =
nullptr;
506 bool _permanent =
false;
509 void AfxHookObject();
510 void AfxUnhookObject();
529 bool operator==(
const CGdiObject &obj)
const {
530 return obj.m_hObject == m_hObject;
532 bool operator!=(
const CGdiObject &obj)
const {
533 return obj.m_hObject != m_hObject;
546 Impl(
int nPenStyle,
int nWidth, COLORREF crColor) :
547 _penStyle(nPenStyle), _width(nWidth),
553 return (
Impl *)m_hObject;
558 CPen(
int nPenStyle,
int nWidth, COLORREF crColor);
561 bool CreatePen(
int nPenStyle,
int nWidth, COLORREF crColor);
571 Impl(COLORREF crColor);
572 Impl(
int nIndex, COLORREF crColor);
576 byte getColor()
const;
579 Impl *brush()
const {
580 return (
Impl *)m_hObject;
585 return (
CBrush *)CGdiObject::FromHandle(h);
592 CBrush(
int nIndex, COLORREF crColor);
596 bool CreateSolidBrush(COLORREF crColor);
597 bool CreateBrushIndirect(
const LOGBRUSH *lpLogBrush);
598 bool CreateStockObject(
int nIndex);
615 return (
Impl *)m_hObject;
620 return (
CFont *)CGdiObject::FromHandle(h);
626 bool CreateFont(
int nHeight,
int nWidth,
int nEscapement,
627 int nOrientation,
int nWeight, byte bItalic, byte bUnderline,
628 byte cStrikeOut, byte nCharSet, byte nOutPrecision,
629 byte nClipPrecision, byte nQuality, byte nPitchAndFamily,
630 const char *lpszFacename);
631 bool CreateFontIndirect(
const LOGFONT *lpLogFont);
641 Impl *bitmap()
const {
642 return (
Impl *)m_hObject;
647 return (
CBitmap *)CGdiObject::FromHandle(h);
656 bool CreateCompatibleBitmap(
CDC *pDC,
int nWidth,
int nHeight);
657 bool CreateBitmap(
int nWidth,
int nHeight,
unsigned int nPlanes,
658 unsigned int nBitcount,
const void *lpBits);
659 int GetObject(
int nCount,
void *lpObject)
const;
660 long GetBitmapBits(
long dwCount,
void *lpBits)
const;
661 bool GetBitmap(
BITMAP *pBitMap)
const {
662 return GetObject(
sizeof(
BITMAP), pBitMap);
675 Impl *palette()
const {
676 return (
Impl *)m_hObject;
681 return (
CPalette *)CGdiObject::FromHandle(h);
689 int GetObject(
int nCount,
void *lpObject)
const;
690 unsigned int GetEntryCount()
const;
691 unsigned int GetPaletteEntries(
unsigned int nStartIndex,
unsigned int nNumEntries,
693 unsigned int SetPaletteEntries(
unsigned int nStartIndex,
unsigned int nNumEntries,
696 bool AnimatePalette(
unsigned int nStartIndex,
unsigned int nNumEntries,
698 unsigned int GetNearestPaletteIndex(COLORREF crColor);
699 bool isEmpty()
const {
700 return !palette() || palette()->empty();
708 int _polyFillMode = 0;
714 bool CreateRectRgn(
int x1,
int y1,
int x2,
int y2);
715 bool CreateRectRgnIndirect(
LPCRECT lpRect);
716 bool CreatePolygonRgn(
const POINT *lpPoints,
717 int nCount,
int nPolyFillMode);
721 DECLARE_DYNCREATE(
CDC)
725 bool _permanent =
false;
726 int _stretchMode = STRETCH_ANDSCANS;
729 void AfxHookObject();
730 void AfxUnhookObject();
741 CWnd *m_pWnd =
nullptr;
744 COLORREF _bkColor = RGB(255, 255, 255);
745 int _bkMode = TRANSPARENT;
746 COLORREF _textColor = 0;
747 uint _textAlign = TA_LEFT;
749 bool _paletteRealized =
false;
751 uint getPenColor()
const;
752 uint getBrushColor()
const;
753 uint32 *getPaletteMap(
const CDC::Impl *srcImpl);
762 bool m_bForceBackground =
false;
763 bool _hasLogicalPalette =
false;
773 void setScreenRect();
778 unsigned int realizePalette();
779 COLORREF GetNearestColor(COLORREF crColor)
const;
781 void fillSolidRect(
LPCRECT lpRect, COLORREF clr);
782 void fillSolidRect(
int x,
int y,
int cx,
int cy, COLORREF clr);
786 void frameRgn(
const CRgn *pRgn,
CBrush *brush,
int nWidth,
int nHeight);
787 void floodFill(
int x,
int y, COLORREF crColor);
788 void floodFill(
int x,
int y, COLORREF crColor,
789 unsigned int nFillType);
790 void rectangle(
LPCRECT lpRect);
791 void rectangle(
int x1,
int y1,
int x2,
int y2);
792 void draw3dRect(
const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
793 void drawFocusRect(
const CRect &rect);
797 void ellipse(
int x1,
int y1,
int x2,
int y2);
799 void bitBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
800 int xSrc,
int ySrc, uint32 dwRop);
801 void stretchBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
802 int xSrc,
int ySrc,
int nSrcWidth,
int nSrcHeight, uint32 dwRop);
804 void moveTo(
int x,
int y);
805 void lineTo(
int x,
int y);
806 COLORREF getPixel(
int x,
int y)
const;
807 int setROP2(
int nDrawMode);
810 COLORREF setBkColor(COLORREF crColor);
811 COLORREF getBkColor()
const;
812 COLORREF getBkPixel()
const;
813 int setBkMode(
int nBkMode);
814 COLORREF setTextColor(COLORREF crColor);
815 bool textOut(
int x,
int y,
const char *lpszString,
int nCount,
816 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
817 int nTabOrigin = 0,
CSize *size =
nullptr);
818 bool textOut(
int x,
int y,
const CString &str,
819 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
820 int nTabOrigin = 0,
CSize *size =
nullptr);
821 bool extTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
822 const char *lpszString,
unsigned int nCount,
int *lpDxWidths);
823 bool extTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
824 const CString &str,
int *lpDxWidths);
825 CSize tabbedTextOut(
int x,
int y,
const char *lpszString,
int nCount,
826 int nTabPositions,
const int *lpnTabStopPositions,
int nTabOrigin);
828 int nTabPositions,
const int *lpnTabStopPositions,
int nTabOrigin);
830 int drawText(
const char *lpszString,
int nCount,
LPRECT lpRect,
unsigned int nFormat,
831 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
832 int nTabOrigin = 0,
CSize *size =
nullptr);
833 int drawText(
const CString &str,
LPRECT lpRect,
unsigned int nFormat,
834 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
835 int nTabOrigin = 0,
CSize *size =
nullptr);
837 CSize getTextExtent(
const char *lpszString,
int nCount)
const;
839 CSize getOutputTextExtent(
const char *lpszString,
int nCount)
const;
841 CSize getTabbedTextExtent(
const char *lpszString,
int nCount,
842 int nTabPositions,
int *lpnTabStopPositions)
const;
844 int nTabPositions,
int *lpnTabStopPositions)
const;
845 CSize getOutputTabbedTextExtent(
const char *lpszString,
int nCount,
846 int nTabPositions,
int *lpnTabStopPositions)
const;
848 int nTabPositions,
int *lpnTabStopPositions)
const;
849 bool grayString(
CBrush *pBrush,
850 bool(CALLBACK *lpfnOutput)(HDC, LPARAM,
int), LPARAM lpData,
851 int nCount,
int x,
int y,
int nWidth,
int nHeight);
852 unsigned int getTextAlign()
const;
853 unsigned int setTextAlign(
unsigned int nFlags);
860 static CDC *FromHandle(HDC hDC);
865 operator HDC()
const {
869 return static_cast<Impl *
>(m_hDC);
872 bool CreateDC(
const char *lpszDriverName,
const char *lpszDeviceName,
873 const char *lpszOutput,
const void *lpInitData);
874 bool CreateCompatibleDC(
CDC *pDC);
876 bool Attach(HDC hDC);
878 int SetStretchBltMode(
int nStretchMode);
879 int GetDeviceCaps(
int nIndex)
const;
882 int GetMapMode()
const;
883 CPoint GetViewportOrg()
const;
884 virtual int SetMapMode(
int nMapMode);
886 virtual CPoint SetViewportOrg(
int x,
int y);
888 virtual CPoint OffsetViewportOrg(
int nWidth,
int nHeight);
891 virtual int GetClipBox(
LPRECT lpRect)
const;
893 void resetClipRect();
894 virtual bool PtVisible(
int x,
int y);
895 bool PtVisible(
POINT point);
896 virtual bool RectVisible(
LPCRECT lpRect);
897 int SelectClipRgn(
CRgn *pRgn);
898 int ExcludeClipRect(
int x1,
int y1,
int x2,
int y2);
899 int ExcludeClipRect(
LPCRECT lpRect);
900 int ExcludeUpdateRgn(
CWnd *pWnd);
901 int IntersectClipRect(
int x1,
int y1,
int x2,
int y2);
902 int IntersectClipRect(
LPCRECT lpRect);
903 int OffsetClipRgn(
int x,
int y);
904 int OffsetClipRgn(
SIZE size);
905 int SelectClipRgn(
CRgn *pRgn,
int nMode);
907 int SetROP2(
int nDrawMode);
908 bool DPtoLP(
LPPOINT lpPoints,
int nCount = 1);
909 bool DPtoLP(
RECT *lpRect);
910 bool LPtoDP(
LPPOINT lpPoints,
int nCount = 1);
911 bool LPtoDP(
RECT *lpRect);
912 bool BitBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
913 int xSrc,
int ySrc, uint32 dwRop);
914 bool StretchBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
915 int xSrc,
int ySrc,
int nSrcWidth,
int nSrcHeight, uint32 dwRop);
917 void Ellipse(
int x1,
int y1,
int x2,
int y2);
919 void Draw3dRect(
const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
920 void DrawFocusRect(
const CRect &rect);
922 void FillSolidRect(
LPCRECT lpRect, COLORREF crColor);
923 bool FloodFill(
int x,
int y, COLORREF crColor);
924 bool FloodFill(
int x,
int y, COLORREF crColor,
925 unsigned int nFillType);
926 void Rectangle(
LPCRECT lpRect);
927 void Rectangle(
int x1,
int y1,
int x2,
int y2);
928 bool DrawEdge(
LPRECT lpRect,
unsigned int nEdge,
unsigned int nFlags);
938 const POINT &ptStart,
942 int nWidth,
int nHeight);
944 void MoveTo(
int x,
int y);
945 void LineTo(
int x,
int y);
946 COLORREF GetPixel(
int x,
int y)
const;
947 COLORREF GetPixel(
const POINT &point)
const;
949 virtual CGdiObject *SelectStockObject(
int nIndex);
954 int SelectObject(
CRgn *pRgn);
958 COLORREF GetNearestColor(COLORREF crColor)
const;
960 unsigned int RealizePalette();
962 virtual COLORREF SetBkColor(COLORREF crColor);
963 COLORREF GetBkColor()
const;
964 int SetBkMode(
int nBkMode);
967 virtual COLORREF SetTextColor(COLORREF crColor);
968 virtual bool TextOut(
int x,
int y,
const char *lpszString,
int nCount);
969 bool TextOut(
int x,
int y,
const CString &str);
970 virtual bool ExtTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
971 const char *lpszString,
unsigned int nCount,
int *lpDxWidths);
972 bool ExtTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
973 const CString &str,
int *lpDxWidths);
974 virtual CSize TabbedTextOut(
int x,
int y,
const char *lpszString,
int nCount,
975 int nTabPositions,
int *lpnTabStopPositions,
int nTabOrigin);
977 int nTabPositions,
int *lpnTabStopPositions,
int nTabOrigin);
978 int DrawText(
const char *lpszString,
int nCount,
979 LPRECT lpRect,
unsigned int nFormat);
980 int DrawText(
const CString &str,
LPRECT lpRect,
unsigned int nFormat);
983 CSize GetTextExtent(
const char *lpszString,
int nCount)
const;
985 CSize GetOutputTextExtent(
const char *lpszString,
int nCount)
const;
987 CSize GetTabbedTextExtent(
const char *lpszString,
int nCount,
988 int nTabPositions,
int *lpnTabStopPositions)
const;
990 int nTabPositions,
int *lpnTabStopPositions)
const;
991 CSize GetOutputTabbedTextExtent(
const char *lpszString,
int nCount,
992 int nTabPositions,
int *lpnTabStopPositions)
const;
994 int nTabPositions,
int *lpnTabStopPositions)
const;
995 virtual bool GrayString(
CBrush *pBrush,
996 bool(CALLBACK *lpfnOutput)(HDC, LPARAM,
int), LPARAM lpData,
997 int nCount,
int x,
int y,
int nWidth,
int nHeight);
998 unsigned int GetTextAlign()
const;
999 unsigned int SetTextAlign(
unsigned int nFlags);
1011 HWND m_hWnd =
nullptr;
1025 unsigned int nMsg,
unsigned int nCode,
unsigned int nID);
1027 unsigned int nID,
int nCode, AFX_PMSG pfn,
void *pExtra,
1034 static const AFX_MSGMAP *GetThisMessageMap();
1035 virtual const AFX_MSGMAP *GetMessageMap()
const {
1036 return GetThisMessageMap();
1043 virtual void DoWaitCursor(
int nCode);
1044 void BeginWaitCursor();
1045 void EndWaitCursor();
1046 void RestoreWaitCursor();
1048 bool OnCmdMsg(
unsigned int nID,
int nCode,
void *pExtra,
1054 bool m_bContinueRouting =
false;
1065 bool m_bModified =
false;
1066 ViewArray m_viewList;
1069 bool m_bAutoDelete =
true;
1070 bool m_bEmbedded =
false;
1076 void UpdateAllViews(
CView *pSender, LPARAM lHint = 0,
1078 POSITION GetFirstViewPosition();
1079 CView *GetNextView(POSITION &rPosition)
const;
1081 const CString &GetTitle()
const;
1082 virtual void SetTitle(
const char *lpszTitle);
1083 const CString &GetPathName()
const;
1084 virtual void SetPathName(
const char *lpszPathName,
bool bAddToMRU =
true);
1085 virtual void ClearPathName();
1087 virtual bool IsModified();
1088 virtual void SetModifiedFlag(
bool bModified =
true);
1089 virtual void ReportSaveLoadException(
const char *lpszPathName,
1090 CException *e,
bool bSaving,
unsigned int nIDPDefault);
1091 bool SaveModified();
1093 void AddView(
CView *pView);
1094 void RemoveView(
CView *pView);
1097 virtual void DeleteContents();
1099 virtual bool OnNewDocument() {
1102 virtual bool OnOpenDocument(
const char *lpszPathName) {
1105 virtual void OnFileSaveAs() {}
1106 virtual void OnCloseDocument();
1107 virtual void OnChangedViewList();
1108 virtual void PreCloseFrame(
CFrameWnd *pFrame) {}
1109 virtual void UpdateFrameCounts() {}
1111 DECLARE_MESSAGE_MAP()
1116 void * lpCreateParams =
nullptr;
1119 HWND hwndParent = 0;
1125 const char * lpszName =
nullptr;
1126 const char * lpszClass =
nullptr;
1127 uint32 dwExStyle = 0;
1132 #define WF_TOOLTIPS 0x0001 // window is enabled for tooltips 1133 #define WF_TEMPHIDE 0x0002 // window is temporarily hidden 1134 #define WF_STAYDISABLED 0x0004 // window should stay disabled 1135 #define WF_MODALLOOP 0x0008 // currently in modal loop 1136 #define WF_CONTINUEMODAL 0x0010 // modal loop should continue running 1137 #define WF_OLECTLCONTAINER 0x0100 // some descendant is an OLE control 1138 #define WF_TRACKINGTOOLTIPS 0x0400 // window is enabled for tracking tooltips 1141 DECLARE_DYNCREATE(
CWnd)
1144 static const MSG *GetCurrentMessage();
1150 void createDialogIndirect(LPCDLGTEMPLATE dlgTemplate);
1152 DECLARE_MESSAGE_MAP()
1156 CDC *_pDC =
nullptr;
1163 virtual bool OnCommand(WPARAM wParam, LPARAM lParam);
1164 virtual bool OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) {
1167 virtual void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized);
1169 virtual LRESULT DefWindowProc(
unsigned int nMsg, WPARAM wParam, LPARAM lParam) {
1172 virtual void OnSetFont(
CFont *pFont) {
1175 bool OnWndMsg(
unsigned int message, WPARAM wParam, LPARAM lParam, LRESULT *pResult);
1177 afx_msg
void OnActivateApp(
bool bActive, uint32 dwThreadID) {}
1178 afx_msg LRESULT OnActivateTopLevel(WPARAM, LPARAM) {
1181 afx_msg
void OnCancelMode() {}
1182 afx_msg
void OnChildActivate() {}
1183 afx_msg
void OnClose();
1184 afx_msg
void OnContextMenu(
CWnd *pWnd,
CPoint pos) {}
1185 afx_msg
int OnCreate(LPCREATESTRUCT lpCreateStruct) {
1189 afx_msg
HBRUSH OnCtlColor(
CDC *pDC,
CWnd *pWnd,
unsigned int nCtlColor) {
1193 afx_msg
void OnDestroy() {}
1194 afx_msg
void OnEnable(
bool bEnable) {}
1195 afx_msg
void OnEndSession(
bool bEnding) {}
1196 afx_msg
void OnEnterIdle(
unsigned int nWhy,
CWnd *pWho) {}
1197 afx_msg
bool OnEraseBkgnd(
CDC *pDC) {
1200 afx_msg
void OnIconEraseBkgnd(
CDC *pDC) {}
1201 afx_msg
void OnKillFocus(
CWnd *pNewWnd) {}
1202 afx_msg
void OnMenuSelect(
unsigned int nItemID,
unsigned int nFlags, HMENU hSysMenu) {}
1203 afx_msg
void OnMove(
int x,
int y) {}
1204 afx_msg
void OnPaint() {}
1205 afx_msg
void OnSyncPaint() {}
1206 afx_msg
void OnParentNotify(
unsigned int message, LPARAM lParam) {}
1207 afx_msg
unsigned int OnNotifyFormat(
CWnd *pWnd,
unsigned int nCommand) {
1210 afx_msg HCURSOR OnQueryDragIcon() {
1213 afx_msg
bool OnQueryEndSession() {
1216 afx_msg
bool OnQueryOpen() {
1219 afx_msg
void OnSetFocus(
CWnd *pOldWnd) {}
1220 afx_msg
void OnShowWindow(
bool bShow,
unsigned int nStatus);
1221 afx_msg
void OnSize(
unsigned int nType,
int cx,
int cy) {}
1222 afx_msg
void OnTCard(
unsigned int idAction, uint32 dwActionData) {}
1223 afx_msg
void OnSessionChange(
unsigned int nSessionState,
unsigned int nId) {}
1225 afx_msg
void OnChangeUIState(
unsigned int nAction,
unsigned int nUIElement) {}
1226 afx_msg
void OnUpdateUIState(
unsigned int nAction,
unsigned int nUIElement) {}
1227 afx_msg
unsigned int OnQueryUIState() {
1230 afx_msg
bool OnQueryNewPalette();
1233 afx_msg
bool OnNcActivate(
bool bActive) {
1236 afx_msg
bool OnNcCreate(LPCREATESTRUCT lpCreateStruct) {
1239 afx_msg
void OnNcDestroy();
1240 virtual afx_msg
void PostNcDestroy() {}
1241 afx_msg LRESULT OnNcHitTest(
CPoint point) {
1244 afx_msg
void OnNcLButtonDblClk(
unsigned int nHitTest,
CPoint point) {}
1245 afx_msg
void OnNcLButtonDown(
unsigned int nHitTest,
CPoint point) {}
1246 afx_msg
void OnNcLButtonUp(
unsigned int nHitTest,
CPoint point) {}
1247 afx_msg
void OnNcMButtonDblClk(
unsigned int nHitTest,
CPoint point) {}
1248 afx_msg
void OnNcMButtonDown(
unsigned int nHitTest,
CPoint point) {}
1249 afx_msg
void OnNcMButtonUp(
unsigned int nHitTest,
CPoint point) {}
1250 afx_msg
void OnNcMouseHover(
unsigned int nHitTest,
CPoint point) {}
1251 afx_msg
void OnNcMouseLeave() {}
1252 afx_msg
void OnNcMouseMove(
unsigned int nHitTest,
CPoint point) {}
1253 afx_msg
void OnNcPaint() {}
1254 afx_msg
void OnNcRButtonDblClk(
unsigned int nHitTest,
CPoint point) {}
1255 afx_msg
void OnNcRButtonDown(
unsigned int nHitTest,
CPoint point) {}
1256 afx_msg
void OnNcRButtonUp(
unsigned int nHitTest,
CPoint point) {}
1257 afx_msg
void OnNcXButtonDown(
short zHitTest,
unsigned int nButton,
CPoint point) {}
1258 afx_msg
void OnNcXButtonUp(
short zHitTest,
unsigned int nButton,
CPoint point) {}
1259 afx_msg
void OnNcXButtonDblClk(
short zHitTest,
unsigned int nButton,
CPoint point) {}
1262 afx_msg
void OnDropFiles(HDROP hDropInfo) {}
1263 afx_msg
void OnPaletteIsChanging(
CWnd *pRealizeWnd) {}
1264 afx_msg
void OnSysChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1265 afx_msg
void OnSysCommand(
unsigned int nID, LPARAM lParam) {}
1266 afx_msg
void OnSysDeadChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1267 afx_msg
void OnSysKeyDown(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1268 afx_msg
void OnSysKeyUp(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1269 afx_msg
bool OnAppCommand(
CWnd *pWnd,
unsigned int nCmd,
unsigned int nDevice,
unsigned int nKey) {
1272 afx_msg
void OnRawInput(
unsigned int nInputCode, HRAWINPUT hRawInput) {}
1273 afx_msg
void OnCompacting(
unsigned int nCpuTime) {}
1274 afx_msg
void OnDevModeChange(_In_z_ uint16 * lpDeviceName) {}
1275 afx_msg
void OnFontChange() {}
1276 afx_msg
void OnPaletteChanged(
CWnd *pFocusWnd) {}
1277 afx_msg
void OnSpoolerStatus(
unsigned int nStatus,
unsigned int nJobs) {}
1278 afx_msg
void OnSysColorChange() {}
1279 afx_msg
void OnTimeChange() {}
1280 afx_msg
void OnSettingChange(
unsigned int uFlags,
const char *lpszSection) {}
1281 afx_msg
void OnWinIniChange(
const char *lpszSection) {}
1282 afx_msg
unsigned int OnPowerBroadcast(
unsigned int nPowerEvent, LPARAM lEventData) {
1285 afx_msg
void OnUserChanged() {}
1286 afx_msg
void OnInputLangChange(
unsigned int nCharSet,
unsigned int nLocaleId) {}
1287 afx_msg
void OnInputLangChangeRequest(
unsigned int nFlags,
unsigned int nLocaleId) {}
1288 afx_msg
void OnInputDeviceChange(
unsigned short nFlags, HANDLE hDevice) {}
1291 afx_msg
void OnChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1292 afx_msg
void OnDeadChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1293 afx_msg
void OnUniChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1294 afx_msg
void OnHScroll(
unsigned int nSBCode,
unsigned int nPos,
CScrollBar *pScrollBar) {}
1295 afx_msg
void OnVScroll(
unsigned int nSBCode,
unsigned int nPos,
CScrollBar *pScrollBar) {}
1296 afx_msg
void OnKeyDown(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1297 afx_msg
void OnKeyUp(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1298 afx_msg
void OnHotKey(
unsigned int nHotKeyId,
unsigned int nKey1,
unsigned int nKey2) {}
1299 afx_msg
void OnLButtonDblClk(
unsigned int nFlags,
CPoint point) {}
1300 afx_msg
void OnLButtonDown(
unsigned int nFlags,
CPoint point) {}
1301 afx_msg
void OnLButtonUp(
unsigned int nFlags,
CPoint point) {}
1302 afx_msg
void OnMButtonDblClk(
unsigned int nFlags,
CPoint point) {}
1303 afx_msg
void OnMButtonDown(
unsigned int nFlags,
CPoint point) {}
1304 afx_msg
void OnMButtonUp(
unsigned int nFlags,
CPoint point) {}
1305 afx_msg
void OnXButtonDblClk(
unsigned int nFlags,
unsigned int nButton,
CPoint point) {}
1306 afx_msg
void OnXButtonDown(
unsigned int nFlags,
unsigned int nButton,
CPoint point) {}
1307 afx_msg
void OnXButtonUp(
unsigned int nFlags,
unsigned int nButton,
CPoint point) {}
1308 afx_msg
int OnMouseActivate(
CWnd *pDesktopWnd,
unsigned int nHitTest,
unsigned int message) {
1311 afx_msg
void OnMouseHover(
unsigned int nFlags,
CPoint point) {}
1312 afx_msg
void OnMouseLeave() {}
1313 afx_msg
void OnMouseMove(
unsigned int nFlags,
CPoint point) {}
1314 afx_msg
void OnMouseHWheel(
unsigned int nFlags,
short zDelta,
CPoint pt) {}
1315 afx_msg
bool OnMouseWheel(
unsigned int nFlags,
short zDelta,
CPoint pt) {
1318 afx_msg
void OnRButtonDblClk(
unsigned int nFlags,
CPoint point) {}
1319 afx_msg
void OnRButtonDown(
unsigned int nFlags,
CPoint point) {}
1320 afx_msg
void OnRButtonUp(
unsigned int nFlags,
CPoint point) {}
1321 afx_msg
bool OnSetCursor(
CWnd *pWnd,
unsigned int nHitTest,
unsigned int message);
1322 afx_msg
void OnTimer(uintptr nIDEvent) {}
1326 afx_msg
unsigned int OnGetDlgCode() {
1330 afx_msg
int OnCharToItem(
unsigned int nChar,
CListBox *pListBox,
unsigned int nIndex) {
1333 afx_msg
int OnVKeyToItem(
unsigned int nKey,
CListBox *pListBox,
unsigned int nIndex) {
1336 afx_msg
void OnSetFont(
HFONT hFont,
bool bRedraw);
1354 static bool isRecursiveMessage(
unsigned int message);
1359 CWnd *m_hWnd =
nullptr;
1361 CWnd *m_pParentWnd =
nullptr;
1362 int m_nClassStyle = 0;
1364 int _modalResult = DEFAULT_MODAL_RESULT;
1365 bool _hasFocus =
false;
1370 bool _updateErase =
false;
1376 static CWnd *FromHandlePermanent(
HWND hWnd);
1386 static CWnd *FromHandle(
HWND hWnd);
1392 bool Create(
const char *lpszClassName,
const char *lpszWindowName,
1393 uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID,
1395 bool CreateEx(uint32 dwExStyle,
const char *lpszClassName,
1396 const char *lpszWindowName, uint32 dwStyle,
1397 int x,
int y,
int nWidth,
int nHeight,
1398 HWND hWndParent, LPARAM nIDorHMenu,
void *lpParam =
nullptr);
1399 bool CreateEx(uint32 dwExStyle,
const char *lpszClassName,
1400 const char *lpszWindowName, uint32 dwStyle,
1401 const RECT &rect,
CWnd *pParentWnd,
unsigned int nID,
1402 void *lpParam =
nullptr);
1413 CWnd *GetParent()
const;
1414 CWnd *GetTopLevelFrame();
1415 HWND GetSafeHwnd()
const;
1417 void ShowWindow(
int nCmdShow);
1418 bool EnableWindow(
bool bEnable =
true);
1419 void UpdateWindow();
1421 LPCRECT lpRectUpdate =
nullptr,
1422 CRgn *prgnUpdate =
nullptr,
1423 unsigned int flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN
1425 void SetActiveWindow();
1427 CWnd *GetFocus()
const;
1428 bool IsWindowVisible()
const {
1429 return (GetStyle() & WS_VISIBLE) != 0;
1431 void DestroyWindow();
1432 void Invalidate(
bool bErase =
true);
1433 int GetWindowText(
CString &rString)
const;
1434 int GetWindowText(
char *lpszStringBuf,
int nMaxCount)
const;
1435 bool SetWindowText(
const char *lpszString);
1436 unsigned int GetState()
const;
1437 uint32 GetStyle()
const {
1440 void SetStyle(uint32 nStyle);
1441 bool IsWindowEnabled()
const {
1442 return (_itemState & ODS_DISABLED) == 0;
1444 bool IsActiveWindow()
const;
1447 int ReleaseDC(
CDC *pDC);
1449 bool PostMessage(
unsigned int message, WPARAM wParam = 0, LPARAM lParam = 0);
1450 LRESULT SendMessage(
unsigned int message, WPARAM wParam = 0, LPARAM lParam = 0);
1451 void SendMessageToDescendants(
unsigned int message,
1452 WPARAM wParam = 0, LPARAM lParam = 0,
1453 bool bDeep =
true,
bool bOnlyPerm =
false);
1454 static void SendMessageToDescendants(
HWND hWnd,
unsigned int message,
1455 WPARAM wParam, LPARAM lParam,
bool bDeep,
bool bOnlyPerm);
1458 bool ValidateRect(
LPCRECT lpRect =
nullptr);
1459 bool InvalidateRect(
LPCRECT lpRect,
bool bErase =
true);
1460 void GetWindowRect(
LPRECT lpRect)
const;
1461 bool GetUpdateRect(
LPRECT lpRect,
bool bErase =
false);
1462 bool GetClientRect(
LPRECT lpRect)
const;
1463 RECT GetClientRect()
const;
1464 bool PointInClientRect(
const POINT &pt)
const;
1465 void ClientToScreen(
LPPOINT lpPoint)
const;
1466 void ClientToScreen(
LPRECT lpRect)
const;
1467 void ScreenToClient(
LPPOINT lpPoint)
const;
1468 void ScreenToClient(
LPRECT lpRect)
const;
1469 RECT GetWindowRectInParentCoords()
const;
1471 void MoveWindow(
LPCRECT lpRect,
bool bRepaint =
true);
1472 void MoveWindow(
int x,
int y,
int nWidth,
int nHeight,
1473 bool bRepaint =
true);
1477 CWnd *GetDlgItem(
int nID)
const;
1478 CWnd *GetNextDlgGroupItem(
CWnd *pWndCtl,
bool bPrevious =
false)
const;
1479 bool GotoDlgCtrl(
CWnd *pWndCtrl);
1480 bool SubclassDlgItem(
unsigned int nID,
CWnd *pParent);
1481 bool SetDlgItemText(
int nIDDlgItem,
const char *lpString);
1482 int GetDlgCtrlID()
const;
1483 void CheckDlgButton(
int nIDButton,
unsigned int nCheck);
1484 LRESULT SendDlgItemMessage(
int nID,
unsigned int message,
1485 WPARAM wParam = 0, LPARAM lParam = 0)
const;
1487 uintptr SetTimer(uintptr nIDEvent,
unsigned int nElapse,
1488 void (CALLBACK *lpfnTimer)(
HWND,
unsigned int, uintptr, uint32) =
nullptr);
1489 bool KillTimer(uintptr nIDEvent);
1491 virtual bool PreTranslateMessage(
MSG *pMsg) {
1494 virtual int GetScrollPos()
const {
1497 int GetScrollPosition()
const {
1498 return GetScrollPos();
1500 virtual int SetScrollPos(
int nPos,
bool bRedraw =
true) {
1503 virtual void GetScrollRange(
int *lpMinPos,
int *lpMaxPos)
const {}
1504 void GetScrollRange(
int ,
int *lpMinPos,
int *lpMaxPos)
const {
1505 GetScrollRange(lpMinPos, lpMaxPos);
1507 virtual void SetScrollRange(
int nMinPos,
int nMaxPos,
bool bRedraw) {}
1510 void ReleaseCapture();
1515 bool IsWindowDirty()
const {
1516 return !_updateRect.
isEmpty();
1519 HFONT GetFont()
const {
1522 void SetFont(
CFont *pFont,
bool bRedraw =
true);
1532 unsigned int m_nIDHelp = 0;
1533 CView *m_pViewActive =
nullptr;
1535 void ActivateFrame(
int nCmdShow);
1536 void OnUpdateFrameTitle(
bool bAddToTitle);
1543 int OnCreate(LPCREATESTRUCT lpcs);
1544 int OnCreateHelper(LPCREATESTRUCT lpcs,
CCreateContext *pContext);
1545 bool OnCreateClient(LPCREATESTRUCT lpcs,
CCreateContext *pContext);
1546 void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized)
override;
1548 enum RepositionFlags {
1549 reposDefault = 0, reposQuery = 1, reposExtra = 2, reposNoPosLeftOver = 0x8000
1551 bool RepositionBars(
1552 unsigned int nIDFirst,
1553 unsigned int nIDLast,
1554 unsigned int nIDLeftOver,
1555 unsigned int nFlag = reposDefault,
1556 LPRECT lpRectParam =
nullptr,
1557 LPCRECT lpRectClient =
nullptr,
1558 bool bStretch =
true 1561 DECLARE_MESSAGE_MAP()
1567 bool Create(
const char *lpszClassName,
1568 const char *lpszWindowName,
1571 CWnd *pParentWnd =
nullptr,
1572 const char *lpszMenuName =
nullptr,
1573 uint32 dwExStyle = 0,
1575 bool Create(
const char *lpszClassName,
const char *lpszWindowName,
1576 uint32 dwStyle = WS_OVERLAPPEDWINDOW) {
1578 return Create(lpszClassName, lpszWindowName, dwStyle, rectDefault);
1581 HMENU GetMenu()
const;
1582 void RecalcLayout(
bool bNotify =
true);
1583 void InitialUpdateFrame(
CDocument *pDoc,
bool bMakeVisible);
1585 bool LoadFrame(
unsigned int nIDResource, uint32 dwDefaultStyle,
1588 CView *GetActiveView()
const;
1589 void SetActiveView(
CView *pViewNew,
bool bNotify =
true);
1590 void OnSetFocus(
CWnd *pOldWnd);
1599 const char *m_lpszTemplateName =
nullptr;
1600 unsigned int m_nIDHelp = 0;
1601 LPCDLGTEMPLATE m_lpDialogTemplate =
nullptr;
1602 HGLOBAL m_hDialogTemplate = 0;
1606 void SetParent(
CWnd *wnd);
1607 bool CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd *pParentWnd,
1609 bool CreateIndirect(HGLOBAL hDialogTemplate,
CWnd *pParentWnd,
1611 bool CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
1613 CWnd *GetDefaultPushButton()
const;
1616 DECLARE_MESSAGE_MAP()
1618 virtual void OnOK();
1619 virtual void OnCancel();
1620 virtual void PostModal() {
1623 void OnSysChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1624 void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized)
override;
1628 explicit CDialog(
const char *lpszTemplateName,
1629 CWnd *pParentWnd =
nullptr);
1630 explicit CDialog(
unsigned int nIDTemplate,
1631 CWnd *pParentWnd =
nullptr);
1633 bool Create(
const char *lpszTemplateName,
1634 CWnd *pParentWnd =
nullptr);
1635 bool Create(
unsigned int nIDTemplate,
1636 CWnd *pParentWnd =
nullptr);
1639 virtual void PreInitDialog() {}
1640 virtual bool OnInitDialog() {
1643 bool PreTranslateMessage(
MSG *pMsg)
override;
1645 uint32 GetDefID()
const;
1646 void SetDefID(
unsigned int nID);
1647 LRESULT HandleInitDialog(WPARAM, LPARAM);
1648 LRESULT HandleSetFont(WPARAM, LPARAM);
1651 int nIDCButton1,
int &value);
1653 int nIDC,
int &value);
1655 void AFXAPI DDX_Text(
CDataExchange *pDX,
int nIDC,
unsigned int &value);
1656 void AFXAPI DDX_Text(
CDataExchange *pDX,
int nIDC,
long &value);
1657 void AFXAPI DDX_Text(
CDataExchange *pDX,
int nIDC,
double &value);
1659 int nIDC,
bool value);
1661 int value,
int nMin,
int nMax);
1664 void EndDialog(
int nResult);
1666 bool UpdateData(
bool bSaveAndValidate =
true);
1673 DECLARE_MESSAGE_MAP()
1684 bool _pressed =
false;
1686 void OnPushButtonPaint();
1687 void OnPushBoxPaint();
1688 void OnOwnerDrawPaint();
1691 DECLARE_MESSAGE_MAP()
1694 void OnLButtonDown(
unsigned int nFlags,
CPoint point);
1695 void OnLButtonUp(
unsigned int nFlags,
CPoint point);
1696 void OnMouseMove(
unsigned int nFlags,
CPoint point);
1697 LRESULT OnBnClicked(WPARAM wParam, LPARAM lParam);
1698 LRESULT OnBnSetCheck(WPARAM wParam, LPARAM lParam);
1703 CVIRTUAL
bool Create(
const char *lpszCaption, uint32 dwStyle,
1704 const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1706 int GetCheck()
const;
1707 void SetCheck(
int nCheck);
1708 void SetButtonStyle(
unsigned int nStyle,
bool bRedraw =
true);
1709 unsigned int GetButtonStyle()
const;
1716 DECLARE_MESSAGE_MAP()
1731 DECLARE_DYNAMIC(
CEdit)
1734 size_t _maxLength = 0;
1735 bool _cursorVisible =
false;
1738 DECLARE_MESSAGE_MAP()
1743 CVIRTUAL
bool Create(uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1744 void LimitText(
int nChars);
1745 void SetSel(
int nStartChar,
int nEndChar,
bool bNoScroll =
false);
1747 afx_msg
void OnPaint();
1748 afx_msg
void OnKeyDown(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1749 afx_msg
void OnChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1750 afx_msg
void OnSetFocus(
CWnd *pOldWnd);
1751 afx_msg
void OnKillFocus(
CWnd *pNewWnd);
1752 afx_msg
void OnTimer(uintptr nTimerId);
1760 int _maxValue = 100;
1765 void drawArrow(
CPaintDC &dc,
const CRect &r,
bool leftArrow);
1766 CRect getThumbRect()
const;
1767 int getIndexFromX(
int xp)
const;
1768 void scrollEvent(
int action);
1771 DECLARE_MESSAGE_MAP()
1773 void OnLButtonDown(
unsigned int nFlags,
CPoint point);
1774 void OnLButtonUp(
unsigned int nFlags,
CPoint point);
1775 void OnMouseMove(
unsigned int,
CPoint point);
1779 CVIRTUAL
bool Create(uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1781 int GetScrollPos()
const override;
1782 int SetScrollPos(
int nPos,
bool bRedraw =
true)
override;
1783 void GetScrollRange(
int *lpMinPos,
int *lpMaxPos)
const override;
1784 void SetScrollRange(
int nMinPos,
int nMaxPos,
bool bRedraw)
override;
1785 void ShowScrollBar(
bool bShow);
1786 bool SetScrollInfo(
LPSCROLLINFO lpScrollInfo,
bool bRedraw);
1790 DECLARE_DYNAMIC(
CView)
1793 virtual bool PreCreateWindow(
CREATESTRUCT &cCs)
override;
1794 virtual void OnDraw(
CDC *pDC) {}
1798 DECLARE_MESSAGE_MAP()
1807 int OnCreate(LPCREATESTRUCT lpcs);
1809 void PostNcDestroy()
override;
1811 void OnInitialUpdate();
1812 virtual void OnUpdate(
CView *pSender, LPARAM ,
CObject * );
1813 virtual void OnActivateView(
bool,
CView *,
CView *) {}
1814 virtual void OnActivateFrame(
unsigned int nState,
CFrameWnd *pFrameWnd) {}
1817 return dynamic_cast<CFrameWnd *
>(m_pParentWnd);
1828 static const SIZE sizeNull;
1831 DECLARE_MESSAGE_MAP()
1837 void SetScrollSizes(
1840 const SIZE &sizePage = sizeNull,
1841 const SIZE &sizeLine = sizeNull
1851 unsigned int m_nIDResource = 0;
1857 DECLARE_MESSAGE_MAP()
1876 virtual CDocument *OpenDocumentFile(
const char *lpszPathName,
1877 bool bMakeVisible =
true) = 0;
1880 virtual void SetDefaultTitle(
CDocument *pDocument) = 0;
1882 bool bMakeVisible =
true);
1884 virtual void AddDocument(
CDocument *pDoc);
1885 virtual void RemoveDocument(
CDocument *pDoc);
1886 virtual void CloseAllDocuments(
bool bEndSession);
1887 virtual POSITION GetFirstDocPosition()
const = 0;
1888 virtual CDocument *GetNextDoc(POSITION &rPos)
const = 0;
1890 void LoadTemplate();
1899 DECLARE_MESSAGE_MAP()
1903 unsigned int nIDResource,
1908 pFrameClass, pViewClass) {
1917 CDocument *OpenDocumentFile(
const char *lpszPathName,
1918 bool bMakeVisible =
true)
override;
1919 void AddDocument(
CDocument *pDoc)
override;
1921 void SetDefaultTitle(
CDocument *pDocument)
override;
1923 POSITION GetFirstDocPosition()
const override;
1924 CDocument *GetNextDoc(POSITION &rPos)
const override;
1931 CTemplateList pStaticList;
1932 bool bStaticInit =
false;
1935 CTemplateList m_templateList;
1942 virtual void CloseAllDocuments(
bool bEndSession);
1966 int m_nWaitCursorCount = 0;
1967 HCURSOR m_hcurWaitCursorRestore =
nullptr;
1968 HCURSOR _currentCursor =
nullptr;
1975 virtual bool InitInstance();
1976 virtual int ExitInstance();
1980 int m_nCmdShow = SW_SHOWNORMAL;
1981 const char *m_lpCmdLine =
"";
1982 CWnd *m_pMainWnd =
nullptr;
1988 MSG _currentMessage;
1992 CWinApp(
const char *appName =
nullptr);
2000 virtual bool InitApplication();
2001 virtual bool SaveAllModified();
2003 void SetDialogBkColor();
2004 HCURSOR LoadStandardCursor(
const char *lpszCursorName);
2005 HCURSOR LoadCursor(
const char *lpszResourceName);
2006 HCURSOR LoadCursor(
unsigned int nIDResource);
2007 HCURSOR SetCursor(HCURSOR hCursor);
2008 void BeginWaitCursor();
2009 void EndWaitCursor();
2015 void DoWaitCursor(
int nCode)
override;
2018 void CloseAllDocuments(
bool bEndSession);
2020 unsigned int GetProfileInt(
const char *lpszSection,
2021 const char *lpszEntry,
int nDefault);
2022 void WriteProfileInt(
const char *lpszSection,
2023 const char *lpszEntry,
int nValue);
2024 CString GetProfileString(
const char *lpszSection,
2025 const char *lpszEntry,
const char *lpszDefault =
nullptr) ;
2026 bool WriteProfileString(
const char *lpszSection,
2027 const char *lpszEntry,
const char *lpszValue);
2030 virtual void OnFileNew();
2031 virtual void OnFileOpen();
2032 virtual void OnFilePrintSetup() {}
2037 void AfxUnlockTempMaps();
2040 void setDirectory(
const char *folder);
2042 byte getColor(COLORREF color)
const;
2057 HRSRC findResource(
const char *lpName,
const char *lpType);
2058 size_t sizeofResource(
HRSRC hResInfo);
2059 HGLOBAL loadResource(
HRSRC hResInfo);
2060 void *lockResource(HGLOBAL hResData);
2061 void unlockResource(HGLOBAL hResData);
2062 bool freeResource(HGLOBAL hResData);
2068 int addFontResource(
const char *fontName) {
2069 return _fonts.addFontResource(fontName);
2071 bool removeFontResource(
const char *fontName) {
2072 return _fonts.removeFontResource(fontName);
2074 HFONT createFont(
int nHeight,
int nWidth,
int nEscapement,
2075 int nOrientation,
int nWeight, byte bItalic, byte bUnderline,
2076 byte cStrikeOut, byte nCharSet, byte nOutPrecision,
2077 byte nClipPrecision, byte nQuality, byte nPitchAndFamily,
2078 const char *lpszFacename) {
2079 return _fonts.createFont(nHeight, nWidth,
2080 nEscapement, nOrientation, nWeight, bItalic,
2081 bUnderline, cStrikeOut, nCharSet, nOutPrecision,
2082 nClipPrecision, nQuality, nPitchAndFamily,
2085 HFONT getFont(
const char *lpszFacename,
int nHeight);
2086 HFONT getDefaultFont() {
2087 assert(_defaultFont.m_hObject);
2088 return (
HFONT)_defaultFont.m_hObject;
2090 HPEN getDefaultPen()
const {
2091 assert(_defaultPen.m_hObject);
2092 return (
HPEN)_defaultPen.m_hObject;
2094 HBRUSH getDefaultBrush() {
2095 assert(_defaultBrush.m_hObject);
2096 return (
HBRUSH)_defaultBrush.m_hObject;
2098 HPALETTE getCurrentPalette()
const {
2099 assert(_currentPalette.m_hObject);
2100 return (
HPALETTE)_currentPalette.m_hObject;
2102 HPALETTE getSystemDefaultPalette()
const {
2103 assert(_systemPalette.m_hObject);
2104 return (
HPALETTE)_systemPalette.m_hObject;
2107 const char *AfxRegisterWndClass(
unsigned int nClassStyle,
2108 HCURSOR hCursor,
HBRUSH hbrBackground, HICON hIcon);
2110 const char * lpClassName,
LPWNDCLASS lpWndClass);
Definition: minwindef.h:166
Definition: text_render.h:36
Definition: afxwin.h:1949
Definition: afxwin.h:1730
Definition: afxwin.h:1140
Definition: afxwin.h:1947
Definition: afxwin.h:1527
Definition: afxwin.h:1929
Definition: atltypes.h:79
Definition: afxwin.h:1052
void addResources(const Common::Path &file)
Definition: afxwin.h:2051
Definition: minwindef.h:87
Definition: dialog_template.h:55
Definition: minwindef.h:161
Definition: afxwin.h:1060
Definition: afxwin.h:1848
Definition: minwindef.h:153
Definition: minwindef.h:239
Definition: afxwin.h:1006
Definition: afxwin.h:1669
Definition: minwindef.h:151
Definition: afxwin.h:1594
Definition: settings.h:33
Definition: atltypes.h:40
bool isEmpty() const
Definition: rect.h:373
void removeResources(const Common::Path &file)
Definition: minwindef.h:179
Definition: minwindef.h:292
Definition: resources.h:60
Definition: minwindef.h:279
Definition: afxwin.h:1956
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: afxwin.h:1018
Definition: afxwin.h:1723
Definition: event_loop.h:72
Simple class for handling a palette data.
Definition: palette.h:55
CString m_strDocStrings
Definition: afxwin.h:1868
Definition: afxwin.h:1893
Definition: atltypes.h:131
Definition: afxwin.h:1789
Definition: minwindef.h:251
void addResources(const Common::Path &file)
Definition: afxwin.h:1712
Definition: afxwin.h:1115