home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / MFCINC.PAK / AFXWIN1.INL < prev    next >
Encoding:
Text File  |  1997-05-06  |  56.0 KB  |  1,092 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1995 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11. // Inlines for AFXWIN.H (part 1)
  12.  
  13. #ifdef _AFXWIN_INLINE
  14.  
  15. // Global helper functions
  16. _AFXWIN_INLINE CWinApp* AFXAPI AfxGetApp()
  17.     { return afxCurrentWinApp; }
  18. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetInstanceHandle()
  19.     { ASSERT(afxCurrentInstanceHandle != NULL);
  20.         return afxCurrentInstanceHandle; }
  21. _AFXWIN_INLINE HINSTANCE AFXAPI AfxGetResourceHandle()
  22.     { ASSERT(afxCurrentResourceHandle != NULL);
  23.         return afxCurrentResourceHandle; }
  24. _AFXWIN_INLINE void AFXAPI AfxSetResourceHandle(HINSTANCE hInstResource)
  25.     { ASSERT(hInstResource != NULL); afxCurrentResourceHandle = hInstResource; }
  26. _AFXWIN_INLINE LPCTSTR AFXAPI AfxGetAppName()
  27.     { ASSERT(afxCurrentAppName != NULL); return afxCurrentAppName; }
  28. _AFXWIN_INLINE COleMessageFilter* AFXAPI AfxOleGetMessageFilter()
  29.     { ASSERT_VALID(AfxGetApp()); return AfxGetApp()->m_pMessageFilter; }
  30. _AFXWIN_INLINE CWnd* AFXAPI AfxGetMainWnd()
  31.     { return AfxGetThread() != NULL ? AfxGetThread()->GetMainWnd() : NULL; }
  32.  
  33. #ifdef _AFXDLL
  34. // AFX_MAINTAIN_STATE functions
  35. _AFXWIN_INLINE AFX_MAINTAIN_STATE::AFX_MAINTAIN_STATE(AFX_MODULE_STATE* pNewState)
  36.     {  m_pPrevModuleState = AfxSetModuleState(pNewState); }
  37. #endif
  38.  
  39. // CSize
  40. _AFXWIN_INLINE CSize::CSize()
  41.     { /* random filled */ }
  42. _AFXWIN_INLINE CSize::CSize(int initCX, int initCY)
  43.     { cx = initCX; cy = initCY; }
  44. _AFXWIN_INLINE CSize::CSize(SIZE initSize)
  45.     { *(SIZE*)this = initSize; }
  46. _AFXWIN_INLINE CSize::CSize(POINT initPt)
  47.     { *(POINT*)this = initPt; }
  48. _AFXWIN_INLINE CSize::CSize(DWORD dwSize)
  49.     {
  50.         cx = (short)LOWORD(dwSize);
  51.         cy = (short)HIWORD(dwSize);
  52.     }
  53. _AFXWIN_INLINE BOOL CSize::operator==(SIZE size) const
  54.     { return (cx == size.cx && cy == size.cy); }
  55. _AFXWIN_INLINE BOOL CSize::operator!=(SIZE size) const
  56.     { return (cx != size.cx || cy != size.cy); }
  57. _AFXWIN_INLINE void CSize::operator+=(SIZE size)
  58.     { cx += size.cx; cy += size.cy; }
  59. _AFXWIN_INLINE void CSize::operator-=(SIZE size)
  60.     { cx -= size.cx; cy -= size.cy; }
  61. _AFXWIN_INLINE CSize CSize::operator+(SIZE size) const
  62.     { return CSize(cx + size.cx, cy + size.cy); }
  63. _AFXWIN_INLINE CSize CSize::operator-(SIZE size) const
  64.     { return CSize(cx - size.cx, cy - size.cy); }
  65. _AFXWIN_INLINE CSize CSize::operator-() const
  66.     { return CSize(-cx, -cy); }
  67. _AFXWIN_INLINE CPoint CSize::operator+(POINT point) const
  68.     { return CPoint(cx + point.x, cy + point.y); }
  69. _AFXWIN_INLINE CPoint CSize::operator-(POINT point) const
  70.     { return CPoint(cx - point.x, cy - point.y); }
  71. _AFXWIN_INLINE CRect CSize::operator+(const RECT* lpRect) const
  72.     { return CRect(lpRect) + *this; }
  73. _AFXWIN_INLINE CRect CSize::operator-(const RECT* lpRect) const
  74.     { return CRect(lpRect) - *this; }
  75.  
  76. // CPoint
  77. _AFXWIN_INLINE CPoint::CPoint()
  78.     { /* random filled */ }
  79. _AFXWIN_INLINE CPoint::CPoint(int initX, int initY)
  80.     { x = initX; y = initY; }
  81. _AFXWIN_INLINE CPoint::CPoint(POINT initPt)
  82.     { *(POINT*)this = initPt; }
  83. _AFXWIN_INLINE CPoint::CPoint(SIZE initSize)
  84.     { *(SIZE*)this = initSize; }
  85. _AFXWIN_INLINE CPoint::CPoint(DWORD dwPoint)
  86.     {
  87.         x = (short)LOWORD(dwPoint);
  88.         y = (short)HIWORD(dwPoint);
  89.     }
  90. _AFXWIN_INLINE void CPoint::Offset(int xOffset, int yOffset)
  91.     { x += xOffset; y += yOffset; }
  92. _AFXWIN_INLINE void CPoint::Offset(POINT point)
  93.     { x += point.x; y += point.y; }
  94. _AFXWIN_INLINE void CPoint::Offset(SIZE size)
  95.     { x += size.cx; y += size.cy; }
  96. _AFXWIN_INLINE BOOL CPoint::operator==(POINT point) const
  97.     { return (x == point.x && y == point.y); }
  98. _AFXWIN_INLINE BOOL CPoint::operator!=(POINT point) const
  99.     { return (x != point.x || y != point.y); }
  100. _AFXWIN_INLINE void CPoint::operator+=(SIZE size)
  101.     { x += size.cx; y += size.cy; }
  102. _AFXWIN_INLINE void CPoint::operator-=(SIZE size)
  103.     { x -= size.cx; y -= size.cy; }
  104. _AFXWIN_INLINE void CPoint::operator+=(POINT point)
  105.     { x += point.x; y += point.y; }
  106. _AFXWIN_INLINE void CPoint::operator-=(POINT point)
  107.     { x -= point.x; y -= point.y; }
  108. _AFXWIN_INLINE CPoint CPoint::operator+(SIZE size) const
  109.     { return CPoint(x + size.cx, y + size.cy); }
  110. _AFXWIN_INLINE CPoint CPoint::operator-(SIZE size) const
  111.     { return CPoint(x - size.cx, y - size.cy); }
  112. _AFXWIN_INLINE CPoint CPoint::operator-() const
  113.     { return CPoint(-x, -y); }
  114. _AFXWIN_INLINE CPoint CPoint::operator+(POINT point) const
  115.     { return CPoint(x + point.x, y + point.y); }
  116. _AFXWIN_INLINE CSize CPoint::operator-(POINT point) const
  117.     { return CSize(x - point.x, y - point.y); }
  118. _AFXWIN_INLINE CRect CPoint::operator+(const RECT* lpRect) const
  119.     { return CRect(lpRect) + *this; }
  120. _AFXWIN_INLINE CRect CPoint::operator-(const RECT* lpRect) const
  121.     { return CRect(lpRect) - *this; }
  122.  
  123. // CRect
  124. _AFXWIN_INLINE CRect::CRect()
  125.     { /* random filled */ }
  126. _AFXWIN_INLINE CRect::CRect(int l, int t, int r, int b)
  127.     { left = l; top = t; right = r; bottom = b; }
  128. _AFXWIN_INLINE CRect::CRect(const RECT& srcRect)
  129.     { ::CopyRect(this, &srcRect); }
  130. _AFXWIN_INLINE CRect::CRect(LPCRECT lpSrcRect)
  131.     { ::CopyRect(this, lpSrcRect); }
  132. _AFXWIN_INLINE CRect::CRect(POINT point, SIZE size)
  133.     { right = (left = point.x) + size.cx; bottom = (top = point.y) + size.cy; }
  134. _AFXWIN_INLINE CRect::CRect(POINT topLeft, POINT bottomRight)
  135.     { left = topLeft.x; top = topLeft.y;
  136.         right = bottomRight.x; bottom = bottomRight.y; }
  137. _AFXWIN_INLINE int CRect::Width() const
  138.     { return right - left; }
  139. _AFXWIN_INLINE int CRect::Height() const
  140.     { return bottom - top; }
  141. _AFXWIN_INLINE CSize CRect::Size() const
  142.     { return CSize(right - left, bottom - top); }
  143. _AFXWIN_INLINE CPoint& CRect::TopLeft()
  144.     { return *((CPoint*)this); }
  145. _AFXWIN_INLINE CPoint& CRect::BottomRight()
  146.     { return *((CPoint*)this+1); }
  147. _AFXWIN_INLINE const CPoint& CRect::TopLeft() const
  148.     { return *((CPoint*)this); }
  149. _AFXWIN_INLINE const CPoint& CRect::BottomRight() const
  150.     { return *((CPoint*)this+1); }
  151. _AFXWIN_INLINE CPoint CRect::CenterPoint() const
  152.     { return CPoint((left+right)/2, (top+bottom)/2); }
  153. _AFXWIN_INLINE CRect::operator LPRECT()
  154.     { return this; }
  155. _AFXWIN_INLINE CRect::operator LPCRECT() const
  156.     { return this; }
  157. _AFXWIN_INLINE BOOL CRect::IsRectEmpty() const
  158.     { return ::IsRectEmpty(this); }
  159. _AFXWIN_INLINE BOOL CRect::IsRectNull() const
  160.     { return (left == 0 && right == 0 && top == 0 && bottom == 0); }
  161. _AFXWIN_INLINE BOOL CRect::PtInRect(POINT point) const
  162.     { return ::PtInRect(this, point); }
  163. _AFXWIN_INLINE void CRect::SetRect(int x1, int y1, int x2, int y2)
  164.     { ::SetRect(this, x1, y1, x2, y2); }
  165. _AFXWIN_INLINE void CRect::SetRect(POINT topLeft, POINT bottomRight)
  166.     { ::SetRect(this, topLeft.x, topLeft.y, bottomRight.x, bottomRight.y); }
  167. _AFXWIN_INLINE void CRect::SetRectEmpty()
  168.     { ::SetRectEmpty(this); }
  169. _AFXWIN_INLINE void CRect::CopyRect(LPCRECT lpSrcRect)
  170.     { ::CopyRect(this, lpSrcRect); }
  171. _AFXWIN_INLINE BOOL CRect::EqualRect(LPCRECT lpRect) const
  172.     { return ::EqualRect(this, lpRect); }
  173. _AFXWIN_INLINE void CRect::InflateRect(int x, int y)
  174.     { ::InflateRect(this, x, y); }
  175. _AFXWIN_INLINE void CRect::InflateRect(SIZE size)
  176.     { ::InflateRect(this, size.cx, size.cy); }
  177. _AFXWIN_INLINE void CRect::DeflateRect(int x, int y)
  178.     { ::InflateRect(this, -x, -y); }
  179. _AFXWIN_INLINE void CRect::DeflateRect(SIZE size)
  180.     { ::InflateRect(this, -size.cx, -size.cy); }
  181. _AFXWIN_INLINE void CRect::OffsetRect(int x, int y)
  182.     { ::OffsetRect(this, x, y); }
  183. _AFXWIN_INLINE void CRect::OffsetRect(POINT point)
  184.     { ::OffsetRect(this, point.x, point.y); }
  185. _AFXWIN_INLINE void CRect::OffsetRect(SIZE size)
  186.     { ::OffsetRect(this, size.cx, size.cy); }
  187. _AFXWIN_INLINE BOOL CRect::IntersectRect(LPCRECT lpRect1, LPCRECT lpRect2)
  188.     { return ::IntersectRect(this, lpRect1, lpRect2);}
  189. _AFXWIN_INLINE BOOL CRect::UnionRect(LPCRECT lpRect1, LPCRECT lpRect2)
  190.     { return ::UnionRect(this, lpRect1, lpRect2); }
  191. _AFXWIN_INLINE void CRect::operator=(const RECT& srcRect)
  192.     { ::CopyRect(this, &srcRect); }
  193. _AFXWIN_INLINE BOOL CRect::operator==(const RECT& rect) const
  194.     { return ::EqualRect(this, &rect); }
  195. _AFXWIN_INLINE BOOL CRect::operator!=(const RECT& rect) const
  196.     { return !::EqualRect(this, &rect); }
  197. _AFXWIN_INLINE void CRect::operator+=(POINT point)
  198.     { ::OffsetRect(this, point.x, point.y); }
  199. _AFXWIN_INLINE void CRect::operator+=(SIZE size)
  200.     { ::OffsetRect(this, size.cx, size.cy); }
  201. _AFXWIN_INLINE void CRect::operator+=(LPCRECT lpRect)
  202.     { InflateRect(lpRect); }
  203. _AFXWIN_INLINE void CRect::operator-=(POINT point)
  204.     { ::OffsetRect(this, -point.x, -point.y); }
  205. _AFXWIN_INLINE void CRect::operator-=(SIZE size)
  206.     { ::OffsetRect(this, -size.cx, -size.cy); }
  207. _AFXWIN_INLINE void CRect::operator-=(LPCRECT lpRect)
  208.     { DeflateRect(lpRect); }
  209. _AFXWIN_INLINE void CRect::operator&=(const RECT& rect)
  210.     { ::IntersectRect(this, this, &rect); }
  211. _AFXWIN_INLINE void CRect::operator|=(const RECT& rect)
  212.     { ::UnionRect(this, this, &rect); }
  213. _AFXWIN_INLINE CRect CRect::operator+(POINT pt) const
  214.     { CRect rect(*this); ::OffsetRect(&rect, pt.x, pt.y); return rect; }
  215. _AFXWIN_INLINE CRect CRect::operator-(POINT pt) const
  216.     { CRect rect(*this); ::OffsetRect(&rect, -pt.x, -pt.y); return rect; }
  217. _AFXWIN_INLINE CRect CRect::operator+(SIZE size) const
  218.     { CRect rect(*this); ::OffsetRect(&rect, size.cx, size.cy); return rect; }
  219. _AFXWIN_INLINE CRect CRect::operator-(SIZE size) const
  220.     { CRect rect(*this); ::OffsetRect(&rect, -size.cx, -size.cy); return rect; }
  221. _AFXWIN_INLINE CRect CRect::operator+(LPCRECT lpRect) const
  222.     { CRect rect(this); rect.InflateRect(lpRect); return rect; }
  223. _AFXWIN_INLINE CRect CRect::operator-(LPCRECT lpRect) const
  224.     { CRect rect(this); rect.DeflateRect(lpRect); return rect; }
  225. _AFXWIN_INLINE CRect CRect::operator&(const RECT& rect2) const
  226.     { CRect rect; ::IntersectRect(&rect, this, &rect2);
  227.         return rect; }
  228. _AFXWIN_INLINE CRect CRect::operator|(const RECT& rect2) const
  229.     { CRect rect; ::UnionRect(&rect, this, &rect2);
  230.         return rect; }
  231. _AFXWIN_INLINE BOOL CRect::SubtractRect(LPCRECT lpRectSrc1, LPCRECT lpRectSrc2)
  232.     { return ::SubtractRect(this, lpRectSrc1, lpRectSrc2); }
  233.  
  234. // CArchive output helpers
  235. _AFXWIN_INLINE CArchive& AFXAPI operator<<(CArchive& ar, SIZE size)
  236.     { ar.Write(&size, sizeof(SIZE)); return ar; }
  237. _AFXWIN_INLINE CArchive& AFXAPI operator<<(CArchive& ar, POINT point)
  238.     { ar.Write(&point, sizeof(POINT)); return ar; }
  239. _AFXWIN_INLINE CArchive& AFXAPI operator<<(CArchive& ar, const RECT& rect)
  240.     { ar.Write(&rect, sizeof(RECT)); return ar; }
  241. _AFXWIN_INLINE CArchive& AFXAPI operator>>(CArchive& ar, SIZE& size)
  242.     { ar.Read(&size, sizeof(SIZE)); return ar; }
  243. _AFXWIN_INLINE CArchive& AFXAPI operator>>(CArchive& ar, POINT& point)
  244.     { ar.Read(&point, sizeof(POINT)); return ar; }
  245. _AFXWIN_INLINE CArchive& AFXAPI operator>>(CArchive& ar, RECT& rect)
  246.     { ar.Read(&rect, sizeof(RECT)); return ar; }
  247.  
  248. // exception support
  249. _AFXWIN_INLINE CResourceException::CResourceException()
  250.     : CSimpleException() { }
  251. _AFXWIN_INLINE CResourceException::CResourceException(BOOL bAutoDelete, UINT nResourceID)
  252.     : CSimpleException(bAutoDelete) { m_nResourceID = nResourceID; }
  253. _AFXWIN_INLINE CResourceException::~CResourceException()
  254.     { }
  255. _AFXWIN_INLINE CUserException::CUserException()
  256.     : CSimpleException() { }
  257. _AFXWIN_INLINE CUserException::CUserException(BOOL bAutoDelete, UINT nResourceID)
  258.     : CSimpleException(bAutoDelete) { m_nResourceID = nResourceID; }
  259. _AFXWIN_INLINE CUserException::~CUserException()
  260.     { }
  261.  
  262. // CGdiObject
  263. _AFXWIN_INLINE CGdiObject::operator HGDIOBJ() const
  264.     { return this == NULL ? NULL : m_hObject; }
  265. _AFXWIN_INLINE HGDIOBJ CGdiObject::GetSafeHandle() const
  266.     { return this == NULL ? NULL : m_hObject; }
  267. _AFXWIN_INLINE CGdiObject::CGdiObject()
  268.     { m_hObject = NULL; }
  269. _AFXWIN_INLINE CGdiObject::~CGdiObject()
  270.     { DeleteObject(); }
  271. _AFXWIN_INLINE int CGdiObject::GetObject(int nCount, LPVOID lpObject) const
  272.     { ASSERT(m_hObject != NULL); return ::GetObject(m_hObject, nCount, lpObject); }
  273. _AFXWIN_INLINE BOOL CGdiObject::CreateStockObject(int nIndex)
  274.     { return (m_hObject = ::GetStockObject(nIndex)) != NULL; }
  275. _AFXWIN_INLINE BOOL CGdiObject::UnrealizeObject()
  276.     { ASSERT(m_hObject != NULL); return ::UnrealizeObject(m_hObject); }
  277. _AFXWIN_INLINE UINT CGdiObject::GetObjectType() const
  278.     { return (UINT)::GetObjectType(m_hObject); }
  279.  
  280. // CPen
  281. _AFXWIN_INLINE CPen::operator HPEN() const
  282.     { return (HPEN)(this == NULL ? NULL : m_hObject); }
  283. _AFXWIN_INLINE CPen* PASCAL CPen::FromHandle(HPEN hPen)
  284.     { return (CPen*) CGdiObject::FromHandle(hPen); }
  285. _AFXWIN_INLINE CPen::CPen()
  286.     { }
  287. _AFXWIN_INLINE CPen::~CPen()
  288.     { }
  289. _AFXWIN_INLINE BOOL CPen::CreatePen(int nPenStyle, int nWidth, COLORREF crColor)
  290.     { return Attach(::CreatePen(nPenStyle, nWidth, crColor)); }
  291. _AFXWIN_INLINE BOOL CPen::CreatePenIndirect(LPLOGPEN lpLogPen)
  292.     { return Attach(::CreatePenIndirect(lpLogPen)); }
  293. #ifndef _MAC
  294. _AFXWIN_INLINE BOOL CPen::CreatePen(int nPenStyle, int nWidth, const LOGBRUSH* pLogBrush,
  295.         int nStyleCount, const DWORD* lpStyle)
  296.     { return Attach(::ExtCreatePen(nPenStyle, nWidth, pLogBrush, nStyleCount,
  297.         lpStyle)); }
  298. _AFXWIN_INLINE int CPen::GetExtLogPen(EXTLOGPEN* pLogPen)
  299.     { ASSERT(m_hObject != NULL);
  300.         return ::GetObject(m_hObject, sizeof(EXTLOGPEN), pLogPen); }
  301. #endif
  302. _AFXWIN_INLINE int CPen::GetLogPen(LOGPEN* pLogPen)
  303.     { ASSERT(m_hObject != NULL);
  304.         return ::GetObject(m_hObject, sizeof(LOGPEN), pLogPen); }
  305.  
  306. // CBrush
  307. _AFXWIN_INLINE CBrush::operator HBRUSH() const
  308.     { return (HBRUSH)(this == NULL ? NULL : m_hObject); }
  309. _AFXWIN_INLINE CBrush* PASCAL CBrush::FromHandle(HBRUSH hBrush)
  310.     { return (CBrush*) CGdiObject::FromHandle(hBrush); }
  311. _AFXWIN_INLINE CBrush::CBrush()
  312.     { }
  313. _AFXWIN_INLINE CBrush::~CBrush()
  314.     { }
  315. _AFXWIN_INLINE BOOL CBrush::CreateSolidBrush(COLORREF crColor)
  316.     { return Attach(::CreateSolidBrush(crColor)); }
  317. _AFXWIN_INLINE BOOL CBrush::CreateHatchBrush(int nIndex, COLORREF crColor)
  318.     { return Attach(::CreateHatchBrush(nIndex, crColor)); }
  319. _AFXWIN_INLINE BOOL CBrush::CreateBrushIndirect(LPLOGBRUSH lpLogBrush)
  320.     { return Attach(::CreateBrushIndirect(lpLogBrush)); }
  321. _AFXWIN_INLINE BOOL CBrush::CreatePatternBrush(CBitmap* pBitmap)
  322.     { return Attach(::CreatePatternBrush((HBITMAP)pBitmap->GetSafeHandle())); }
  323. _AFXWIN_INLINE BOOL CBrush::CreateDIBPatternBrush(const void* lpPackedDIB, UINT nUsage)
  324.     { return Attach(::CreateDIBPatternBrushPt(lpPackedDIB, nUsage)); }
  325. _AFXWIN_INLINE BOOL CBrush::CreateSysColorBrush(int nIndex)
  326.     { return Attach(::GetSysColorBrush(nIndex)); }
  327. _AFXWIN_INLINE int CBrush::GetLogBrush(LOGBRUSH* pLogBrush)
  328.     { ASSERT(m_hObject != NULL);
  329.         return ::GetObject(m_hObject, sizeof(LOGBRUSH), pLogBrush); }
  330.  
  331. // CFont
  332. _AFXWIN_INLINE CFont::operator HFONT() const
  333.     { return (HFONT)(this == NULL ? NULL : m_hObject); }
  334. _AFXWIN_INLINE CFont* PASCAL CFont::FromHandle(HFONT hFont)
  335.     { return (CFont*) CGdiObject::FromHandle(hFont); }
  336. _AFXWIN_INLINE CFont::CFont()
  337.     { }
  338. _AFXWIN_INLINE CFont::~CFont()
  339.     { }
  340. _AFXWIN_INLINE BOOL CFont::CreateFontIndirect(const LOGFONT* lpLogFont)
  341.     { return Attach(::CreateFontIndirect(lpLogFont)); }
  342. _AFXWIN_INLINE BOOL CFont::CreateFont(int nHeight, int nWidth, int nEscapement,
  343.         int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline,
  344.         BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision,
  345.         BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily,
  346.         LPCTSTR lpszFacename)
  347.     { return Attach(::CreateFont(nHeight, nWidth, nEscapement,
  348.         nOrientation, nWeight, bItalic, bUnderline, cStrikeOut,
  349.         nCharSet, nOutPrecision, nClipPrecision, nQuality,
  350.         nPitchAndFamily, lpszFacename)); }
  351. _AFXWIN_INLINE int CFont::GetLogFont(LOGFONT* pLogFont)
  352.     { ASSERT(m_hObject != NULL);
  353.         return ::GetObject(m_hObject, sizeof(LOGFONT), pLogFont); }
  354.  
  355. // CBitmap
  356. _AFXWIN_INLINE CBitmap::operator HBITMAP() const
  357.     { return (HBITMAP)(this == NULL ? NULL : m_hObject); }
  358. _AFXWIN_INLINE CBitmap* PASCAL CBitmap::FromHandle(HBITMAP hBitmap)
  359.     { return (CBitmap*) CGdiObject::FromHandle(hBitmap); }
  360. _AFXWIN_INLINE CBitmap::CBitmap()
  361.     { }
  362. _AFXWIN_INLINE CBitmap::~CBitmap()
  363.     { }
  364. _AFXWIN_INLINE BOOL CBitmap::CreateBitmap(int nWidth, int nHeight, UINT nPlanes,
  365.      UINT nBitcount, const void* lpBits)
  366.     { return Attach(::CreateBitmap(nWidth, nHeight, nPlanes, nBitcount, lpBits)); }
  367. _AFXWIN_INLINE BOOL CBitmap::CreateBitmapIndirect(LPBITMAP lpBitmap)
  368.     { return Attach(::CreateBitmapIndirect(lpBitmap)); }
  369.  
  370. _AFXWIN_INLINE DWORD CBitmap::SetBitmapBits(DWORD dwCount, const void* lpBits)
  371.     { return ::SetBitmapBits((HBITMAP)m_hObject, dwCount, lpBits); }
  372. _AFXWIN_INLINE DWORD CBitmap::GetBitmapBits(DWORD dwCount, LPVOID lpBits) const
  373.     { return ::GetBitmapBits((HBITMAP)m_hObject, dwCount, lpBits); }
  374. _AFXWIN_INLINE BOOL CBitmap::LoadBitmap(LPCTSTR lpszResourceName)
  375.     { return Attach(::LoadBitmap(AfxFindResourceHandle(
  376.         lpszResourceName, RT_BITMAP), lpszResourceName));}
  377. _AFXWIN_INLINE BOOL CBitmap::LoadMappedBitmap(UINT nIDBitmap, UINT nFlags,
  378.     LPCOLORMAP lpColorMap, int nMapSize)
  379.     { return Attach(::CreateMappedBitmap(AfxFindResourceHandle(
  380.         MAKEINTRESOURCE(nIDBitmap), RT_BITMAP), nIDBitmap, (WORD)nFlags,
  381.         lpColorMap, nMapSize)); }
  382. _AFXWIN_INLINE CSize CBitmap::SetBitmapDimension(int nWidth, int nHeight)
  383.     {
  384.         SIZE size;
  385.         VERIFY(::SetBitmapDimensionEx((HBITMAP)m_hObject, nWidth, nHeight, &size));
  386.         return size;
  387.     }
  388. _AFXWIN_INLINE CSize CBitmap::GetBitmapDimension() const
  389.     {
  390.         SIZE size;
  391.         VERIFY(::GetBitmapDimensionEx((HBITMAP)m_hObject, &size));
  392.         return size;
  393.     }
  394.  
  395. _AFXWIN_INLINE BOOL CBitmap::LoadBitmap(UINT nIDResource)
  396.     { return Attach(::LoadBitmap(AfxFindResourceHandle(
  397.         MAKEINTRESOURCE(nIDResource), RT_BITMAP), MAKEINTRESOURCE(nIDResource))); }
  398. #ifndef _MAC
  399. _AFXWIN_INLINE BOOL CBitmap::LoadOEMBitmap(UINT nIDBitmap)
  400.     { return Attach(::LoadBitmap(NULL, MAKEINTRESOURCE(nIDBitmap))); }
  401. #endif
  402. _AFXWIN_INLINE BOOL CBitmap::CreateCompatibleBitmap(CDC* pDC, int nWidth, int nHeight)
  403.     { return Attach(::CreateCompatibleBitmap(pDC->m_hDC, nWidth, nHeight)); }
  404. _AFXWIN_INLINE BOOL CBitmap::CreateDiscardableBitmap(CDC* pDC, int nWidth, int nHeight)
  405.     { return Attach(::CreateDiscardableBitmap(pDC->m_hDC, nWidth, nHeight)); }
  406. _AFXWIN_INLINE int CBitmap::GetBitmap(BITMAP* pBitMap)
  407.     { ASSERT(m_hObject != NULL);
  408.         return ::GetObject(m_hObject, sizeof(BITMAP), pBitMap); }
  409.  
  410. // CPalette
  411. _AFXWIN_INLINE CPalette::operator HPALETTE() const
  412.     { return (HPALETTE)(this == NULL ? NULL : m_hObject); }
  413. _AFXWIN_INLINE CPalette* PASCAL CPalette::FromHandle(HPALETTE hPalette)
  414.     { return (CPalette*) CGdiObject::FromHandle(hPalette); }
  415. _AFXWIN_INLINE CPalette::CPalette()
  416.     { }
  417. _AFXWIN_INLINE CPalette::~CPalette()
  418.     { }
  419. _AFXWIN_INLINE BOOL CPalette::CreatePalette(LPLOGPALETTE lpLogPalette)
  420.     { return Attach(::CreatePalette(lpLogPalette)); }
  421. #ifndef _MAC
  422. _AFXWIN_INLINE BOOL CPalette::CreateHalftonePalette(CDC* pDC)
  423.     { ASSERT(pDC != NULL && pDC->m_hDC != NULL); return Attach(
  424.         ::CreateHalftonePalette(pDC->m_hDC)); }
  425. #endif
  426. _AFXWIN_INLINE UINT CPalette::GetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
  427.         LPPALETTEENTRY lpPaletteColors) const
  428.     { ASSERT(m_hObject != NULL); return ::GetPaletteEntries((HPALETTE)m_hObject, nStartIndex,
  429.         nNumEntries, lpPaletteColors); }
  430. _AFXWIN_INLINE UINT CPalette::SetPaletteEntries(UINT nStartIndex, UINT nNumEntries,
  431.         LPPALETTEENTRY lpPaletteColors)
  432.     { ASSERT(m_hObject != NULL); return ::SetPaletteEntries((HPALETTE)m_hObject, nStartIndex,
  433.         nNumEntries, lpPaletteColors); }
  434. #ifndef _MAC
  435. _AFXWIN_INLINE void CPalette::AnimatePalette(UINT nStartIndex, UINT nNumEntries,
  436.         LPPALETTEENTRY lpPaletteColors)
  437.     { ASSERT(m_hObject != NULL); ::AnimatePalette((HPALETTE)m_hObject, nStartIndex, nNumEntries,
  438.             lpPaletteColors); }
  439. #endif
  440. _AFXWIN_INLINE UINT CPalette::GetNearestPaletteIndex(COLORREF crColor) const
  441.     { ASSERT(m_hObject != NULL); return ::GetNearestPaletteIndex((HPALETTE)m_hObject, crColor); }
  442. _AFXWIN_INLINE BOOL CPalette::ResizePalette(UINT nNumEntries)
  443.     { ASSERT(m_hObject != NULL); return ::ResizePalette((HPALETTE)m_hObject, nNumEntries); }
  444. _AFXWIN_INLINE int CPalette::GetEntryCount()
  445.     { ASSERT(m_hObject != NULL); WORD nEntries;
  446.          ::GetObject(m_hObject, sizeof(WORD), &nEntries); return (int)nEntries; }
  447.  
  448. // CRgn
  449. _AFXWIN_INLINE CRgn::operator HRGN() const
  450.     { return (HRGN)(this == NULL ? NULL : m_hObject); }
  451. _AFXWIN_INLINE CRgn* PASCAL CRgn::FromHandle(HRGN hRgn)
  452.     { return (CRgn*) CGdiObject::FromHandle(hRgn); }
  453. _AFXWIN_INLINE CRgn::CRgn()
  454.     { }
  455. _AFXWIN_INLINE CRgn::~CRgn()
  456.     { }
  457. _AFXWIN_INLINE BOOL CRgn::CreateRectRgn(int x1, int y1, int x2, int y2)
  458.     { return Attach(::CreateRectRgn(x1, y1, x2, y2)); }
  459. _AFXWIN_INLINE BOOL CRgn::CreateRectRgnIndirect(LPCRECT lpRect)
  460.     { return Attach(::CreateRectRgnIndirect(lpRect)); }
  461. _AFXWIN_INLINE BOOL CRgn::CreateEllipticRgn(int x1, int y1, int x2, int y2)
  462.     { return Attach(::CreateEllipticRgn(x1, y1, x2, y2)); }
  463. _AFXWIN_INLINE BOOL CRgn::CreateEllipticRgnIndirect(LPCRECT lpRect)
  464.     { return Attach(::CreateEllipticRgnIndirect(lpRect)); }
  465. _AFXWIN_INLINE BOOL CRgn::CreatePolygonRgn(LPPOINT lpPoints, int nCount, int nMode)
  466.     { return Attach(::CreatePolygonRgn(lpPoints, nCount, nMode)); }
  467. #ifndef _MAC
  468. _AFXWIN_INLINE BOOL CRgn::CreatePolyPolygonRgn(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount, int nPolyFillMode)
  469.     { return Attach(::CreatePolyPolygonRgn(lpPoints, lpPolyCounts, nCount, nPolyFillMode)); }
  470. #endif
  471. _AFXWIN_INLINE BOOL CRgn::CreateRoundRectRgn(int x1, int y1, int x2, int y2, int x3, int y3)
  472.     { return Attach(::CreateRoundRectRgn(x1, y1, x2, y2, x3, y3)); }
  473. #ifndef _MAC
  474. _AFXWIN_INLINE BOOL CRgn::CreateFromPath(CDC* pDC)
  475.     { ASSERT(pDC != NULL); return Attach(::PathToRegion(pDC->m_hDC)); }
  476. _AFXWIN_INLINE BOOL CRgn::CreateFromData(const XFORM* lpXForm, int nCount, const RGNDATA* pRgnData)
  477.     { return Attach(::ExtCreateRegion(lpXForm, nCount, pRgnData)); }
  478. _AFXWIN_INLINE int CRgn::GetRegionData(LPRGNDATA lpRgnData, int nDataSize) const
  479.     { ASSERT(m_hObject != NULL); return (int)::GetRegionData((HRGN)m_hObject, nDataSize, lpRgnData); }
  480. #endif
  481. _AFXWIN_INLINE void CRgn::SetRectRgn(int x1, int y1, int x2, int y2)
  482.     { ASSERT(m_hObject != NULL); ::SetRectRgn((HRGN)m_hObject, x1, y1, x2, y2); }
  483. _AFXWIN_INLINE void CRgn::SetRectRgn(LPCRECT lpRect)
  484.     { ASSERT(m_hObject != NULL); ::SetRectRgn((HRGN)m_hObject, lpRect->left, lpRect->top,
  485.         lpRect->right, lpRect->bottom); }
  486. _AFXWIN_INLINE int CRgn::CombineRgn(CRgn* pRgn1, CRgn* pRgn2, int nCombineMode)
  487.     { ASSERT(m_hObject != NULL); return ::CombineRgn((HRGN)m_hObject, (HRGN)pRgn1->GetSafeHandle(),
  488.         (HRGN)pRgn2->GetSafeHandle(), nCombineMode); }
  489. _AFXWIN_INLINE int CRgn::CopyRgn(CRgn* pRgnSrc)
  490.     { ASSERT(m_hObject != NULL); return ::CombineRgn((HRGN)m_hObject, (HRGN)pRgnSrc->GetSafeHandle(), NULL, RGN_COPY); }
  491. _AFXWIN_INLINE BOOL CRgn::EqualRgn(CRgn* pRgn) const
  492.     { ASSERT(m_hObject != NULL); return ::EqualRgn((HRGN)m_hObject, (HRGN)pRgn->GetSafeHandle()); }
  493. _AFXWIN_INLINE int CRgn::OffsetRgn(int x, int y)
  494.     { ASSERT(m_hObject != NULL); return ::OffsetRgn((HRGN)m_hObject, x, y); }
  495. _AFXWIN_INLINE int CRgn::OffsetRgn(POINT point)
  496.     { ASSERT(m_hObject != NULL); return ::OffsetRgn((HRGN)m_hObject, point.x, point.y); }
  497. _AFXWIN_INLINE int CRgn::GetRgnBox(LPRECT lpRect) const
  498.     { ASSERT(m_hObject != NULL); return ::GetRgnBox((HRGN)m_hObject, lpRect); }
  499. _AFXWIN_INLINE BOOL CRgn::PtInRegion(int x, int y) const
  500.     { ASSERT(m_hObject != NULL); return ::PtInRegion((HRGN)m_hObject, x, y); }
  501. _AFXWIN_INLINE BOOL CRgn::PtInRegion(POINT point) const
  502.     { ASSERT(m_hObject != NULL); return ::PtInRegion((HRGN)m_hObject, point.x, point.y); }
  503. _AFXWIN_INLINE BOOL CRgn::RectInRegion(LPCRECT lpRect) const
  504.     { ASSERT(m_hObject != NULL); return ::RectInRegion((HRGN)m_hObject, lpRect); }
  505.  
  506. // CDC
  507. _AFXWIN_INLINE CDC::operator HDC() const
  508.     { return this == NULL ? NULL : m_hDC; }
  509. _AFXWIN_INLINE HDC CDC::GetSafeHdc() const
  510.     { return this == NULL ? NULL : m_hDC; }
  511. #ifndef _MAC
  512. _AFXWIN_INLINE CWnd* CDC::GetWindow() const
  513.     { ASSERT(m_hDC != NULL); return CWnd::FromHandle(::WindowFromDC(m_hDC)); }
  514. #endif
  515. _AFXWIN_INLINE BOOL CDC::IsPrinting() const
  516.     { return m_bPrinting; }
  517. _AFXWIN_INLINE BOOL CDC::CreateDC(LPCTSTR lpszDriverName,
  518.     LPCTSTR lpszDeviceName, LPCTSTR lpszOutput, const void* lpInitData)
  519.     { return Attach(::CreateDC(lpszDriverName,
  520.         lpszDeviceName, lpszOutput, (const DEVMODE*)lpInitData)); }
  521. _AFXWIN_INLINE BOOL CDC::CreateIC(LPCTSTR lpszDriverName,
  522.     LPCTSTR lpszDeviceName, LPCTSTR lpszOutput, const void* lpInitData)
  523.     { return Attach(::CreateIC(lpszDriverName,
  524.         lpszDeviceName, lpszOutput, (const DEVMODE*) lpInitData)); }
  525. _AFXWIN_INLINE BOOL CDC::CreateCompatibleDC(CDC* pDC)
  526.     { return Attach(::CreateCompatibleDC(pDC->GetSafeHdc())); }
  527. _AFXWIN_INLINE int CDC::ExcludeUpdateRgn(CWnd* pWnd)
  528.     { ASSERT(m_hDC != NULL); return ::ExcludeUpdateRgn(m_hDC, pWnd->m_hWnd); }
  529. _AFXWIN_INLINE int CDC::GetDeviceCaps(int nIndex) const
  530.     { ASSERT(m_hAttribDC != NULL); return ::GetDeviceCaps(m_hAttribDC, nIndex); }
  531. _AFXWIN_INLINE CPoint CDC::GetBrushOrg() const
  532.     {
  533.         ASSERT(m_hDC != NULL);
  534.         POINT point;
  535.         VERIFY(::GetBrushOrgEx(m_hDC, &point));
  536.         return point;
  537.     }
  538. _AFXWIN_INLINE CPoint CDC::SetBrushOrg(int x, int y)
  539.     {
  540.         ASSERT(m_hDC != NULL);
  541.         POINT point;
  542.         VERIFY(::SetBrushOrgEx(m_hDC, x, y, &point));
  543.         return point;
  544.     }
  545. _AFXWIN_INLINE CPoint CDC::SetBrushOrg(POINT point)
  546.     {
  547.         ASSERT(m_hDC != NULL);
  548.         VERIFY(::SetBrushOrgEx(m_hDC, point.x, point.y, &point));
  549.         return point;
  550.     }
  551.  
  552. _AFXWIN_INLINE int CDC::EnumObjects(int nObjectType,
  553.         int (CALLBACK* lpfn)(LPVOID, LPARAM), LPARAM lpData)
  554.     { ASSERT(m_hAttribDC != NULL); return ::EnumObjects(m_hAttribDC, nObjectType, (GOBJENUMPROC)lpfn, lpData); }
  555.  
  556. _AFXWIN_INLINE CBitmap* CDC::SelectObject(CBitmap* pBitmap)
  557.     { ASSERT(m_hDC != NULL); return (CBitmap*) SelectGdiObject(m_hDC, pBitmap->GetSafeHandle()); }
  558. _AFXWIN_INLINE CGdiObject* CDC::SelectObject(CGdiObject* pObject)
  559.     { ASSERT(m_hDC != NULL); return SelectGdiObject(m_hDC, pObject->GetSafeHandle()); }
  560. _AFXWIN_INLINE HGDIOBJ CDC::SelectObject(HGDIOBJ hObject) // Safe for NULL handles
  561.     { ASSERT(m_hDC == m_hAttribDC); // ASSERT a simple CDC object
  562.         return (hObject != NULL) ? ::SelectObject(m_hDC, hObject) : NULL; }
  563. _AFXWIN_INLINE COLORREF CDC::GetNearestColor(COLORREF crColor) const
  564.     { ASSERT(m_hAttribDC != NULL); return ::GetNearestColor(m_hAttribDC, crColor); }
  565. _AFXWIN_INLINE UINT CDC::RealizePalette()
  566.     { ASSERT(m_hDC != NULL); return ::RealizePalette(m_hDC); }
  567. _AFXWIN_INLINE void CDC::UpdateColors()
  568.     { ASSERT(m_hDC != NULL); ::UpdateColors(m_hDC); }
  569. _AFXWIN_INLINE COLORREF CDC::GetBkColor() const
  570.     { ASSERT(m_hAttribDC != NULL); return ::GetBkColor(m_hAttribDC); }
  571. _AFXWIN_INLINE int CDC::GetBkMode() const
  572.     { ASSERT(m_hAttribDC != NULL); return ::GetBkMode(m_hAttribDC); }
  573. _AFXWIN_INLINE int CDC::GetPolyFillMode() const
  574.     { ASSERT(m_hAttribDC != NULL); return ::GetPolyFillMode(m_hAttribDC); }
  575. _AFXWIN_INLINE int CDC::GetROP2() const
  576.     { ASSERT(m_hAttribDC != NULL); return ::GetROP2(m_hAttribDC); }
  577. _AFXWIN_INLINE int CDC::GetStretchBltMode() const
  578.     { ASSERT(m_hAttribDC != NULL); return ::GetStretchBltMode(m_hAttribDC); }
  579. _AFXWIN_INLINE COLORREF CDC::GetTextColor() const
  580.     { ASSERT(m_hAttribDC != NULL); return ::GetTextColor(m_hAttribDC); }
  581. _AFXWIN_INLINE int CDC::GetMapMode() const
  582.     { ASSERT(m_hAttribDC != NULL); return ::GetMapMode(m_hAttribDC); }
  583.  
  584. _AFXWIN_INLINE CPoint CDC::GetViewportOrg() const
  585.     {
  586.         ASSERT(m_hAttribDC != NULL);
  587.         POINT point;
  588.         VERIFY(::GetViewportOrgEx(m_hAttribDC, &point));
  589.         return point;
  590.     }
  591. _AFXWIN_INLINE CSize CDC::GetViewportExt() const
  592.     {
  593.         ASSERT(m_hAttribDC != NULL);
  594.         SIZE size;
  595.         VERIFY(::GetViewportExtEx(m_hAttribDC, &size));
  596.         return size;
  597.     }
  598. _AFXWIN_INLINE CPoint CDC::GetWindowOrg() const
  599.     {
  600.         ASSERT(m_hAttribDC != NULL);
  601.         POINT point;
  602.         VERIFY(::GetWindowOrgEx(m_hAttribDC, &point));
  603.         return point;
  604.     }
  605. _AFXWIN_INLINE CSize CDC::GetWindowExt() const
  606.     {
  607.         ASSERT(m_hAttribDC != NULL);
  608.         SIZE size;
  609.         VERIFY(::GetWindowExtEx(m_hAttribDC, &size));
  610.         return size;
  611.     }
  612.  
  613. // non-virtual helpers calling virtual mapping functions
  614. _AFXWIN_INLINE CPoint CDC::SetViewportOrg(POINT point)
  615.     { ASSERT(m_hDC != NULL); return SetViewportOrg(point.x, point.y); }
  616. _AFXWIN_INLINE CSize CDC::SetViewportExt(SIZE size)
  617.     { ASSERT(m_hDC != NULL); return SetViewportExt(size.cx, size.cy); }
  618. _AFXWIN_INLINE CPoint CDC::SetWindowOrg(POINT point)
  619.     { ASSERT(m_hDC != NULL); return SetWindowOrg(point.x, point.y); }
  620. _AFXWIN_INLINE CSize CDC::SetWindowExt(SIZE size)
  621.     { ASSERT(m_hDC != NULL); return SetWindowExt(size.cx, size.cy); }
  622.  
  623. _AFXWIN_INLINE void CDC::DPtoLP(LPPOINT lpPoints, int nCount) const
  624.     { ASSERT(m_hAttribDC != NULL); VERIFY(::DPtoLP(m_hAttribDC, lpPoints, nCount)); }
  625. _AFXWIN_INLINE void CDC::DPtoLP(LPRECT lpRect) const
  626.     { ASSERT(m_hAttribDC != NULL); VERIFY(::DPtoLP(m_hAttribDC, (LPPOINT)lpRect, 2)); }
  627. _AFXWIN_INLINE void CDC::LPtoDP(LPPOINT lpPoints, int nCount) const
  628.     { ASSERT(m_hAttribDC != NULL); VERIFY(::LPtoDP(m_hAttribDC, lpPoints, nCount)); }
  629. _AFXWIN_INLINE void CDC::LPtoDP(LPRECT lpRect) const
  630.     { ASSERT(m_hAttribDC != NULL); VERIFY(::LPtoDP(m_hAttribDC, (LPPOINT)lpRect, 2)); }
  631.  
  632. _AFXWIN_INLINE BOOL CDC::FillRgn(CRgn* pRgn, CBrush* pBrush)
  633.     { ASSERT(m_hDC != NULL); return ::FillRgn(m_hDC, (HRGN)pRgn->GetSafeHandle(), (HBRUSH)pBrush->GetSafeHandle()); }
  634. _AFXWIN_INLINE BOOL CDC::FrameRgn(CRgn* pRgn, CBrush* pBrush, int nWidth, int nHeight)
  635.     { ASSERT(m_hDC != NULL); return ::FrameRgn(m_hDC, (HRGN)pRgn->GetSafeHandle(), (HBRUSH)pBrush->GetSafeHandle(),
  636.         nWidth, nHeight); }
  637. _AFXWIN_INLINE BOOL CDC::InvertRgn(CRgn* pRgn)
  638.     { ASSERT(m_hDC != NULL); return ::InvertRgn(m_hDC, (HRGN)pRgn->GetSafeHandle()); }
  639. _AFXWIN_INLINE BOOL CDC::PaintRgn(CRgn* pRgn)
  640.     { ASSERT(m_hDC != NULL); return ::PaintRgn(m_hDC, (HRGN)pRgn->GetSafeHandle()); }
  641. _AFXWIN_INLINE BOOL CDC::PtVisible(int x, int y) const
  642.     { ASSERT(m_hDC != NULL); return ::PtVisible(m_hDC, x, y); }
  643. _AFXWIN_INLINE BOOL CDC::PtVisible(POINT point) const
  644.     { ASSERT(m_hDC != NULL); return PtVisible(point.x, point.y); } // call virtual
  645. _AFXWIN_INLINE BOOL CDC::RectVisible(LPCRECT lpRect) const
  646.     { ASSERT(m_hDC != NULL); return ::RectVisible(m_hDC, lpRect); }
  647. _AFXWIN_INLINE CPoint CDC::GetCurrentPosition() const
  648.     {
  649.         ASSERT(m_hAttribDC != NULL);
  650.         POINT point;
  651.         VERIFY(::GetCurrentPositionEx(m_hAttribDC, &point));
  652.         return point;
  653.     }
  654.  
  655. _AFXWIN_INLINE CPoint CDC::MoveTo(POINT point)
  656.     { ASSERT(m_hDC != NULL); return MoveTo(point.x, point.y); }
  657. _AFXWIN_INLINE BOOL CDC::LineTo(POINT point)
  658.     { ASSERT(m_hDC != NULL); return LineTo(point.x, point.y); }
  659. _AFXWIN_INLINE BOOL CDC::Arc(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  660.     { ASSERT(m_hDC != NULL); return ::Arc(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); }
  661. _AFXWIN_INLINE BOOL CDC::Arc(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  662.     { ASSERT(m_hDC != NULL); return ::Arc(m_hDC, lpRect->left, lpRect->top,
  663.         lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
  664.         ptEnd.x, ptEnd.y); }
  665. _AFXWIN_INLINE BOOL CDC::Polyline(LPPOINT lpPoints, int nCount)
  666.     { ASSERT(m_hDC != NULL); return ::Polyline(m_hDC, lpPoints, nCount); }
  667. _AFXWIN_INLINE void CDC::FillRect(LPCRECT lpRect, CBrush* pBrush)
  668.     { ASSERT(m_hDC != NULL); ::FillRect(m_hDC, lpRect, (HBRUSH)pBrush->GetSafeHandle()); }
  669. _AFXWIN_INLINE void CDC::FrameRect(LPCRECT lpRect, CBrush* pBrush)
  670.     { ASSERT(m_hDC != NULL); ::FrameRect(m_hDC, lpRect, (HBRUSH)pBrush->GetSafeHandle()); }
  671. _AFXWIN_INLINE void CDC::InvertRect(LPCRECT lpRect)
  672.     { ASSERT(m_hDC != NULL); ::InvertRect(m_hDC, lpRect); }
  673. _AFXWIN_INLINE BOOL CDC::DrawIcon(int x, int y, HICON hIcon)
  674.     { ASSERT(m_hDC != NULL); return ::DrawIcon(m_hDC, x, y, hIcon); }
  675. _AFXWIN_INLINE BOOL CDC::DrawIcon(POINT point, HICON hIcon)
  676.     { ASSERT(m_hDC != NULL); return ::DrawIcon(m_hDC, point.x, point.y, hIcon); }
  677. #ifndef _MAC
  678. #if (WINVER >= 0x400)
  679. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, HBITMAP hBitmap, UINT nFlags, HBRUSH hBrush)
  680.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush,
  681.         NULL, (LPARAM)hBitmap, 0, pt.x, pt.y, size.cx, size.cy, nFlags|DST_BITMAP); }
  682. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, CBitmap* pBitmap, UINT nFlags, CBrush* pBrush)
  683.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, (HBRUSH)pBrush->GetSafeHandle(),
  684.         NULL, (LPARAM)pBitmap->GetSafeHandle(), 0, pt.x, pt.y, size.cx, size.cy, nFlags|DST_BITMAP); }
  685. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, HICON hIcon, UINT nFlags, HBRUSH hBrush)
  686.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush, NULL,
  687.         (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags|DST_ICON); }
  688. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, HICON hIcon, UINT nFlags, CBrush* pBrush)
  689.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, (HBRUSH)pBrush->GetSafeHandle(), NULL,
  690.         (LPARAM)hIcon, 0, pt.x, pt.y, size.cx, size.cy, nFlags|DST_ICON); }
  691. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText, int nTextLen, HBRUSH hBrush)
  692.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush,
  693.         NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags|(bPrefixText ? DST_PREFIXTEXT : DST_TEXT)); }
  694. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, LPCTSTR lpszText, UINT nFlags, BOOL bPrefixText, int nTextLen, CBrush* pBrush)
  695.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, (HBRUSH)pBrush->GetSafeHandle(),
  696.         NULL, (LPARAM)lpszText, (WPARAM)nTextLen, pt.x, pt.y, size.cx, size.cy, nFlags|(bPrefixText ? DST_PREFIXTEXT : DST_TEXT)); }
  697. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, HBRUSH hBrush)
  698.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, hBrush,
  699.         lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags|DST_COMPLEX); }
  700. _AFXWIN_INLINE BOOL CDC::DrawState(CPoint pt, CSize size, DRAWSTATEPROC lpDrawProc, LPARAM lData, UINT nFlags, CBrush* pBrush)
  701.     { ASSERT(m_hDC != NULL); return ::DrawState(m_hDC, (HBRUSH)pBrush->GetSafeHandle(),
  702.         lpDrawProc, lData, 0, pt.x, pt.y, size.cx, size.cy, nFlags|DST_COMPLEX); }
  703. _AFXWIN_INLINE BOOL CDC::DrawEdge(LPRECT lpRect, UINT nEdge, UINT nFlags)
  704.     { ASSERT(m_hDC != NULL); return ::DrawEdge(m_hDC, lpRect, nEdge, nFlags); }
  705. _AFXWIN_INLINE BOOL CDC::DrawFrameControl(LPRECT lpRect, UINT nType, UINT nState)
  706.     { ASSERT(m_hDC != NULL); return ::DrawFrameControl(m_hDC, lpRect, nType, nState); }
  707. #endif
  708.  
  709. _AFXWIN_INLINE BOOL CDC::Chord(int x1, int y1, int x2, int y2, int x3, int y3,
  710.     int x4, int y4)
  711.     { ASSERT(m_hDC != NULL); return ::Chord(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); }
  712. _AFXWIN_INLINE BOOL CDC::Chord(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  713.     { ASSERT(m_hDC != NULL); return ::Chord(m_hDC, lpRect->left, lpRect->top,
  714.         lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
  715.         ptEnd.x, ptEnd.y); }
  716. #endif
  717. _AFXWIN_INLINE void CDC::DrawFocusRect(LPCRECT lpRect)
  718.     { ASSERT(m_hDC != NULL); ::DrawFocusRect(m_hDC, lpRect); }
  719. _AFXWIN_INLINE BOOL CDC::Ellipse(int x1, int y1, int x2, int y2)
  720.     { ASSERT(m_hDC != NULL); return ::Ellipse(m_hDC, x1, y1, x2, y2); }
  721. _AFXWIN_INLINE BOOL CDC::Ellipse(LPCRECT lpRect)
  722.     { ASSERT(m_hDC != NULL); return ::Ellipse(m_hDC, lpRect->left, lpRect->top,
  723.         lpRect->right, lpRect->bottom); }
  724. _AFXWIN_INLINE BOOL CDC::Pie(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4)
  725.     { ASSERT(m_hDC != NULL); return ::Pie(m_hDC, x1, y1, x2, y2, x3, y3, x4, y4); }
  726. _AFXWIN_INLINE BOOL CDC::Pie(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  727.     { ASSERT(m_hDC != NULL); return ::Pie(m_hDC, lpRect->left, lpRect->top,
  728.         lpRect->right, lpRect->bottom, ptStart.x, ptStart.y,
  729.         ptEnd.x, ptEnd.y); }
  730. _AFXWIN_INLINE BOOL CDC::Polygon(LPPOINT lpPoints, int nCount)
  731.     { ASSERT(m_hDC != NULL); return ::Polygon(m_hDC, lpPoints, nCount); }
  732. #ifndef _MAC
  733. _AFXWIN_INLINE BOOL CDC::PolyPolygon(LPPOINT lpPoints, LPINT lpPolyCounts, int nCount)
  734.     { ASSERT(m_hDC != NULL); return ::PolyPolygon(m_hDC, lpPoints, lpPolyCounts, nCount); }
  735. #endif
  736. _AFXWIN_INLINE BOOL CDC::Rectangle(int x1, int y1, int x2, int y2)
  737.     { ASSERT(m_hDC != NULL); return ::Rectangle(m_hDC, x1, y1, x2, y2); }
  738. _AFXWIN_INLINE BOOL CDC::Rectangle(LPCRECT lpRect)
  739.     { ASSERT(m_hDC != NULL); return ::Rectangle(m_hDC, lpRect->left, lpRect->top,
  740.         lpRect->right, lpRect->bottom); }
  741. _AFXWIN_INLINE BOOL CDC::RoundRect(int x1, int y1, int x2, int y2, int x3, int y3)
  742.     { ASSERT(m_hDC != NULL); return ::RoundRect(m_hDC, x1, y1, x2, y2, x3, y3); }
  743. _AFXWIN_INLINE BOOL CDC::RoundRect(LPCRECT lpRect, POINT point)
  744.     { ASSERT(m_hDC != NULL); return ::RoundRect(m_hDC, lpRect->left, lpRect->top,
  745.         lpRect->right, lpRect->bottom, point.x, point.y); }
  746. _AFXWIN_INLINE BOOL CDC::PatBlt(int x, int y, int nWidth, int nHeight, DWORD dwRop)
  747.     { ASSERT(m_hDC != NULL); return ::PatBlt(m_hDC, x, y, nWidth, nHeight, dwRop); }
  748. _AFXWIN_INLINE BOOL CDC::BitBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  749.     int xSrc, int ySrc, DWORD dwRop)
  750.     { ASSERT(m_hDC != NULL); return ::BitBlt(m_hDC, x, y, nWidth, nHeight,
  751.         pSrcDC->GetSafeHdc(), xSrc, ySrc, dwRop); }
  752. _AFXWIN_INLINE BOOL CDC::StretchBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  753.     int xSrc, int ySrc, int nSrcWidth, int nSrcHeight, DWORD dwRop)
  754.     { ASSERT(m_hDC != NULL); return ::StretchBlt(m_hDC, x, y, nWidth, nHeight,
  755.         pSrcDC->GetSafeHdc(), xSrc, ySrc, nSrcWidth, nSrcHeight,
  756.         dwRop); }
  757. _AFXWIN_INLINE COLORREF CDC::GetPixel(int x, int y) const
  758.     { ASSERT(m_hDC != NULL); return ::GetPixel(m_hDC, x, y); }
  759. _AFXWIN_INLINE COLORREF CDC::GetPixel(POINT point) const
  760.     { ASSERT(m_hDC != NULL); return ::GetPixel(m_hDC, point.x, point.y); }
  761. _AFXWIN_INLINE COLORREF CDC::SetPixel(int x, int y, COLORREF crColor)
  762.     { ASSERT(m_hDC != NULL); return ::SetPixel(m_hDC, x, y, crColor); }
  763. _AFXWIN_INLINE COLORREF CDC::SetPixel(POINT point, COLORREF crColor)
  764.     { ASSERT(m_hDC != NULL); return ::SetPixel(m_hDC, point.x, point.y, crColor); }
  765. #ifndef _MAC
  766. _AFXWIN_INLINE BOOL CDC::FloodFill(int x, int y, COLORREF crColor)
  767.     { ASSERT(m_hDC != NULL); return ::FloodFill(m_hDC, x, y, crColor); }
  768. _AFXWIN_INLINE BOOL CDC::ExtFloodFill(int x, int y, COLORREF crColor, UINT nFillType)
  769.     { ASSERT(m_hDC != NULL); return ::ExtFloodFill(m_hDC, x, y, crColor, nFillType); }
  770. #endif
  771. _AFXWIN_INLINE BOOL CDC::TextOut(int x, int y, LPCTSTR lpszString, int nCount)
  772.     { ASSERT(m_hDC != NULL); return ::TextOut(m_hDC, x, y, lpszString, nCount); }
  773. _AFXWIN_INLINE BOOL CDC::TextOut(int x, int y, const CString& str)
  774.     { ASSERT(m_hDC != NULL); return TextOut(x, y, (LPCTSTR)str, str.GetLength()); } // call virtual
  775. _AFXWIN_INLINE BOOL CDC::ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  776.     LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths)
  777.     { ASSERT(m_hDC != NULL); return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect,
  778.         lpszString, nCount, lpDxWidths); }
  779. _AFXWIN_INLINE BOOL CDC::ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  780.     const CString& str, LPINT lpDxWidths)
  781.     { ASSERT(m_hDC != NULL); return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect,
  782.         str, str.GetLength(), lpDxWidths); }
  783. _AFXWIN_INLINE CSize CDC::TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount,
  784.     int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
  785.     { ASSERT(m_hDC != NULL); return ::TabbedTextOut(m_hDC, x, y, lpszString, nCount,
  786.         nTabPositions, lpnTabStopPositions, nTabOrigin); }
  787. _AFXWIN_INLINE CSize CDC::TabbedTextOut(int x, int y, const CString& str,
  788.     int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
  789.     { ASSERT(m_hDC != NULL); return ::TabbedTextOut(m_hDC, x, y, str, str.GetLength(),
  790.         nTabPositions, lpnTabStopPositions, nTabOrigin); }
  791. _AFXWIN_INLINE int CDC::DrawText(LPCTSTR lpszString, int nCount, LPRECT lpRect,
  792.         UINT nFormat)
  793.     { ASSERT(m_hDC != NULL);
  794.         return ::DrawText(m_hDC, lpszString, nCount, lpRect, nFormat); }
  795. _AFXWIN_INLINE int CDC::DrawText(const CString& str, LPRECT lpRect, UINT nFormat)
  796.     { ASSERT(m_hDC != NULL);
  797.         return DrawText((LPCTSTR)str, str.GetLength(), lpRect, nFormat); }
  798. _AFXWIN_INLINE CSize CDC::GetTextExtent(LPCTSTR lpszString, int nCount) const
  799.     {
  800.         ASSERT(m_hAttribDC != NULL);
  801.         SIZE size;
  802.         VERIFY(::GetTextExtentPoint(m_hAttribDC, lpszString, nCount, &size));
  803.         return size;
  804.     }
  805. _AFXWIN_INLINE CSize CDC::GetTextExtent(const CString& str) const
  806.     {
  807.         ASSERT(m_hAttribDC != NULL);
  808.         SIZE size;
  809.         VERIFY(::GetTextExtentPoint(m_hAttribDC, str, str.GetLength(), &size));
  810.         return size;
  811.     }
  812.  
  813. _AFXWIN_INLINE CSize CDC::GetOutputTextExtent(LPCTSTR lpszString, int nCount) const
  814.     {
  815.         ASSERT(m_hDC != NULL);
  816.         SIZE size;
  817.         VERIFY(::GetTextExtentPoint(m_hDC, lpszString, nCount, &size));
  818.         return size;
  819.     }
  820. _AFXWIN_INLINE CSize CDC::GetOutputTextExtent(const CString& str) const
  821.     {
  822.         ASSERT(m_hDC != NULL);
  823.         SIZE size;
  824.         VERIFY(::GetTextExtentPoint(m_hDC, str, str.GetLength(), &size));
  825.         return size;
  826.     }
  827.  
  828. _AFXWIN_INLINE CSize CDC::GetTabbedTextExtent(LPCTSTR lpszString, int nCount,
  829.     int nTabPositions, LPINT lpnTabStopPositions) const
  830.     { ASSERT(m_hAttribDC != NULL); return ::GetTabbedTextExtent(m_hAttribDC, lpszString, nCount,
  831.         nTabPositions, lpnTabStopPositions); }
  832. _AFXWIN_INLINE  CSize CDC::GetTabbedTextExtent(const CString& str,
  833.         int nTabPositions, LPINT lpnTabStopPositions) const
  834.     { ASSERT(m_hAttribDC != NULL); return ::GetTabbedTextExtent(m_hAttribDC,
  835.         str, str.GetLength(), nTabPositions, lpnTabStopPositions); }
  836. _AFXWIN_INLINE CSize CDC::GetOutputTabbedTextExtent(LPCTSTR lpszString, int nCount,
  837.     int nTabPositions, LPINT lpnTabStopPositions) const
  838.     { ASSERT(m_hDC != NULL); return ::GetTabbedTextExtent(m_hDC, lpszString, nCount,
  839.         nTabPositions, lpnTabStopPositions); }
  840. _AFXWIN_INLINE  CSize CDC::GetOutputTabbedTextExtent(const CString& str,
  841.         int nTabPositions, LPINT lpnTabStopPositions) const
  842.     { ASSERT(m_hDC != NULL); return ::GetTabbedTextExtent(m_hDC,
  843.         str, str.GetLength(), nTabPositions, lpnTabStopPositions); }
  844. _AFXWIN_INLINE BOOL CDC::GrayString(CBrush* pBrush,
  845.     BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int),
  846.         LPARAM lpData, int nCount,
  847.         int x, int y, int nWidth, int nHeight)
  848.     { ASSERT(m_hDC != NULL); return ::GrayString(m_hDC, (HBRUSH)pBrush->GetSafeHandle(),
  849.         (GRAYSTRINGPROC)lpfnOutput, lpData, nCount, x, y, nWidth, nHeight); }
  850. _AFXWIN_INLINE UINT CDC::GetTextAlign() const
  851.     { ASSERT(m_hAttribDC != NULL); return ::GetTextAlign(m_hAttribDC); }
  852. _AFXWIN_INLINE int CDC::GetTextFace(int nCount, LPTSTR lpszFacename) const
  853.     { ASSERT(m_hAttribDC != NULL); return ::GetTextFace(m_hAttribDC, nCount, lpszFacename); }
  854. _AFXWIN_INLINE  int CDC::GetTextFace(CString& rString) const
  855.     { ASSERT(m_hAttribDC != NULL); int nResult = ::GetTextFace(m_hAttribDC,
  856.         256, rString.GetBuffer(256)); rString.ReleaseBuffer();
  857.         return nResult; }
  858. _AFXWIN_INLINE BOOL CDC::GetTextMetrics(LPTEXTMETRIC lpMetrics) const
  859.     { ASSERT(m_hAttribDC != NULL); return ::GetTextMetrics(m_hAttribDC, lpMetrics); }
  860. _AFXWIN_INLINE BOOL CDC::GetOutputTextMetrics(LPTEXTMETRIC lpMetrics) const
  861.     { ASSERT(m_hDC != NULL); return ::GetTextMetrics(m_hDC, lpMetrics); }
  862. _AFXWIN_INLINE int CDC::GetTextCharacterExtra() const
  863.     { ASSERT(m_hAttribDC != NULL); return ::GetTextCharacterExtra(m_hAttribDC); }
  864. _AFXWIN_INLINE BOOL CDC::GetCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const
  865.     { ASSERT(m_hAttribDC != NULL); return ::GetCharWidth(m_hAttribDC, nFirstChar, nLastChar, lpBuffer); }
  866. _AFXWIN_INLINE BOOL CDC::GetOutputCharWidth(UINT nFirstChar, UINT nLastChar, LPINT lpBuffer) const
  867.     { ASSERT(m_hDC != NULL); return ::GetCharWidth(m_hDC, nFirstChar, nLastChar, lpBuffer); }
  868. _AFXWIN_INLINE CSize CDC::GetAspectRatioFilter() const
  869.     {
  870.         ASSERT(m_hAttribDC != NULL);
  871.         SIZE size;
  872.         VERIFY(::GetAspectRatioFilterEx(m_hAttribDC, &size));
  873.         return size;
  874.     }
  875. _AFXWIN_INLINE BOOL CDC::ScrollDC(int dx, int dy,
  876.         LPCRECT lpRectScroll, LPCRECT lpRectClip,
  877.         CRgn* pRgnUpdate, LPRECT lpRectUpdate)
  878.     { ASSERT(m_hDC != NULL); return ::ScrollDC(m_hDC, dx, dy, lpRectScroll,
  879.         lpRectClip, (HRGN)pRgnUpdate->GetSafeHandle(), lpRectUpdate); }
  880.  
  881. // Printer Escape Functions
  882. _AFXWIN_INLINE int CDC::Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData)
  883.     { ASSERT(m_hDC != NULL); return ::Escape(m_hDC, nEscape, nCount, lpszInData, lpOutData);}
  884.  
  885. // CDC 3.1 Specific functions
  886. #ifndef _MAC
  887. _AFXWIN_INLINE UINT CDC::SetBoundsRect(LPCRECT lpRectBounds, UINT flags)
  888.     { ASSERT(m_hDC != NULL); return ::SetBoundsRect(m_hDC, lpRectBounds, flags); }
  889. _AFXWIN_INLINE UINT CDC::GetBoundsRect(LPRECT lpRectBounds, UINT flags)
  890.     { ASSERT(m_hAttribDC != NULL); return ::GetBoundsRect(m_hAttribDC, lpRectBounds, flags); }
  891. #endif
  892. _AFXWIN_INLINE BOOL CDC::ResetDC(const DEVMODE* lpDevMode)
  893.     { ASSERT(m_hAttribDC != NULL); return ::ResetDC(m_hAttribDC, lpDevMode) != NULL; }
  894. _AFXWIN_INLINE UINT CDC::GetOutlineTextMetrics(UINT cbData, LPOUTLINETEXTMETRIC lpotm) const
  895.     { ASSERT(m_hAttribDC != NULL); return ::GetOutlineTextMetrics(m_hAttribDC, cbData, lpotm); }
  896. _AFXWIN_INLINE BOOL CDC::GetCharABCWidths(UINT nFirstChar, UINT nLastChar, LPABC lpabc) const
  897.     { ASSERT(m_hAttribDC != NULL); return ::GetCharABCWidths(m_hAttribDC, nFirstChar, nLastChar, lpabc); }
  898. _AFXWIN_INLINE DWORD CDC::GetFontData(DWORD dwTable, DWORD dwOffset, LPVOID lpData,
  899.     DWORD cbData) const
  900.     { ASSERT(m_hAttribDC != NULL); return ::GetFontData(m_hAttribDC, dwTable, dwOffset, lpData, cbData); }
  901. #ifndef _MAC
  902. _AFXWIN_INLINE int CDC::GetKerningPairs(int nPairs, LPKERNINGPAIR lpkrnpair) const
  903.     { ASSERT(m_hAttribDC != NULL); return ::GetKerningPairs(m_hAttribDC, nPairs, lpkrnpair); }
  904. _AFXWIN_INLINE DWORD CDC::GetGlyphOutline(UINT nChar, UINT nFormat, LPGLYPHMETRICS lpgm,
  905.         DWORD cbBuffer, LPVOID lpBuffer, const MAT2* lpmat2) const
  906.     { ASSERT(m_hAttribDC != NULL); return ::GetGlyphOutline(m_hAttribDC, nChar, nFormat,
  907.             lpgm, cbBuffer, lpBuffer, lpmat2); }
  908. #endif
  909.  
  910. // Document handling functions
  911. _AFXWIN_INLINE int CDC::StartDoc(LPDOCINFO lpDocInfo)
  912.     { ASSERT(m_hDC != NULL); return ::StartDoc(m_hDC, lpDocInfo); }
  913. _AFXWIN_INLINE int CDC::StartPage()
  914.     { ASSERT(m_hDC != NULL); return ::StartPage(m_hDC); }
  915. _AFXWIN_INLINE int CDC::EndPage()
  916.     { ASSERT(m_hDC != NULL); return ::EndPage(m_hDC); }
  917. _AFXWIN_INLINE int CDC::SetAbortProc(BOOL (CALLBACK* lpfn)(HDC, int))
  918.     { ASSERT(m_hDC != NULL); return ::SetAbortProc(m_hDC, (ABORTPROC)lpfn); }
  919. _AFXWIN_INLINE int CDC::AbortDoc()
  920.     { ASSERT(m_hDC != NULL); return ::AbortDoc(m_hDC); }
  921. _AFXWIN_INLINE int CDC::EndDoc()
  922.     { ASSERT(m_hDC != NULL); return ::EndDoc(m_hDC); }
  923.  
  924. #ifndef _MAC
  925. _AFXWIN_INLINE BOOL CDC::MaskBlt(int x, int y, int nWidth, int nHeight, CDC* pSrcDC,
  926.         int xSrc, int ySrc, CBitmap& maskBitmap, int xMask, int yMask, DWORD dwRop)
  927.     { ASSERT(m_hDC != NULL); return ::MaskBlt(m_hDC, x, y, nWidth, nHeight, pSrcDC->GetSafeHdc(),
  928.         xSrc, ySrc,  (HBITMAP)maskBitmap.m_hObject, xMask, yMask, dwRop); }
  929. _AFXWIN_INLINE BOOL CDC::PlgBlt(LPPOINT lpPoint, CDC* pSrcDC, int xSrc, int ySrc,
  930.         int nWidth, int nHeight, CBitmap& maskBitmap, int xMask, int yMask)
  931.     { ASSERT(m_hDC != NULL); return ::PlgBlt(m_hDC, lpPoint, pSrcDC->GetSafeHdc(), xSrc, ySrc, nWidth,
  932.         nHeight, (HBITMAP)maskBitmap.m_hObject, xMask, yMask); }
  933. _AFXWIN_INLINE BOOL CDC::SetPixelV(int x, int y, COLORREF crColor)
  934.     { ASSERT(m_hDC != NULL); return ::SetPixelV(m_hDC, x, y, crColor); }
  935. _AFXWIN_INLINE BOOL CDC::SetPixelV(POINT point, COLORREF crColor)
  936.     { ASSERT(m_hDC != NULL); return ::SetPixelV(m_hDC, point.x, point.y, crColor); }
  937. _AFXWIN_INLINE BOOL CDC::AngleArc(int x, int y, int nRadius,
  938.         float fStartAngle, float fSweepAngle)
  939.     { ASSERT(m_hDC != NULL); return ::AngleArc(m_hDC, x, y, nRadius, fStartAngle, fSweepAngle); }
  940. _AFXWIN_INLINE BOOL CDC::ArcTo(LPCRECT lpRect, POINT ptStart, POINT ptEnd)
  941.     { ASSERT(m_hDC != NULL); return ArcTo(lpRect->left, lpRect->top, lpRect->right,
  942.         lpRect->bottom, ptStart.x, ptStart.y, ptEnd.x, ptEnd.y); }
  943. _AFXWIN_INLINE int CDC::GetArcDirection() const
  944.     { ASSERT(m_hAttribDC != NULL); return ::GetArcDirection(m_hAttribDC); }
  945. _AFXWIN_INLINE BOOL CDC::PolyPolyline(const POINT* lpPoints, const DWORD* lpPolyPoints,
  946.         int nCount)
  947.     { ASSERT(m_hDC != NULL); return ::PolyPolyline(m_hDC, lpPoints, lpPolyPoints, nCount); }
  948. _AFXWIN_INLINE BOOL CDC::GetColorAdjustment(LPCOLORADJUSTMENT lpColorAdjust) const
  949.     { ASSERT(m_hAttribDC != NULL); return ::GetColorAdjustment(m_hAttribDC, lpColorAdjust); }
  950. _AFXWIN_INLINE CPen* CDC::GetCurrentPen() const
  951.     { ASSERT(m_hAttribDC != NULL); return CPen::FromHandle((HPEN)::GetCurrentObject(m_hAttribDC, OBJ_PEN)); }
  952. _AFXWIN_INLINE CBrush* CDC::GetCurrentBrush() const
  953.     { ASSERT(m_hAttribDC != NULL); return CBrush::FromHandle((HBRUSH)::GetCurrentObject(m_hAttribDC, OBJ_BRUSH)); }
  954. _AFXWIN_INLINE CPalette* CDC::GetCurrentPalette() const
  955.     { ASSERT(m_hAttribDC != NULL); return CPalette::FromHandle((HPALETTE)::GetCurrentObject(m_hAttribDC, OBJ_PAL)); }
  956. _AFXWIN_INLINE CFont* CDC::GetCurrentFont() const
  957.     { ASSERT(m_hAttribDC != NULL); return CFont::FromHandle((HFONT)::GetCurrentObject(m_hAttribDC, OBJ_FONT)); }
  958. _AFXWIN_INLINE CBitmap* CDC::GetCurrentBitmap() const
  959.     { ASSERT(m_hAttribDC != NULL); return CBitmap::FromHandle((HBITMAP)::GetCurrentObject(m_hAttribDC, OBJ_BITMAP)); }
  960. _AFXWIN_INLINE BOOL CDC::PolyBezier(const POINT* lpPoints, int nCount)
  961.     { ASSERT(m_hDC != NULL); return ::PolyBezier(m_hDC, lpPoints, nCount); }
  962.  
  963. _AFXWIN_INLINE int CDC::DrawEscape(int nEscape, int nInputSize, LPCSTR lpszInputData)
  964.     { ASSERT(m_hDC != NULL); return ::DrawEscape(m_hDC, nEscape, nInputSize, lpszInputData); }
  965. _AFXWIN_INLINE int CDC::Escape(int nEscape, int nInputSize, LPCSTR lpszInputData,
  966.         int nOutputSize, LPSTR lpszOutputData)
  967.     { ASSERT(m_hDC != NULL); return ::ExtEscape(m_hDC, nEscape, nInputSize, lpszInputData,
  968.         nOutputSize, lpszOutputData); }
  969.  
  970. _AFXWIN_INLINE BOOL CDC::GetCharABCWidths(UINT nFirstChar, UINT nLastChar,
  971.         LPABCFLOAT lpABCF) const
  972.     { ASSERT(m_hAttribDC != NULL); return ::GetCharABCWidthsFloat(m_hAttribDC, nFirstChar, nLastChar, lpABCF); }
  973. _AFXWIN_INLINE BOOL CDC::GetCharWidth(UINT nFirstChar, UINT nLastChar,
  974.         float* lpFloatBuffer) const
  975.     { ASSERT(m_hAttribDC != NULL); return ::GetCharWidthFloat(m_hAttribDC, nFirstChar, nLastChar, lpFloatBuffer); }
  976.  
  977. _AFXWIN_INLINE BOOL CDC::AbortPath()
  978.     { ASSERT(m_hDC != NULL); return ::AbortPath(m_hDC); }
  979. _AFXWIN_INLINE BOOL CDC::BeginPath()
  980.     { ASSERT(m_hDC != NULL); return ::BeginPath(m_hDC); }
  981. _AFXWIN_INLINE BOOL CDC::CloseFigure()
  982.     { ASSERT(m_hDC != NULL); return ::CloseFigure(m_hDC); }
  983. _AFXWIN_INLINE BOOL CDC::EndPath()
  984.     { ASSERT(m_hDC != NULL); return ::EndPath(m_hDC); }
  985. _AFXWIN_INLINE BOOL CDC::FillPath()
  986.     { ASSERT(m_hDC != NULL); return ::FillPath(m_hDC); }
  987. _AFXWIN_INLINE BOOL CDC::FlattenPath()
  988.     { ASSERT(m_hDC != NULL); return ::FlattenPath(m_hDC); }
  989. _AFXWIN_INLINE float CDC::GetMiterLimit() const
  990.     { ASSERT(m_hDC != NULL); float fMiterLimit;
  991.         VERIFY(::GetMiterLimit(m_hDC, &fMiterLimit)); return fMiterLimit; }
  992. _AFXWIN_INLINE int CDC::GetPath(LPPOINT lpPoints, LPBYTE lpTypes, int nCount) const
  993.     { ASSERT(m_hDC != NULL); return ::GetPath(m_hDC, lpPoints, lpTypes, nCount); }
  994. _AFXWIN_INLINE BOOL CDC::SetMiterLimit(float fMiterLimit)
  995.     { ASSERT(m_hDC != NULL); return ::SetMiterLimit(m_hDC, fMiterLimit, NULL); }
  996. _AFXWIN_INLINE BOOL CDC::StrokeAndFillPath()
  997.     { ASSERT(m_hDC != NULL); return ::StrokeAndFillPath(m_hDC); }
  998. _AFXWIN_INLINE BOOL CDC::StrokePath()
  999.     { ASSERT(m_hDC != NULL); return ::StrokePath(m_hDC); }
  1000. _AFXWIN_INLINE BOOL CDC::WidenPath()
  1001.     { ASSERT(m_hDC != NULL); return ::WidenPath(m_hDC); }
  1002.  
  1003. _AFXWIN_INLINE BOOL CDC::AddMetaFileComment(UINT nDataSize, const BYTE* pCommentData)
  1004.     { ASSERT(m_hDC != NULL); return ::GdiComment(m_hDC, nDataSize, pCommentData); }
  1005. _AFXWIN_INLINE BOOL CDC::PlayMetaFile(HENHMETAFILE hEnhMF, LPCRECT lpBounds)
  1006.     { ASSERT(m_hDC != NULL); return ::PlayEnhMetaFile(m_hDC, hEnhMF, lpBounds); }
  1007. #endif
  1008.  
  1009. // CMenu
  1010. _AFXWIN_INLINE CMenu::CMenu()
  1011.     { m_hMenu = NULL; }
  1012. _AFXWIN_INLINE CMenu::~CMenu()
  1013.     { DestroyMenu(); }
  1014. _AFXWIN_INLINE BOOL CMenu::CreateMenu()
  1015.     { return Attach(::CreateMenu()); }
  1016. _AFXWIN_INLINE BOOL CMenu::CreatePopupMenu()
  1017.     { return Attach(::CreatePopupMenu()); }
  1018. _AFXWIN_INLINE CMenu::operator HMENU() const
  1019.     { ASSERT(this == NULL || m_hMenu == NULL || ::IsMenu(m_hMenu));
  1020.         return this == NULL ? NULL : m_hMenu; }
  1021. _AFXWIN_INLINE HMENU CMenu::GetSafeHmenu() const
  1022.     { ASSERT(this == NULL || m_hMenu == NULL || ::IsMenu(m_hMenu));
  1023.         return this == NULL ? NULL : m_hMenu; }
  1024. _AFXWIN_INLINE BOOL CMenu::DeleteMenu(UINT nPosition, UINT nFlags)
  1025.     { ASSERT(::IsMenu(m_hMenu)); return ::DeleteMenu(m_hMenu, nPosition, nFlags); }
  1026. _AFXWIN_INLINE BOOL CMenu::AppendMenu(UINT nFlags, UINT nIDNewItem, LPCTSTR lpszNewItem)
  1027.     { ASSERT(::IsMenu(m_hMenu)); return ::AppendMenu(m_hMenu, nFlags, nIDNewItem, lpszNewItem); }
  1028. _AFXWIN_INLINE BOOL CMenu::AppendMenu(UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp)
  1029.     { ASSERT(::IsMenu(m_hMenu)); return ::AppendMenu(m_hMenu, nFlags | MF_BITMAP, nIDNewItem,
  1030.         (LPCTSTR)pBmp->GetSafeHandle()); }
  1031. _AFXWIN_INLINE UINT CMenu::CheckMenuItem(UINT nIDCheckItem, UINT nCheck)
  1032.     { ASSERT(::IsMenu(m_hMenu)); return (UINT)::CheckMenuItem(m_hMenu, nIDCheckItem, nCheck); }
  1033. _AFXWIN_INLINE UINT CMenu::EnableMenuItem(UINT nIDEnableItem, UINT nEnable)
  1034.     { ASSERT(::IsMenu(m_hMenu)); return ::EnableMenuItem(m_hMenu, nIDEnableItem, nEnable); }
  1035. _AFXWIN_INLINE UINT CMenu::GetMenuItemCount() const
  1036.     { ASSERT(::IsMenu(m_hMenu)); return ::GetMenuItemCount(m_hMenu); }
  1037. _AFXWIN_INLINE UINT CMenu::GetMenuItemID(int nPos) const
  1038.     { ASSERT(::IsMenu(m_hMenu)); return ::GetMenuItemID(m_hMenu, nPos); }
  1039. _AFXWIN_INLINE UINT CMenu::GetMenuState(UINT nID, UINT nFlags) const
  1040.     { ASSERT(::IsMenu(m_hMenu)); return ::GetMenuState(m_hMenu, nID, nFlags); }
  1041. _AFXWIN_INLINE int CMenu::GetMenuString(UINT nIDItem, LPTSTR lpString, int nMaxCount, UINT nFlags) const
  1042.     { ASSERT(::IsMenu(m_hMenu)); return ::GetMenuString(m_hMenu, nIDItem, lpString, nMaxCount, nFlags); }
  1043. _AFXWIN_INLINE int CMenu::GetMenuString(UINT nIDItem, CString& rString, UINT nFlags) const
  1044.     { ASSERT(::IsMenu(m_hMenu)); int nResult = ::GetMenuString(m_hMenu, nIDItem,
  1045.         rString.GetBuffer(256), 256, nFlags); rString.ReleaseBuffer();
  1046.         return nResult; }
  1047. _AFXWIN_INLINE CMenu* CMenu::GetSubMenu(int nPos) const
  1048.     { ASSERT(::IsMenu(m_hMenu)); return CMenu::FromHandle(::GetSubMenu(m_hMenu, nPos)); }
  1049. _AFXWIN_INLINE BOOL CMenu::InsertMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem,
  1050.         LPCTSTR lpszNewItem)
  1051.     { ASSERT(::IsMenu(m_hMenu)); return ::InsertMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); }
  1052. _AFXWIN_INLINE BOOL CMenu::InsertMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp)
  1053.     { ASSERT(::IsMenu(m_hMenu)); return ::InsertMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem,
  1054.         (LPCTSTR)pBmp->GetSafeHandle()); }
  1055. _AFXWIN_INLINE BOOL CMenu::ModifyMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem, LPCTSTR lpszNewItem)
  1056.     { ASSERT(::IsMenu(m_hMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags, nIDNewItem, lpszNewItem); }
  1057. _AFXWIN_INLINE BOOL CMenu::ModifyMenu(UINT nPosition, UINT nFlags, UINT nIDNewItem, const CBitmap* pBmp)
  1058.     { ASSERT(::IsMenu(m_hMenu)); return ::ModifyMenu(m_hMenu, nPosition, nFlags | MF_BITMAP, nIDNewItem,
  1059.         (LPCTSTR)pBmp->GetSafeHandle()); }
  1060. _AFXWIN_INLINE BOOL CMenu::RemoveMenu(UINT nPosition, UINT nFlags)
  1061.     { ASSERT(::IsMenu(m_hMenu)); return ::RemoveMenu(m_hMenu, nPosition, nFlags); }
  1062. _AFXWIN_INLINE BOOL CMenu::SetMenuItemBitmaps(UINT nPosition, UINT nFlags,
  1063.         const CBitmap* pBmpUnchecked, const CBitmap* pBmpChecked)
  1064.     { ASSERT(::IsMenu(m_hMenu)); return ::SetMenuItemBitmaps(m_hMenu, nPosition, nFlags,
  1065.         (HBITMAP)pBmpUnchecked->GetSafeHandle(),
  1066.         (HBITMAP)pBmpChecked->GetSafeHandle()); }
  1067. _AFXWIN_INLINE BOOL CMenu::LoadMenu(LPCTSTR lpszResourceName)
  1068.     { return Attach(::LoadMenu(AfxFindResourceHandle(lpszResourceName,
  1069.         RT_MENU), lpszResourceName)); }
  1070. _AFXWIN_INLINE BOOL CMenu::LoadMenu(UINT nIDResource)
  1071.     { return Attach(::LoadMenu(AfxFindResourceHandle(
  1072.         MAKEINTRESOURCE(nIDResource), RT_MENU), MAKEINTRESOURCE(nIDResource))); }
  1073. _AFXWIN_INLINE BOOL CMenu::LoadMenuIndirect(const void* lpMenuTemplate)
  1074.     { return Attach(::LoadMenuIndirect(lpMenuTemplate)); }
  1075. // Win4
  1076. #ifndef _MAC
  1077. _AFXWIN_INLINE BOOL CMenu::SetMenuContextHelpId(DWORD dwContextHelpId)
  1078.     { return ::SetMenuContextHelpId(m_hMenu, dwContextHelpId); }
  1079. _AFXWIN_INLINE DWORD CMenu::GetMenuContextHelpId() const
  1080.     { return ::GetMenuContextHelpId(m_hMenu); }
  1081. _AFXWIN_INLINE BOOL CMenu::CheckMenuRadioItem(UINT nIDFirst, UINT nIDLast, UINT nIDItem, UINT nFlags)
  1082.     { return ::CheckMenuRadioItem(m_hMenu, nIDFirst, nIDLast, nIDItem, nFlags); }
  1083. #endif
  1084.  
  1085. // CCmdUI
  1086. _AFXWIN_INLINE void CCmdUI::ContinueRouting()
  1087.     { m_bContinueRouting = TRUE; }
  1088.  
  1089. /////////////////////////////////////////////////////////////////////////////
  1090.  
  1091. #endif //_AFXWIN_INLINE
  1092.