Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1116 lines
60 KiB

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