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 #define BEGIN_SILENCE_CAST \ 329 _Pragma("GCC diagnostic push") \ 330 _Pragma("GCC diagnostic ignored \"-Wcast-function-type\"") 331 #define END_SILENCE_CAST \ 332 _Pragma("GCC diagnostic pop") 334 #define BEGIN_SILENCE_CAST 335 #define END_SILENCE_CAST 338 #define BEGIN_TEMPLATE_MESSAGE_MAP(theClass, type_name, baseClass) \ 339 template < typename type_name > \ 340 const AFX_MSGMAP *theClass< type_name >::GetMessageMap() const \ 341 { return GetThisMessageMap(); } \ 342 template < typename type_name > \ 343 const AFX_MSGMAP *theClass< type_name >::GetThisMessageMap() { \ 344 typedef theClass< type_name > ThisClass; \ 345 typedef baseClass TheBaseClass; \ 347 static const AFX_MSGMAP_ENTRY _messageEntries[] = \ 350 #define BEGIN_MESSAGE_MAP(theClass, baseClass) \ 351 const AFX_MSGMAP *theClass::GetMessageMap() const \ 352 { return GetThisMessageMap(); } \ 353 const AFX_MSGMAP *theClass::GetThisMessageMap() { \ 354 typedef theClass ThisClass; \ 355 typedef baseClass TheBaseClass; \ 356 { ThisClass *dummy; (void)dummy; } \ 358 static const AFX_MSGMAP_ENTRY _messageEntries[] = \ 361 #define END_MESSAGE_MAP() \ 362 { 0, 0, 0, 0, AfxSig_end, (AFX_PMSG)nullptr } \ 365 static const AFX_MSGMAP messageMap = \ 366 { &TheBaseClass::GetThisMessageMap, &_messageEntries[0] }; \ 367 return &messageMap; \ 370 #define DECLARE_DYNCREATE(class_name) \ 371 DECLARE_DYNAMIC(class_name) \ 372 static CObject *CreateObject(); 379 void (AFX_MSG_CALL
CCmdTarget:: *pfn_COMMAND)();
380 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_bCOMMAND)();
381 void (AFX_MSG_CALL
CCmdTarget:: *pfn_COMMAND_RANGE)(
unsigned int);
382 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_COMMAND_EX)(
unsigned int);
385 void (AFX_MSG_CALL
CCmdTarget:: *pfn_UPDATE_COMMAND_UI_RANGE)(
CCmdUI *,
unsigned int);
386 void (AFX_MSG_CALL
CCmdTarget:: *pfn_OTHER)(
void *);
387 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_OTHER_EX)(
void *);
391 void (AFX_MSG_CALL
CCmdTarget:: *pfn_NOTIFY_RANGE)(
unsigned int,
NMHDR *, LRESULT *);
392 bool(AFX_MSG_CALL
CCmdTarget:: *pfn_NOTIFY_EX)(
unsigned int, NMHDR *, LRESULT *);
396 void (AFX_MSG_CALL
CWinThread:: *pfn_THREAD)(WPARAM, LPARAM);
399 bool(AFX_MSG_CALL
CWnd:: *pfn_bD)(
CDC *);
400 bool(AFX_MSG_CALL
CWnd:: *pfn_bb)(bool);
401 bool(AFX_MSG_CALL
CWnd:: *pfn_bWww)(
CWnd *,
unsigned int,
unsigned int);
405 HBRUSH(AFX_MSG_CALL CWnd:: *pfn_hDw)(
CDC *,
unsigned int);
406 int (AFX_MSG_CALL CWnd:: *pfn_iwWw)(
unsigned int, CWnd *,
unsigned int);
407 int (AFX_MSG_CALL CWnd:: *pfn_iww)(
unsigned int,
unsigned int);
408 int (AFX_MSG_CALL CWnd:: *pfn_iWww)(CWnd *,
unsigned int,
unsigned int);
409 int (AFX_MSG_CALL CWnd:: *pfn_is)(uint16 *);
410 LRESULT(AFX_MSG_CALL CWnd:: *pfn_lwl)(WPARAM, LPARAM);
411 LRESULT(AFX_MSG_CALL CWnd:: *pfn_lwwM)(
unsigned int,
unsigned int,
CMenu *);
412 void (AFX_MSG_CALL CWnd:: *pfn_vv)();
414 void (AFX_MSG_CALL CWnd:: *pfn_vw)(
unsigned int);
415 void (AFX_MSG_CALL CWnd:: *pfn_vww)(
unsigned int,
unsigned int);
416 void (AFX_MSG_CALL CWnd:: *pfn_vvii)(int, int);
417 void (AFX_MSG_CALL CWnd:: *pfn_vwww)(
unsigned int,
unsigned int,
unsigned int);
418 void (AFX_MSG_CALL CWnd:: *pfn_vwii)(
unsigned int, int, int);
419 void (AFX_MSG_CALL CWnd:: *pfn_vwl)(WPARAM, LPARAM);
420 void (AFX_MSG_CALL CWnd:: *pfn_vbWW)(bool, CWnd *, CWnd *);
421 void (AFX_MSG_CALL CWnd:: *pfn_vD)(
CDC *);
422 void (AFX_MSG_CALL CWnd:: *pfn_vM)(
CMenu *);
423 void (AFX_MSG_CALL CWnd:: *pfn_vMwb)(
CMenu *,
unsigned int, bool);
425 void (AFX_MSG_CALL CWnd:: *pfn_vW)(CWnd *);
426 void (AFX_MSG_CALL CWnd:: *pfn_vWww)(CWnd *,
unsigned int,
unsigned int);
427 void (AFX_MSG_CALL CWnd:: *pfn_vWp)(CWnd *,
CPoint);
428 void (AFX_MSG_CALL CWnd:: *pfn_vWh)(CWnd *, HANDLE);
429 void (AFX_MSG_CALL CWnd:: *pfn_vwW)(
unsigned int, CWnd *);
430 void (AFX_MSG_CALL CWnd:: *pfn_vwWb)(
unsigned int, CWnd *, bool);
431 void (AFX_MSG_CALL CWnd:: *pfn_vwwW)(
unsigned int,
unsigned int, CWnd *);
432 void (AFX_MSG_CALL CWnd:: *pfn_vwwx)(
unsigned int,
unsigned int);
433 void (AFX_MSG_CALL CWnd:: *pfn_vs)(uint16 *);
434 void (AFX_MSG_CALL CWnd:: *pfn_vOWNER)(int, uint16 *);
435 int (AFX_MSG_CALL CWnd:: *pfn_iis)(int, uint16 *);
436 unsigned int(AFX_MSG_CALL CWnd:: *pfn_wp)(
CPoint);
437 unsigned int(AFX_MSG_CALL CWnd:: *pfn_wv)();
438 void (AFX_MSG_CALL CWnd:: *pfn_vPOS)(
WINDOWPOS *);
440 void (AFX_MSG_CALL CWnd:: *pfn_vwp)(
unsigned int,
CPoint);
441 void (AFX_MSG_CALL CWnd:: *pfn_vwwh)(
unsigned int,
unsigned int, HANDLE);
442 bool(AFX_MSG_CALL CWnd:: *pfn_bwsp)(
unsigned int, short,
CPoint);
443 void (AFX_MSG_CALL CWnd:: *pfn_vws)(
unsigned int,
const char *);
444 void (AFX_MSG_CALL CWnd:: *pfn_vFb)(
HFONT, bool);
451 bool IsStoring()
const {
469 CView *m_pLastView =
nullptr;
495 bool _permanent =
false;
498 void AfxHookObject();
499 void AfxUnhookObject();
518 bool operator==(
const CGdiObject &obj)
const {
519 return obj.m_hObject == m_hObject;
521 bool operator!=(
const CGdiObject &obj)
const {
522 return obj.m_hObject != m_hObject;
535 Impl(
int nPenStyle,
int nWidth, COLORREF crColor) :
536 _penStyle(nPenStyle), _width(nWidth),
542 return (
Impl *)m_hObject;
547 CPen(
int nPenStyle,
int nWidth, COLORREF crColor);
550 bool CreatePen(
int nPenStyle,
int nWidth, COLORREF crColor);
560 Impl(COLORREF crColor);
561 Impl(
int nIndex, COLORREF crColor);
565 byte getColor()
const;
568 Impl *brush()
const {
569 return (
Impl *)m_hObject;
574 return (
CBrush *)CGdiObject::FromHandle(h);
581 CBrush(
int nIndex, COLORREF crColor);
585 bool CreateSolidBrush(COLORREF crColor);
586 bool CreateBrushIndirect(
const LOGBRUSH *lpLogBrush);
587 bool CreateStockObject(
int nIndex);
604 return (
Impl *)m_hObject;
609 return (
CFont *)CGdiObject::FromHandle(h);
615 bool CreateFont(
int nHeight,
int nWidth,
int nEscapement,
616 int nOrientation,
int nWeight, byte bItalic, byte bUnderline,
617 byte cStrikeOut, byte nCharSet, byte nOutPrecision,
618 byte nClipPrecision, byte nQuality, byte nPitchAndFamily,
619 const char *lpszFacename);
620 bool CreateFontIndirect(
const LOGFONT *lpLogFont);
630 Impl *bitmap()
const {
631 return (
Impl *)m_hObject;
636 return (
CBitmap *)CGdiObject::FromHandle(h);
645 bool CreateCompatibleBitmap(
CDC *pDC,
int nWidth,
int nHeight);
646 bool CreateBitmap(
int nWidth,
int nHeight,
unsigned int nPlanes,
647 unsigned int nBitcount,
const void *lpBits);
648 int GetObject(
int nCount,
void *lpObject)
const;
649 long GetBitmapBits(
long dwCount,
void *lpBits)
const;
650 bool GetBitmap(
BITMAP *pBitMap)
const {
651 return GetObject(
sizeof(
BITMAP), pBitMap);
663 Impl *palette()
const {
664 return (
Impl *)m_hObject;
669 return (
CPalette *)CGdiObject::FromHandle(h);
677 int GetObject(
int nCount,
void *lpObject)
const;
678 unsigned int GetEntryCount()
const;
679 unsigned int GetPaletteEntries(
unsigned int nStartIndex,
unsigned int nNumEntries,
681 unsigned int SetPaletteEntries(
unsigned int nStartIndex,
unsigned int nNumEntries,
684 bool AnimatePalette(
unsigned int nStartIndex,
unsigned int nNumEntries,
686 unsigned int GetNearestPaletteIndex(COLORREF crColor);
687 bool isEmpty()
const {
688 return !palette() || palette()->empty();
696 int _polyFillMode = 0;
702 bool CreateRectRgn(
int x1,
int y1,
int x2,
int y2);
703 bool CreateRectRgnIndirect(
LPCRECT lpRect);
704 bool CreatePolygonRgn(
const POINT *lpPoints,
705 int nCount,
int nPolyFillMode);
709 DECLARE_DYNCREATE(
CDC)
713 bool _permanent =
false;
714 int _stretchMode = STRETCH_ANDSCANS;
717 void AfxHookObject();
718 void AfxUnhookObject();
729 CWnd *m_pWnd =
nullptr;
732 COLORREF _bkColor = RGB(255, 255, 255);
733 int _bkMode = TRANSPARENT;
734 COLORREF _textColor = 0;
735 uint _textAlign = TA_LEFT;
738 uint getPenColor()
const;
739 uint getBrushColor()
const;
748 bool m_bForceBackground =
false;
758 void setScreenRect();
763 unsigned int realizePalette();
764 COLORREF GetNearestColor(COLORREF crColor)
const;
766 void fillSolidRect(
LPCRECT lpRect, COLORREF clr);
767 void fillSolidRect(
int x,
int y,
int cx,
int cy, COLORREF clr);
771 void frameRgn(
const CRgn *pRgn,
CBrush *brush,
int nWidth,
int nHeight);
772 void floodFill(
int x,
int y, COLORREF crColor);
773 void floodFill(
int x,
int y, COLORREF crColor,
774 unsigned int nFillType);
775 void rectangle(
LPCRECT lpRect);
776 void rectangle(
int x1,
int y1,
int x2,
int y2);
777 void draw3dRect(
const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
778 void drawFocusRect(
const CRect &rect);
782 void ellipse(
int x1,
int y1,
int x2,
int y2);
784 void bitBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
785 int xSrc,
int ySrc, uint32 dwRop);
786 void stretchBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
787 int xSrc,
int ySrc,
int nSrcWidth,
int nSrcHeight, uint32 dwRop);
789 void moveTo(
int x,
int y);
790 void lineTo(
int x,
int y);
791 COLORREF getPixel(
int x,
int y)
const;
792 int setROP2(
int nDrawMode);
795 COLORREF setBkColor(COLORREF crColor);
796 COLORREF getBkColor()
const;
797 COLORREF getBkPixel()
const;
798 int setBkMode(
int nBkMode);
799 COLORREF setTextColor(COLORREF crColor);
800 bool textOut(
int x,
int y,
const char *lpszString,
int nCount,
801 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
802 int nTabOrigin = 0,
CSize *size =
nullptr);
803 bool textOut(
int x,
int y,
const CString &str,
804 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
805 int nTabOrigin = 0,
CSize *size =
nullptr);
806 bool extTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
807 const char *lpszString,
unsigned int nCount,
int *lpDxWidths);
808 bool extTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
809 const CString &str,
int *lpDxWidths);
810 CSize tabbedTextOut(
int x,
int y,
const char *lpszString,
int nCount,
811 int nTabPositions,
const int *lpnTabStopPositions,
int nTabOrigin);
813 int nTabPositions,
const int *lpnTabStopPositions,
int nTabOrigin);
815 int drawText(
const char *lpszString,
int nCount,
LPRECT lpRect,
unsigned int nFormat,
816 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
817 int nTabOrigin = 0,
CSize *size =
nullptr);
818 int drawText(
const CString &str,
LPRECT lpRect,
unsigned int nFormat,
819 int nTabPositions = 0,
const int *lpnTabStopPositions =
nullptr,
820 int nTabOrigin = 0,
CSize *size =
nullptr);
822 CSize getTextExtent(
const char *lpszString,
int nCount)
const;
824 CSize getOutputTextExtent(
const char *lpszString,
int nCount)
const;
826 CSize getTabbedTextExtent(
const char *lpszString,
int nCount,
827 int nTabPositions,
int *lpnTabStopPositions)
const;
829 int nTabPositions,
int *lpnTabStopPositions)
const;
830 CSize getOutputTabbedTextExtent(
const char *lpszString,
int nCount,
831 int nTabPositions,
int *lpnTabStopPositions)
const;
833 int nTabPositions,
int *lpnTabStopPositions)
const;
834 bool grayString(
CBrush *pBrush,
835 bool(CALLBACK *lpfnOutput)(HDC, LPARAM,
int), LPARAM lpData,
836 int nCount,
int x,
int y,
int nWidth,
int nHeight);
837 unsigned int getTextAlign()
const;
838 unsigned int setTextAlign(
unsigned int nFlags);
845 static CDC *FromHandle(HDC hDC);
850 operator HDC()
const {
854 return static_cast<Impl *
>(m_hDC);
857 bool CreateDC(
const char *lpszDriverName,
const char *lpszDeviceName,
858 const char *lpszOutput,
const void *lpInitData);
859 bool CreateCompatibleDC(
CDC *pDC);
861 bool Attach(HDC hDC);
863 int SetStretchBltMode(
int nStretchMode);
864 int GetDeviceCaps(
int nIndex)
const;
867 int GetMapMode()
const;
868 CPoint GetViewportOrg()
const;
869 virtual int SetMapMode(
int nMapMode);
871 virtual CPoint SetViewportOrg(
int x,
int y);
873 virtual CPoint OffsetViewportOrg(
int nWidth,
int nHeight);
876 virtual int GetClipBox(
LPRECT lpRect)
const;
878 void resetClipRect();
879 virtual bool PtVisible(
int x,
int y);
880 bool PtVisible(
POINT point);
881 virtual bool RectVisible(
LPCRECT lpRect);
882 int SelectClipRgn(
CRgn *pRgn);
883 int ExcludeClipRect(
int x1,
int y1,
int x2,
int y2);
884 int ExcludeClipRect(
LPCRECT lpRect);
885 int ExcludeUpdateRgn(
CWnd *pWnd);
886 int IntersectClipRect(
int x1,
int y1,
int x2,
int y2);
887 int IntersectClipRect(
LPCRECT lpRect);
888 int OffsetClipRgn(
int x,
int y);
889 int OffsetClipRgn(
SIZE size);
890 int SelectClipRgn(
CRgn *pRgn,
int nMode);
892 int SetROP2(
int nDrawMode);
893 bool DPtoLP(
LPPOINT lpPoints,
int nCount = 1);
894 bool DPtoLP(
RECT *lpRect);
895 bool LPtoDP(
LPPOINT lpPoints,
int nCount = 1);
896 bool LPtoDP(
RECT *lpRect);
897 bool BitBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
898 int xSrc,
int ySrc, uint32 dwRop);
899 bool StretchBlt(
int x,
int y,
int nWidth,
int nHeight,
CDC *pSrcDC,
900 int xSrc,
int ySrc,
int nSrcWidth,
int nSrcHeight, uint32 dwRop);
902 void Ellipse(
int x1,
int y1,
int x2,
int y2);
904 void Draw3dRect(
const CRect &rect, COLORREF clrTopLeft, COLORREF clrBottomRight);
905 void DrawFocusRect(
const CRect &rect);
907 void FillSolidRect(
LPCRECT lpRect, COLORREF crColor);
908 bool FloodFill(
int x,
int y, COLORREF crColor);
909 bool FloodFill(
int x,
int y, COLORREF crColor,
910 unsigned int nFillType);
911 void Rectangle(
LPCRECT lpRect);
912 void Rectangle(
int x1,
int y1,
int x2,
int y2);
913 bool DrawEdge(
LPRECT lpRect,
unsigned int nEdge,
unsigned int nFlags);
923 const POINT &ptStart,
927 int nWidth,
int nHeight);
929 void MoveTo(
int x,
int y);
930 void LineTo(
int x,
int y);
931 COLORREF GetPixel(
int x,
int y)
const;
932 COLORREF GetPixel(
const POINT &point)
const;
934 virtual CGdiObject *SelectStockObject(
int nIndex);
939 int SelectObject(
CRgn *pRgn);
943 COLORREF GetNearestColor(COLORREF crColor)
const;
945 unsigned int RealizePalette();
947 virtual COLORREF SetBkColor(COLORREF crColor);
948 COLORREF GetBkColor()
const;
949 int SetBkMode(
int nBkMode);
952 virtual COLORREF SetTextColor(COLORREF crColor);
953 virtual bool TextOut(
int x,
int y,
const char *lpszString,
int nCount);
954 bool TextOut(
int x,
int y,
const CString &str);
955 virtual bool ExtTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
956 const char *lpszString,
unsigned int nCount,
int *lpDxWidths);
957 bool ExtTextOut(
int x,
int y,
unsigned int nOptions,
LPCRECT lpRect,
958 const CString &str,
int *lpDxWidths);
959 virtual CSize TabbedTextOut(
int x,
int y,
const char *lpszString,
int nCount,
960 int nTabPositions,
int *lpnTabStopPositions,
int nTabOrigin);
962 int nTabPositions,
int *lpnTabStopPositions,
int nTabOrigin);
963 int DrawText(
const char *lpszString,
int nCount,
964 LPRECT lpRect,
unsigned int nFormat);
965 int DrawText(
const CString &str,
LPRECT lpRect,
unsigned int nFormat);
968 CSize GetTextExtent(
const char *lpszString,
int nCount)
const;
970 CSize GetOutputTextExtent(
const char *lpszString,
int nCount)
const;
972 CSize GetTabbedTextExtent(
const char *lpszString,
int nCount,
973 int nTabPositions,
int *lpnTabStopPositions)
const;
975 int nTabPositions,
int *lpnTabStopPositions)
const;
976 CSize GetOutputTabbedTextExtent(
const char *lpszString,
int nCount,
977 int nTabPositions,
int *lpnTabStopPositions)
const;
979 int nTabPositions,
int *lpnTabStopPositions)
const;
980 virtual bool GrayString(
CBrush *pBrush,
981 bool(CALLBACK *lpfnOutput)(HDC, LPARAM,
int), LPARAM lpData,
982 int nCount,
int x,
int y,
int nWidth,
int nHeight);
983 unsigned int GetTextAlign()
const;
984 unsigned int SetTextAlign(
unsigned int nFlags);
996 HWND m_hWnd =
nullptr;
1010 unsigned int nMsg,
unsigned int nCode,
unsigned int nID);
1012 unsigned int nID,
int nCode, AFX_PMSG pfn,
void *pExtra,
1019 static const AFX_MSGMAP *GetThisMessageMap();
1020 virtual const AFX_MSGMAP *GetMessageMap()
const {
1021 return GetThisMessageMap();
1028 virtual void DoWaitCursor(
int nCode);
1029 void BeginWaitCursor();
1030 void EndWaitCursor();
1031 void RestoreWaitCursor();
1033 bool OnCmdMsg(
unsigned int nID,
int nCode,
void *pExtra,
1039 bool m_bContinueRouting =
false;
1050 bool m_bModified =
false;
1051 ViewArray m_viewList;
1054 bool m_bAutoDelete =
true;
1055 bool m_bEmbedded =
false;
1061 void UpdateAllViews(
CView *pSender, LPARAM lHint = 0,
1063 POSITION GetFirstViewPosition();
1064 CView *GetNextView(POSITION &rPosition)
const;
1066 const CString &GetTitle()
const;
1067 virtual void SetTitle(
const char *lpszTitle);
1068 const CString &GetPathName()
const;
1069 virtual void SetPathName(
const char *lpszPathName,
bool bAddToMRU =
true);
1070 virtual void ClearPathName();
1072 virtual bool IsModified();
1073 virtual void SetModifiedFlag(
bool bModified =
true);
1074 virtual void ReportSaveLoadException(
const char *lpszPathName,
1075 CException *e,
bool bSaving,
unsigned int nIDPDefault);
1076 bool SaveModified();
1078 void AddView(
CView *pView);
1079 void RemoveView(
CView *pView);
1082 virtual void DeleteContents();
1084 virtual bool OnNewDocument() {
1087 virtual bool OnOpenDocument(
const char *lpszPathName) {
1090 virtual void OnFileSaveAs() {}
1091 virtual void OnCloseDocument();
1092 virtual void OnChangedViewList();
1093 virtual void PreCloseFrame(
CFrameWnd *pFrame) {}
1094 virtual void UpdateFrameCounts() {}
1096 DECLARE_MESSAGE_MAP()
1101 void * lpCreateParams =
nullptr;
1104 HWND hwndParent = 0;
1110 const char * lpszName =
nullptr;
1111 const char * lpszClass =
nullptr;
1112 uint32 dwExStyle = 0;
1117 #define WF_TOOLTIPS 0x0001 // window is enabled for tooltips 1118 #define WF_TEMPHIDE 0x0002 // window is temporarily hidden 1119 #define WF_STAYDISABLED 0x0004 // window should stay disabled 1120 #define WF_MODALLOOP 0x0008 // currently in modal loop 1121 #define WF_CONTINUEMODAL 0x0010 // modal loop should continue running 1122 #define WF_OLECTLCONTAINER 0x0100 // some descendant is an OLE control 1123 #define WF_TRACKINGTOOLTIPS 0x0400 // window is enabled for tracking tooltips 1126 DECLARE_DYNCREATE(
CWnd)
1129 static const MSG *GetCurrentMessage();
1135 void createDialogIndirect(LPCDLGTEMPLATE dlgTemplate);
1137 DECLARE_MESSAGE_MAP()
1141 CDC *_pDC =
nullptr;
1148 virtual bool OnCommand(WPARAM wParam, LPARAM lParam);
1149 virtual bool OnNotify(WPARAM wParam, LPARAM lParam, LRESULT *pResult) {
1152 virtual void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized);
1154 virtual LRESULT DefWindowProc(
unsigned int nMsg, WPARAM wParam, LPARAM lParam) {
1157 virtual void OnSetFont(
CFont *pFont) {
1160 bool OnWndMsg(
unsigned int message, WPARAM wParam, LPARAM lParam, LRESULT *pResult);
1162 afx_msg
void OnActivateApp(
bool bActive, uint32 dwThreadID) {}
1163 afx_msg LRESULT OnActivateTopLevel(WPARAM, LPARAM) {
1166 afx_msg
void OnCancelMode() {}
1167 afx_msg
void OnChildActivate() {}
1168 afx_msg
void OnClose();
1169 afx_msg
void OnContextMenu(
CWnd *pWnd,
CPoint pos) {}
1170 afx_msg
int OnCreate(LPCREATESTRUCT lpCreateStruct) {
1174 afx_msg
HBRUSH OnCtlColor(
CDC *pDC,
CWnd *pWnd,
unsigned int nCtlColor) {
1178 afx_msg
void OnDestroy() {}
1179 afx_msg
void OnEnable(
bool bEnable) {}
1180 afx_msg
void OnEndSession(
bool bEnding) {}
1181 afx_msg
void OnEnterIdle(
unsigned int nWhy,
CWnd *pWho) {}
1182 afx_msg
bool OnEraseBkgnd(
CDC *pDC) {
1185 afx_msg
void OnIconEraseBkgnd(
CDC *pDC) {}
1186 afx_msg
void OnKillFocus(
CWnd *pNewWnd) {}
1187 afx_msg
void OnMenuSelect(
unsigned int nItemID,
unsigned int nFlags, HMENU hSysMenu) {}
1188 afx_msg
void OnMove(
int x,
int y) {}
1189 afx_msg
void OnPaint() {}
1190 afx_msg
void OnSyncPaint() {}
1191 afx_msg
void OnParentNotify(
unsigned int message, LPARAM lParam) {}
1192 afx_msg
unsigned int OnNotifyFormat(
CWnd *pWnd,
unsigned int nCommand) {
1195 afx_msg HCURSOR OnQueryDragIcon() {
1198 afx_msg
bool OnQueryEndSession() {
1201 afx_msg
bool OnQueryNewPalette() {
1204 afx_msg
bool OnQueryOpen() {
1207 afx_msg
void OnSetFocus(
CWnd *pOldWnd) {}
1208 afx_msg
void OnShowWindow(
bool bShow,
unsigned int nStatus);
1209 afx_msg
void OnSize(
unsigned int nType,
int cx,
int cy) {}
1210 afx_msg
void OnTCard(
unsigned int idAction, uint32 dwActionData) {}
1211 afx_msg
void OnSessionChange(
unsigned int nSessionState,
unsigned int nId) {}
1213 afx_msg
void OnChangeUIState(
unsigned int nAction,
unsigned int nUIElement) {}
1214 afx_msg
void OnUpdateUIState(
unsigned int nAction,
unsigned int nUIElement) {}
1215 afx_msg
unsigned int OnQueryUIState() {
1220 afx_msg
bool OnNcActivate(
bool bActive) {
1223 afx_msg
bool OnNcCreate(LPCREATESTRUCT lpCreateStruct) {
1226 afx_msg
void OnNcDestroy();
1227 virtual afx_msg
void PostNcDestroy() {}
1228 afx_msg LRESULT OnNcHitTest(
CPoint point) {
1231 afx_msg
void OnNcLButtonDblClk(
unsigned int nHitTest,
CPoint point) {}
1232 afx_msg
void OnNcLButtonDown(
unsigned int nHitTest,
CPoint point) {}
1233 afx_msg
void OnNcLButtonUp(
unsigned int nHitTest,
CPoint point) {}
1234 afx_msg
void OnNcMButtonDblClk(
unsigned int nHitTest,
CPoint point) {}
1235 afx_msg
void OnNcMButtonDown(
unsigned int nHitTest,
CPoint point) {}
1236 afx_msg
void OnNcMButtonUp(
unsigned int nHitTest,
CPoint point) {}
1237 afx_msg
void OnNcMouseHover(
unsigned int nHitTest,
CPoint point) {}
1238 afx_msg
void OnNcMouseLeave() {}
1239 afx_msg
void OnNcMouseMove(
unsigned int nHitTest,
CPoint point) {}
1240 afx_msg
void OnNcPaint() {}
1241 afx_msg
void OnNcRButtonDblClk(
unsigned int nHitTest,
CPoint point) {}
1242 afx_msg
void OnNcRButtonDown(
unsigned int nHitTest,
CPoint point) {}
1243 afx_msg
void OnNcRButtonUp(
unsigned int nHitTest,
CPoint point) {}
1244 afx_msg
void OnNcXButtonDown(
short zHitTest,
unsigned int nButton,
CPoint point) {}
1245 afx_msg
void OnNcXButtonUp(
short zHitTest,
unsigned int nButton,
CPoint point) {}
1246 afx_msg
void OnNcXButtonDblClk(
short zHitTest,
unsigned int nButton,
CPoint point) {}
1249 afx_msg
void OnDropFiles(HDROP hDropInfo) {}
1250 afx_msg
void OnPaletteIsChanging(
CWnd *pRealizeWnd) {}
1251 afx_msg
void OnSysChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1252 afx_msg
void OnSysCommand(
unsigned int nID, LPARAM lParam) {}
1253 afx_msg
void OnSysDeadChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1254 afx_msg
void OnSysKeyDown(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1255 afx_msg
void OnSysKeyUp(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1256 afx_msg
bool OnAppCommand(
CWnd *pWnd,
unsigned int nCmd,
unsigned int nDevice,
unsigned int nKey) {
1259 afx_msg
void OnRawInput(
unsigned int nInputCode, HRAWINPUT hRawInput) {}
1260 afx_msg
void OnCompacting(
unsigned int nCpuTime) {}
1261 afx_msg
void OnDevModeChange(_In_z_ uint16 * lpDeviceName) {}
1262 afx_msg
void OnFontChange() {}
1263 afx_msg
void OnPaletteChanged(
CWnd *pFocusWnd) {}
1264 afx_msg
void OnSpoolerStatus(
unsigned int nStatus,
unsigned int nJobs) {}
1265 afx_msg
void OnSysColorChange() {}
1266 afx_msg
void OnTimeChange() {}
1267 afx_msg
void OnSettingChange(
unsigned int uFlags,
const char *lpszSection) {}
1268 afx_msg
void OnWinIniChange(
const char *lpszSection) {}
1269 afx_msg
unsigned int OnPowerBroadcast(
unsigned int nPowerEvent, LPARAM lEventData) {
1272 afx_msg
void OnUserChanged() {}
1273 afx_msg
void OnInputLangChange(
unsigned int nCharSet,
unsigned int nLocaleId) {}
1274 afx_msg
void OnInputLangChangeRequest(
unsigned int nFlags,
unsigned int nLocaleId) {}
1275 afx_msg
void OnInputDeviceChange(
unsigned short nFlags, HANDLE hDevice) {}
1278 afx_msg
void OnChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1279 afx_msg
void OnDeadChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1280 afx_msg
void OnUniChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1281 afx_msg
void OnHScroll(
unsigned int nSBCode,
unsigned int nPos,
CScrollBar *pScrollBar) {}
1282 afx_msg
void OnVScroll(
unsigned int nSBCode,
unsigned int nPos,
CScrollBar *pScrollBar) {}
1283 afx_msg
void OnKeyDown(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1284 afx_msg
void OnKeyUp(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags) {}
1285 afx_msg
void OnHotKey(
unsigned int nHotKeyId,
unsigned int nKey1,
unsigned int nKey2) {}
1286 afx_msg
void OnLButtonDblClk(
unsigned int nFlags,
CPoint point) {}
1287 afx_msg
void OnLButtonDown(
unsigned int nFlags,
CPoint point) {}
1288 afx_msg
void OnLButtonUp(
unsigned int nFlags,
CPoint point) {}
1289 afx_msg
void OnMButtonDblClk(
unsigned int nFlags,
CPoint point) {}
1290 afx_msg
void OnMButtonDown(
unsigned int nFlags,
CPoint point) {}
1291 afx_msg
void OnMButtonUp(
unsigned int nFlags,
CPoint point) {}
1292 afx_msg
void OnXButtonDblClk(
unsigned int nFlags,
unsigned int nButton,
CPoint point) {}
1293 afx_msg
void OnXButtonDown(
unsigned int nFlags,
unsigned int nButton,
CPoint point) {}
1294 afx_msg
void OnXButtonUp(
unsigned int nFlags,
unsigned int nButton,
CPoint point) {}
1295 afx_msg
int OnMouseActivate(
CWnd *pDesktopWnd,
unsigned int nHitTest,
unsigned int message) {
1298 afx_msg
void OnMouseHover(
unsigned int nFlags,
CPoint point) {}
1299 afx_msg
void OnMouseLeave() {}
1300 afx_msg
void OnMouseMove(
unsigned int nFlags,
CPoint point) {}
1301 afx_msg
void OnMouseHWheel(
unsigned int nFlags,
short zDelta,
CPoint pt) {}
1302 afx_msg
bool OnMouseWheel(
unsigned int nFlags,
short zDelta,
CPoint pt) {
1305 afx_msg
void OnRButtonDblClk(
unsigned int nFlags,
CPoint point) {}
1306 afx_msg
void OnRButtonDown(
unsigned int nFlags,
CPoint point) {}
1307 afx_msg
void OnRButtonUp(
unsigned int nFlags,
CPoint point) {}
1308 afx_msg
bool OnSetCursor(
CWnd *pWnd,
unsigned int nHitTest,
unsigned int message);
1309 afx_msg
void OnTimer(uintptr nIDEvent) {}
1313 afx_msg
unsigned int OnGetDlgCode() {
1317 afx_msg
int OnCharToItem(
unsigned int nChar,
CListBox *pListBox,
unsigned int nIndex) {
1320 afx_msg
int OnVKeyToItem(
unsigned int nKey,
CListBox *pListBox,
unsigned int nIndex) {
1323 afx_msg
void OnSetFont(
HFONT hFont,
bool bRedraw);
1341 static bool isRecursiveMessage(
unsigned int message);
1346 CWnd *m_hWnd =
nullptr;
1348 CWnd *m_pParentWnd =
nullptr;
1349 int m_nClassStyle = 0;
1351 int _modalResult = DEFAULT_MODAL_RESULT;
1352 bool _hasFocus =
false;
1357 bool _updateErase =
false;
1363 static CWnd *FromHandlePermanent(
HWND hWnd);
1373 static CWnd *FromHandle(
HWND hWnd);
1379 bool Create(
const char *lpszClassName,
const char *lpszWindowName,
1380 uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID,
1382 bool CreateEx(uint32 dwExStyle,
const char *lpszClassName,
1383 const char *lpszWindowName, uint32 dwStyle,
1384 int x,
int y,
int nWidth,
int nHeight,
1385 HWND hWndParent, LPARAM nIDorHMenu,
void *lpParam =
nullptr);
1386 bool CreateEx(uint32 dwExStyle,
const char *lpszClassName,
1387 const char *lpszWindowName, uint32 dwStyle,
1388 const RECT &rect,
CWnd *pParentWnd,
unsigned int nID,
1389 void *lpParam =
nullptr);
1400 CWnd *GetParent()
const;
1401 CWnd *GetTopLevelFrame();
1402 HWND GetSafeHwnd()
const;
1404 void ShowWindow(
int nCmdShow);
1405 bool EnableWindow(
bool bEnable =
true);
1406 void UpdateWindow();
1408 LPCRECT lpRectUpdate =
nullptr,
1409 CRgn *prgnUpdate =
nullptr,
1410 unsigned int flags = RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN
1412 void SetActiveWindow();
1414 CWnd *GetFocus()
const;
1415 bool IsWindowVisible()
const {
1416 return (GetStyle() & WS_VISIBLE) != 0;
1418 void DestroyWindow();
1419 void Invalidate(
bool bErase =
true);
1420 int GetWindowText(
CString &rString)
const;
1421 int GetWindowText(
char *lpszStringBuf,
int nMaxCount)
const;
1422 bool SetWindowText(
const char *lpszString);
1423 unsigned int GetState()
const;
1424 uint32 GetStyle()
const {
1427 void SetStyle(uint32 nStyle);
1428 bool IsWindowEnabled()
const {
1429 return (_itemState & ODS_DISABLED) == 0;
1431 bool IsActiveWindow()
const;
1434 int ReleaseDC(
CDC *pDC);
1436 bool PostMessage(
unsigned int message, WPARAM wParam = 0, LPARAM lParam = 0);
1437 LRESULT SendMessage(
unsigned int message, WPARAM wParam = 0, LPARAM lParam = 0);
1438 void SendMessageToDescendants(
unsigned int message,
1439 WPARAM wParam = 0, LPARAM lParam = 0,
1440 bool bDeep =
true,
bool bOnlyPerm =
false);
1441 static void SendMessageToDescendants(
HWND hWnd,
unsigned int message,
1442 WPARAM wParam, LPARAM lParam,
bool bDeep,
bool bOnlyPerm);
1445 bool ValidateRect(
LPCRECT lpRect =
nullptr);
1446 bool InvalidateRect(
LPCRECT lpRect,
bool bErase =
true);
1447 void GetWindowRect(
LPRECT lpRect)
const;
1448 bool GetUpdateRect(
LPRECT lpRect,
bool bErase =
false);
1449 bool GetClientRect(
LPRECT lpRect)
const;
1450 RECT GetClientRect()
const;
1451 bool PointInClientRect(
const POINT &pt)
const;
1452 void ClientToScreen(
LPPOINT lpPoint)
const;
1453 void ClientToScreen(
LPRECT lpRect)
const;
1454 void ScreenToClient(
LPPOINT lpPoint)
const;
1455 void ScreenToClient(
LPRECT lpRect)
const;
1456 RECT GetWindowRectInParentCoords()
const;
1458 void MoveWindow(
LPCRECT lpRect,
bool bRepaint =
true);
1459 void MoveWindow(
int x,
int y,
int nWidth,
int nHeight,
1460 bool bRepaint =
true);
1464 CWnd *GetDlgItem(
int nID)
const;
1465 CWnd *GetNextDlgGroupItem(
CWnd *pWndCtl,
bool bPrevious =
false)
const;
1466 bool GotoDlgCtrl(
CWnd *pWndCtrl);
1467 bool SubclassDlgItem(
unsigned int nID,
CWnd *pParent);
1468 bool SetDlgItemText(
int nIDDlgItem,
const char *lpString);
1469 int GetDlgCtrlID()
const;
1470 void CheckDlgButton(
int nIDButton,
unsigned int nCheck);
1471 LRESULT SendDlgItemMessage(
int nID,
unsigned int message,
1472 WPARAM wParam = 0, LPARAM lParam = 0)
const;
1474 uintptr SetTimer(uintptr nIDEvent,
unsigned int nElapse,
1475 void (CALLBACK *lpfnTimer)(
HWND,
unsigned int, uintptr, uint32) =
nullptr);
1476 bool KillTimer(uintptr nIDEvent);
1478 virtual bool PreTranslateMessage(
MSG *pMsg) {
1481 virtual int GetScrollPos()
const {
1484 int GetScrollPosition()
const {
1485 return GetScrollPos();
1487 virtual int SetScrollPos(
int nPos,
bool bRedraw =
true) {
1490 virtual void GetScrollRange(
int *lpMinPos,
int *lpMaxPos)
const {}
1491 void GetScrollRange(
int ,
int *lpMinPos,
int *lpMaxPos)
const {
1492 GetScrollRange(lpMinPos, lpMaxPos);
1494 virtual void SetScrollRange(
int nMinPos,
int nMaxPos,
bool bRedraw) {}
1497 void ReleaseCapture();
1502 bool IsWindowDirty()
const {
1503 return !_updateRect.
isEmpty();
1506 HFONT GetFont()
const {
1509 void SetFont(
CFont *pFont,
bool bRedraw =
true);
1519 unsigned int m_nIDHelp = 0;
1520 CView *m_pViewActive =
nullptr;
1522 void ActivateFrame(
int nCmdShow);
1523 void OnUpdateFrameTitle(
bool bAddToTitle);
1530 int OnCreate(LPCREATESTRUCT lpcs);
1531 int OnCreateHelper(LPCREATESTRUCT lpcs,
CCreateContext *pContext);
1532 bool OnCreateClient(LPCREATESTRUCT lpcs,
CCreateContext *pContext);
1533 void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized)
override;
1535 enum RepositionFlags {
1536 reposDefault = 0, reposQuery = 1, reposExtra = 2, reposNoPosLeftOver = 0x8000
1538 bool RepositionBars(
1539 unsigned int nIDFirst,
1540 unsigned int nIDLast,
1541 unsigned int nIDLeftOver,
1542 unsigned int nFlag = reposDefault,
1543 LPRECT lpRectParam =
nullptr,
1544 LPCRECT lpRectClient =
nullptr,
1545 bool bStretch =
true 1548 DECLARE_MESSAGE_MAP()
1554 bool Create(
const char *lpszClassName,
1555 const char *lpszWindowName,
1558 CWnd *pParentWnd =
nullptr,
1559 const char *lpszMenuName =
nullptr,
1560 uint32 dwExStyle = 0,
1562 bool Create(
const char *lpszClassName,
const char *lpszWindowName,
1563 uint32 dwStyle = WS_OVERLAPPEDWINDOW) {
1565 return Create(lpszClassName, lpszWindowName, dwStyle, rectDefault);
1568 HMENU GetMenu()
const;
1569 void RecalcLayout(
bool bNotify =
true);
1570 void InitialUpdateFrame(
CDocument *pDoc,
bool bMakeVisible);
1572 bool LoadFrame(
unsigned int nIDResource, uint32 dwDefaultStyle,
1575 CView *GetActiveView()
const;
1576 void SetActiveView(
CView *pViewNew,
bool bNotify =
true);
1577 void OnSetFocus(
CWnd *pOldWnd);
1586 const char *m_lpszTemplateName =
nullptr;
1587 unsigned int m_nIDHelp = 0;
1588 LPCDLGTEMPLATE m_lpDialogTemplate =
nullptr;
1589 HGLOBAL m_hDialogTemplate = 0;
1593 void SetParent(
CWnd *wnd);
1594 bool CreateIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd *pParentWnd,
1596 bool CreateIndirect(HGLOBAL hDialogTemplate,
CWnd *pParentWnd,
1598 bool CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
1600 CWnd *GetDefaultPushButton()
const;
1603 DECLARE_MESSAGE_MAP()
1605 virtual void OnOK();
1606 virtual void OnCancel();
1607 virtual void PostModal() {
1610 void OnSysChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1611 void OnActivate(
unsigned int nState,
CWnd *pWndOther,
bool bMinimized)
override;
1615 explicit CDialog(
const char *lpszTemplateName,
1616 CWnd *pParentWnd =
nullptr);
1617 explicit CDialog(
unsigned int nIDTemplate,
1618 CWnd *pParentWnd =
nullptr);
1620 bool Create(
const char *lpszTemplateName,
1621 CWnd *pParentWnd =
nullptr);
1622 bool Create(
unsigned int nIDTemplate,
1623 CWnd *pParentWnd =
nullptr);
1626 virtual void PreInitDialog() {}
1627 virtual bool OnInitDialog() {
1630 bool PreTranslateMessage(
MSG *pMsg)
override;
1632 uint32 GetDefID()
const;
1633 void SetDefID(
unsigned int nID);
1634 LRESULT HandleInitDialog(WPARAM, LPARAM);
1635 LRESULT HandleSetFont(WPARAM, LPARAM);
1638 int nIDCButton1,
int &value);
1640 int nIDC,
int &value);
1642 void AFXAPI DDX_Text(
CDataExchange *pDX,
int nIDC,
unsigned int &value);
1643 void AFXAPI DDX_Text(
CDataExchange *pDX,
int nIDC,
long &value);
1644 void AFXAPI DDX_Text(
CDataExchange *pDX,
int nIDC,
double &value);
1646 int nIDC,
bool value);
1648 int value,
int nMin,
int nMax);
1651 void EndDialog(
int nResult);
1653 bool UpdateData(
bool bSaveAndValidate =
true);
1660 DECLARE_MESSAGE_MAP()
1671 bool _pressed =
false;
1673 void OnPushButtonPaint();
1674 void OnPushBoxPaint();
1675 void OnOwnerDrawPaint();
1678 DECLARE_MESSAGE_MAP()
1681 void OnLButtonDown(
unsigned int nFlags,
CPoint point);
1682 void OnLButtonUp(
unsigned int nFlags,
CPoint point);
1683 void OnMouseMove(
unsigned int nFlags,
CPoint point);
1684 LRESULT OnBnClicked(WPARAM wParam, LPARAM lParam);
1685 LRESULT OnBnSetCheck(WPARAM wParam, LPARAM lParam);
1690 CVIRTUAL
bool Create(
const char *lpszCaption, uint32 dwStyle,
1691 const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1693 int GetCheck()
const;
1694 void SetCheck(
int nCheck);
1695 void SetButtonStyle(
unsigned int nStyle,
bool bRedraw =
true);
1696 unsigned int GetButtonStyle()
const;
1703 DECLARE_MESSAGE_MAP()
1718 DECLARE_DYNAMIC(
CEdit)
1721 size_t _maxLength = 0;
1722 bool _cursorVisible =
false;
1725 DECLARE_MESSAGE_MAP()
1730 CVIRTUAL
bool Create(uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1731 void LimitText(
int nChars);
1732 void SetSel(
int nStartChar,
int nEndChar,
bool bNoScroll =
false);
1734 afx_msg
void OnPaint();
1735 afx_msg
void OnKeyDown(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1736 afx_msg
void OnChar(
unsigned int nChar,
unsigned int nRepCnt,
unsigned int nFlags);
1737 afx_msg
void OnSetFocus(
CWnd *pOldWnd);
1738 afx_msg
void OnKillFocus(
CWnd *pNewWnd);
1739 afx_msg
void OnTimer(uintptr nTimerId);
1747 int _maxValue = 100;
1752 void drawArrow(
CPaintDC &dc,
const CRect &r,
bool leftArrow);
1753 CRect getThumbRect()
const;
1754 int getIndexFromX(
int xp)
const;
1755 void scrollEvent(
int action);
1758 DECLARE_MESSAGE_MAP()
1760 void OnLButtonDown(
unsigned int nFlags,
CPoint point);
1761 void OnLButtonUp(
unsigned int nFlags,
CPoint point);
1762 void OnMouseMove(
unsigned int,
CPoint point);
1766 CVIRTUAL
bool Create(uint32 dwStyle,
const RECT &rect,
CWnd *pParentWnd,
unsigned int nID);
1768 int GetScrollPos()
const override;
1769 int SetScrollPos(
int nPos,
bool bRedraw =
true)
override;
1770 void GetScrollRange(
int *lpMinPos,
int *lpMaxPos)
const override;
1771 void SetScrollRange(
int nMinPos,
int nMaxPos,
bool bRedraw)
override;
1772 void ShowScrollBar(
bool bShow);
1773 bool SetScrollInfo(
LPSCROLLINFO lpScrollInfo,
bool bRedraw);
1777 DECLARE_DYNAMIC(
CView)
1780 virtual bool PreCreateWindow(
CREATESTRUCT &cCs)
override;
1781 virtual void OnDraw(
CDC *pDC) {}
1785 DECLARE_MESSAGE_MAP()
1794 int OnCreate(LPCREATESTRUCT lpcs);
1796 void PostNcDestroy()
override;
1798 void OnInitialUpdate();
1799 virtual void OnUpdate(
CView *pSender, LPARAM ,
CObject * );
1800 virtual void OnActivateView(
bool,
CView *,
CView *) {}
1801 virtual void OnActivateFrame(
unsigned int nState,
CFrameWnd *pFrameWnd) {}
1804 return dynamic_cast<CFrameWnd *
>(m_pParentWnd);
1815 static const SIZE sizeNull;
1818 DECLARE_MESSAGE_MAP()
1824 void SetScrollSizes(
1827 const SIZE &sizePage = sizeNull,
1828 const SIZE &sizeLine = sizeNull
1838 unsigned int m_nIDResource = 0;
1844 DECLARE_MESSAGE_MAP()
1863 virtual CDocument *OpenDocumentFile(
const char *lpszPathName,
1864 bool bMakeVisible =
true) = 0;
1867 virtual void SetDefaultTitle(
CDocument *pDocument) = 0;
1869 bool bMakeVisible =
true);
1871 virtual void AddDocument(
CDocument *pDoc);
1872 virtual void RemoveDocument(
CDocument *pDoc);
1873 virtual void CloseAllDocuments(
bool bEndSession);
1874 virtual POSITION GetFirstDocPosition()
const = 0;
1875 virtual CDocument *GetNextDoc(POSITION &rPos)
const = 0;
1877 void LoadTemplate();
1886 DECLARE_MESSAGE_MAP()
1890 unsigned int nIDResource,
1895 pFrameClass, pViewClass) {
1904 CDocument *OpenDocumentFile(
const char *lpszPathName,
1905 bool bMakeVisible =
true)
override;
1906 void AddDocument(
CDocument *pDoc)
override;
1908 void SetDefaultTitle(
CDocument *pDocument)
override;
1910 POSITION GetFirstDocPosition()
const override;
1911 CDocument *GetNextDoc(POSITION &rPos)
const override;
1918 CTemplateList pStaticList;
1919 bool bStaticInit =
false;
1922 CTemplateList m_templateList;
1929 virtual void CloseAllDocuments(
bool bEndSession);
1953 int m_nWaitCursorCount = 0;
1954 HCURSOR m_hcurWaitCursorRestore =
nullptr;
1955 HCURSOR _currentCursor =
nullptr;
1962 virtual bool InitInstance();
1963 virtual int ExitInstance();
1967 int m_nCmdShow = SW_SHOWNORMAL;
1968 const char *m_lpCmdLine =
"";
1969 CWnd *m_pMainWnd =
nullptr;
1975 MSG _currentMessage;
1979 CWinApp(
const char *appName =
nullptr);
1987 virtual bool InitApplication();
1988 virtual bool SaveAllModified();
1990 void SetDialogBkColor();
1991 HCURSOR LoadStandardCursor(
const char *lpszCursorName);
1992 HCURSOR LoadCursor(
const char *lpszResourceName);
1993 HCURSOR LoadCursor(
unsigned int nIDResource);
1994 HCURSOR SetCursor(HCURSOR hCursor);
1995 void BeginWaitCursor();
1996 void EndWaitCursor();
2002 void DoWaitCursor(
int nCode)
override;
2005 void CloseAllDocuments(
bool bEndSession);
2007 unsigned int GetProfileInt(
const char *lpszSection,
2008 const char *lpszEntry,
int nDefault);
2009 void WriteProfileInt(
const char *lpszSection,
2010 const char *lpszEntry,
int nValue);
2011 CString GetProfileString(
const char *lpszSection,
2012 const char *lpszEntry,
const char *lpszDefault =
nullptr) ;
2013 bool WriteProfileString(
const char *lpszSection,
2014 const char *lpszEntry,
const char *lpszValue);
2017 virtual void OnFileNew();
2018 virtual void OnFileOpen();
2019 virtual void OnFilePrintSetup() {}
2024 void AfxUnlockTempMaps();
2027 void setDirectory(
const char *folder);
2029 byte getColor(COLORREF color)
const;
2044 HRSRC findResource(
const char *lpName,
const char *lpType);
2045 size_t sizeofResource(
HRSRC hResInfo);
2046 HGLOBAL loadResource(
HRSRC hResInfo);
2047 void *lockResource(HGLOBAL hResData);
2048 void unlockResource(HGLOBAL hResData);
2049 bool freeResource(HGLOBAL hResData);
2055 int addFontResource(
const char *fontName) {
2056 return _fonts.addFontResource(fontName);
2058 bool removeFontResource(
const char *fontName) {
2059 return _fonts.removeFontResource(fontName);
2061 HFONT createFont(
int nHeight,
int nWidth,
int nEscapement,
2062 int nOrientation,
int nWeight, byte bItalic, byte bUnderline,
2063 byte cStrikeOut, byte nCharSet, byte nOutPrecision,
2064 byte nClipPrecision, byte nQuality, byte nPitchAndFamily,
2065 const char *lpszFacename) {
2066 return _fonts.createFont(nHeight, nWidth,
2067 nEscapement, nOrientation, nWeight, bItalic,
2068 bUnderline, cStrikeOut, nCharSet, nOutPrecision,
2069 nClipPrecision, nQuality, nPitchAndFamily,
2072 HFONT getFont(
const char *lpszFacename,
int nHeight);
2073 HFONT getDefaultFont() {
2074 assert(_defaultFont.m_hObject);
2075 return (
HFONT)_defaultFont.m_hObject;
2077 HPEN getDefaultPen()
const {
2078 assert(_defaultPen.m_hObject);
2079 return (
HPEN)_defaultPen.m_hObject;
2081 HBRUSH getDefaultBrush() {
2082 assert(_defaultBrush.m_hObject);
2083 return (
HBRUSH)_defaultBrush.m_hObject;
2086 assert(_systemPalette.m_hObject);
2087 return (
HPALETTE)_systemPalette.m_hObject;
2090 const char *AfxRegisterWndClass(
unsigned int nClassStyle,
2091 HCURSOR hCursor,
HBRUSH hbrBackground, HICON hIcon);
2093 const char * lpClassName,
LPWNDCLASS lpWndClass);
Definition: minwindef.h:165
Definition: text_render.h:36
Definition: afxwin.h:1936
Definition: afxwin.h:1717
Definition: afxwin.h:1125
Definition: afxwin.h:1934
Definition: afxwin.h:1514
Definition: afxwin.h:1916
Definition: atltypes.h:79
Definition: afxwin.h:1037
void addResources(const Common::Path &file)
Definition: afxwin.h:2038
Definition: minwindef.h:86
Definition: dialog_template.h:55
Definition: minwindef.h:160
Definition: afxwin.h:1045
Definition: afxwin.h:1835
Definition: minwindef.h:152
Definition: minwindef.h:238
Definition: afxwin.h:1656
Definition: minwindef.h:150
Definition: afxwin.h:1581
Definition: settings.h:33
Definition: atltypes.h:40
bool isEmpty() const
Definition: rect.h:373
void removeResources(const Common::Path &file)
Definition: minwindef.h:178
Definition: minwindef.h:291
Definition: resources.h:60
Definition: minwindef.h:278
Definition: afxwin.h:1943
#define MKTAG(a0, a1, a2, a3)
Definition: endian.h:188
Definition: afxwin.h:1003
Definition: afxwin.h:1710
Definition: event_loop.h:70
Simple class for handling a palette data.
Definition: palette.h:55
CString m_strDocStrings
Definition: afxwin.h:1855
Definition: afxwin.h:1880
Definition: atltypes.h:131
Definition: afxwin.h:1776
Definition: minwindef.h:250
void addResources(const Common::Path &file)
Definition: afxwin.h:1699
Definition: afxwin.h:1100