home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxext.inl < prev    next >
Text File  |  1998-06-16  |  6KB  |  143 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 AFXEXT.H
  12.  
  13. #ifdef _AFXEXT_INLINE
  14.  
  15. // CCreateContext
  16. _AFXEXT_INLINE CCreateContext::CCreateContext()
  17.     { memset(this, 0, sizeof(*this)); }
  18.  
  19. // CMetaFileDC
  20. _AFXEXT_INLINE BOOL CMetaFileDC::Create(LPCTSTR lpszFilename)
  21.     { return Attach(::CreateMetaFile(lpszFilename)); }
  22. _AFXEXT_INLINE HMETAFILE CMetaFileDC::Close()
  23.     { return ::CloseMetaFile(Detach()); }
  24. _AFXEXT_INLINE BOOL CMetaFileDC::CreateEnhanced(CDC* pDCRef,
  25.         LPCTSTR lpszFileName, LPCRECT lpBounds, LPCTSTR lpszDescription)
  26.     { return Attach(::CreateEnhMetaFile(pDCRef->GetSafeHdc(),
  27.         lpszFileName, lpBounds, lpszDescription)); }
  28. _AFXEXT_INLINE HENHMETAFILE CMetaFileDC::CloseEnhanced()
  29.     { return ::CloseEnhMetaFile(Detach()); }
  30. _AFXEXT_INLINE CPoint CMetaFileDC::SetViewportOrg(POINT point)
  31.     { ASSERT(m_hDC != NULL); return SetViewportOrg(point.x, point.y); }
  32. _AFXEXT_INLINE CSize CMetaFileDC::SetViewportExt(SIZE size)
  33.     { ASSERT(m_hDC != NULL); return SetViewportExt(size.cx, size.cy); }
  34. _AFXEXT_INLINE BOOL CMetaFileDC::TextOut(int x, int y, const CString& str)
  35.     { ASSERT(m_hDC != NULL); return TextOut(x, y, (LPCTSTR)str, str.GetLength()); }
  36. _AFXEXT_INLINE BOOL CMetaFileDC::ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  37.     const CString& str, LPINT lpDxWidths)
  38.     { ASSERT(m_hDC != NULL); return ::ExtTextOut(m_hDC, x, y, nOptions, lpRect,
  39.         str, str.GetLength(), lpDxWidths); }
  40. _AFXEXT_INLINE CSize CMetaFileDC::TabbedTextOut(int x, int y, const CString& str,
  41.     int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin)
  42.     { ASSERT(m_hDC != NULL); return ::TabbedTextOut(m_hDC, x, y, str, str.GetLength(),
  43.         nTabPositions, lpnTabStopPositions, nTabOrigin); }
  44. _AFXEXT_INLINE int CMetaFileDC::DrawText(const CString& str, LPRECT lpRect, UINT nFormat)
  45.     { ASSERT(m_hDC != NULL);
  46.         return DrawText((LPCTSTR)str, str.GetLength(), lpRect, nFormat); }
  47. _AFXEXT_INLINE BOOL CMetaFileDC::PtVisible(POINT point) const
  48.     { ASSERT(m_hDC != NULL); return PtVisible(point.x, point.y); }
  49.  
  50. // CSplitterWnd
  51. _AFXEXT_INLINE int CSplitterWnd::GetRowCount() const
  52.     { return m_nRows; }
  53. _AFXEXT_INLINE int CSplitterWnd::GetColumnCount() const
  54.     { return m_nCols; }
  55. // obsolete functions
  56. _AFXEXT_INLINE BOOL CSplitterWnd::IsChildPane(CWnd* pWnd, int& row, int& col)
  57.     { return IsChildPane(pWnd, &row, &col); }
  58. _AFXEXT_INLINE CWnd* CSplitterWnd::GetActivePane(int& row, int& col)
  59.     { return GetActivePane(&row, &col); }
  60. _AFXEXT_INLINE BOOL CSplitterWnd::IsTracking()
  61.     { return m_bTracking; }
  62.  
  63. // CControlBar
  64. _AFXEXT_INLINE int CControlBar::GetCount() const
  65.     { return m_nCount; }
  66. _AFXEXT_INLINE DWORD CControlBar::GetBarStyle()
  67.     { return m_dwStyle; }
  68. _AFXEXT_INLINE void CControlBar::SetBorders(LPCRECT lpRect)
  69.     { SetBorders(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); }
  70. _AFXEXT_INLINE CRect CControlBar::GetBorders() const
  71.     { return CRect(m_cxLeftBorder, m_cyTopBorder, m_cxRightBorder, m_cyBottomBorder); }
  72.  
  73. // CToolBar
  74. _AFXEXT_INLINE BOOL CToolBar::LoadToolBar(UINT nIDResource)
  75.     { return LoadToolBar(MAKEINTRESOURCE(nIDResource)); }
  76. _AFXEXT_INLINE BOOL CToolBar::LoadBitmap(UINT nIDResource)
  77.     { return LoadBitmap(MAKEINTRESOURCE(nIDResource)); }
  78. _AFXEXT_INLINE CToolBarCtrl& CToolBar::GetToolBarCtrl() const
  79.     { return *(CToolBarCtrl*)this; }
  80.  
  81. // CDialogBar
  82. _AFXEXT_INLINE BOOL CDialogBar::Create(CWnd* pParentWnd, UINT nIDTemplate,
  83.         UINT nStyle, UINT nID)
  84.     { return Create(pParentWnd, MAKEINTRESOURCE(nIDTemplate), nStyle, nID); }
  85.  
  86. // CStatusBar
  87. _AFXEXT_INLINE CStatusBarCtrl& CStatusBar::GetStatusBarCtrl() const
  88.     { return *(CStatusBarCtrl*)this; }
  89. _AFXEXT_INLINE void CStatusBar::SetBorders(LPCRECT lpRect)
  90.     { SetBorders(lpRect->left, lpRect->top, lpRect->right, lpRect->bottom); }
  91. _AFXEXT_INLINE void CStatusBar::SetBorders(int cxLeft, int cyTop, int cxRight, int cyBottom)
  92.     { ASSERT(cyTop >= 2); CControlBar::SetBorders(cxLeft, cyTop, cxRight, cyBottom); }
  93. #ifdef _DEBUG
  94. // status bars do not support docking
  95. _AFXEXT_INLINE void CStatusBar::EnableDocking(DWORD)
  96.     { ASSERT(FALSE); }
  97. #endif
  98.  
  99. // CReBar
  100. _AFXEXT_INLINE CReBarCtrl& CReBar::GetReBarCtrl() const
  101.     { return *(CReBarCtrl*)this; }
  102. #ifdef _DEBUG
  103. // rebars do not support docking
  104. _AFXEXT_INLINE void CReBar::EnableDocking(DWORD)
  105.     { ASSERT(FALSE); }
  106. #endif
  107.  
  108. // CRectTracker
  109. _AFXEXT_INLINE CRectTracker::CRectTracker()
  110.     { Construct(); }
  111.  
  112. // CBitmapButton
  113. _AFXEXT_INLINE CBitmapButton::CBitmapButton()
  114.     { }
  115. _AFXEXT_INLINE BOOL CBitmapButton::LoadBitmaps(UINT nIDBitmapResource,
  116.     UINT nIDBitmapResourceSel, UINT nIDBitmapResourceFocus,
  117.     UINT nIDBitmapResourceDisabled)
  118.     { return LoadBitmaps(MAKEINTRESOURCE(nIDBitmapResource),
  119.         MAKEINTRESOURCE(nIDBitmapResourceSel),
  120.         MAKEINTRESOURCE(nIDBitmapResourceFocus),
  121.         MAKEINTRESOURCE(nIDBitmapResourceDisabled)); }
  122.  
  123. // CPrintInfo
  124. _AFXEXT_INLINE void CPrintInfo::SetMinPage(UINT nMinPage)
  125.     { m_pPD->m_pd.nMinPage = (WORD)nMinPage; }
  126. _AFXEXT_INLINE void CPrintInfo::SetMaxPage(UINT nMaxPage)
  127.     { m_pPD->m_pd.nMaxPage = (WORD)nMaxPage; }
  128. _AFXEXT_INLINE UINT CPrintInfo::GetMinPage() const
  129.     { return m_pPD->m_pd.nMinPage; }
  130. _AFXEXT_INLINE UINT CPrintInfo::GetMaxPage() const
  131.     { return m_pPD->m_pd.nMaxPage; }
  132. _AFXEXT_INLINE UINT CPrintInfo::GetFromPage() const
  133.     { return m_pPD->m_pd.nFromPage; }
  134. _AFXEXT_INLINE UINT CPrintInfo::GetToPage() const
  135.     { return m_pPD->m_pd.nToPage; }
  136. // CEditView
  137. _AFXEXT_INLINE CEdit& CEditView::GetEditCtrl() const
  138.     { return *(CEdit*)this; }
  139.  
  140. #endif //_AFXEXT_INLINE
  141.  
  142. /////////////////////////////////////////////////////////////////////////////
  143.