home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxwin1.inl < prev    next >
Text File  |  1998-06-16  |  59KB  |  1,093 lines

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