home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxext.h < prev    next >
C/C++ Source or Header  |  1998-06-16  |  37KB  |  1,111 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. #ifndef __AFXEXT_H__
  12. #define __AFXEXT_H__
  13.  
  14. #ifndef __AFXWIN_H__
  15.     #include <afxwin.h>
  16. #endif
  17. #ifndef __AFXDLGS_H__
  18.     #include <afxdlgs.h>
  19. #endif
  20.  
  21. #ifdef _AFX_MINREBUILD
  22. #pragma component(minrebuild, off)
  23. #endif
  24. #ifndef _AFX_FULLTYPEINFO
  25. #pragma component(mintypeinfo, on)
  26. #endif
  27.  
  28. #ifdef _AFX_PACKING
  29. #pragma pack(push, _AFX_PACKING)
  30. #endif
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // AFXEXT - MFC Advanced Extensions and Advanced Customizable classes
  34.  
  35. // Classes declared in this file
  36.  
  37. //CObject
  38.     //CCmdTarget;
  39.         //CWnd
  40.             //CButton
  41.                 class CBitmapButton;    // Bitmap button (self-draw)
  42.  
  43.             class CControlBar;          // control bar
  44.                 class CStatusBar;       // status bar
  45.                 class CToolBar;         // toolbar
  46.                 class CDialogBar;       // dialog as control bar
  47.                 class CReBar;           // ie40 dock bar
  48.  
  49.             class CSplitterWnd;         // splitter manager
  50.  
  51.             //CView
  52.                 //CScrollView
  53.                 class CFormView;        // view with a dialog template
  54.                 class CEditView;        // simple text editor view
  55.  
  56.     //CDC
  57.         class CMetaFileDC;              // a metafile with proxy
  58.  
  59. class CRectTracker;                     // tracker for rectangle objects
  60.  
  61. // information structures
  62. struct CPrintInfo;          // Printing context
  63. struct CPrintPreviewState;  // Print Preview context/state
  64. struct CCreateContext;      // Creation context
  65.  
  66. #undef AFX_DATA
  67. #define AFX_DATA AFX_CORE_DATA
  68.  
  69. /////////////////////////////////////////////////////////////////////////////
  70. // Simple bitmap button
  71.  
  72. // CBitmapButton - push-button with 1->4 bitmap images
  73. class CBitmapButton : public CButton
  74. {
  75.     DECLARE_DYNAMIC(CBitmapButton)
  76. public:
  77. // Construction
  78.     CBitmapButton();
  79.  
  80.     BOOL LoadBitmaps(LPCTSTR lpszBitmapResource,
  81.             LPCTSTR lpszBitmapResourceSel = NULL,
  82.             LPCTSTR lpszBitmapResourceFocus = NULL,
  83.             LPCTSTR lpszBitmapResourceDisabled = NULL);
  84.     BOOL LoadBitmaps(UINT nIDBitmapResource,
  85.             UINT nIDBitmapResourceSel = 0,
  86.             UINT nIDBitmapResourceFocus = 0,
  87.             UINT nIDBitmapResourceDisabled = 0);
  88.     BOOL AutoLoad(UINT nID, CWnd* pParent);
  89.  
  90. // Operations
  91.     void SizeToContent();
  92.  
  93. // Implementation:
  94. public:
  95. #ifdef _DEBUG
  96.     virtual void AssertValid() const;
  97.     virtual void Dump(CDumpContext& dc) const;
  98. #endif
  99. protected:
  100.     // all bitmaps must be the same size
  101.     CBitmap m_bitmap;           // normal image (REQUIRED)
  102.     CBitmap m_bitmapSel;        // selected image (OPTIONAL)
  103.     CBitmap m_bitmapFocus;      // focused but not selected (OPTIONAL)
  104.     CBitmap m_bitmapDisabled;   // disabled bitmap (OPTIONAL)
  105.  
  106.     virtual void DrawItem(LPDRAWITEMSTRUCT lpDIS);
  107. };
  108.  
  109. /////////////////////////////////////////////////////////////////////////////
  110. // Control Bars
  111.  
  112. // forward declarations (private to implementation)
  113. class CDockBar;
  114. class CDockContext;
  115. class CControlBarInfo;
  116. struct AFX_SIZEPARENTPARAMS;
  117.  
  118. // Layout Modes for CalcDynamicLayout
  119. #define LM_STRETCH  0x01    // same meaning as bStretch in CalcFixedLayout.  If set, ignores nLength
  120.                             // and returns dimensions based on LM_HORZ state, otherwise LM_HORZ is used
  121.                             // to determine if nLength is the desired horizontal or vertical length
  122.                             // and dimensions are returned based on nLength
  123. #define LM_HORZ     0x02    // same as bHorz in CalcFixedLayout
  124. #define LM_MRUWIDTH 0x04    // Most Recently Used Dynamic Width
  125. #define LM_HORZDOCK 0x08    // Horizontal Docked Dimensions
  126. #define LM_VERTDOCK 0x10    // Vertical Docked Dimensions
  127. #define LM_LENGTHY  0x20    // Set if nLength is a Height instead of a Width
  128. #define LM_COMMIT   0x40    // Remember MRUWidth
  129.  
  130. #ifdef _AFXDLL
  131. class CControlBar : public CWnd
  132. #else
  133. class AFX_NOVTABLE CControlBar : public CWnd
  134. #endif
  135. {
  136.     DECLARE_DYNAMIC(CControlBar)
  137. // Construction
  138. protected:
  139.     CControlBar();
  140.  
  141. // Attributes
  142. public:
  143.     int GetCount() const;
  144.  
  145.     // for styles specific to CControlBar
  146.     DWORD GetBarStyle();
  147.     void SetBarStyle(DWORD dwStyle);
  148.  
  149.     BOOL m_bAutoDelete;
  150.  
  151.     // getting and setting border space
  152.     void SetBorders(LPCRECT lpRect);
  153.     void SetBorders(int cxLeft = 0, int cyTop = 0, int cxRight = 0, int cyBottom = 0);
  154.     CRect GetBorders() const;
  155.  
  156.     CFrameWnd* GetDockingFrame() const;
  157.     BOOL IsFloating() const;
  158.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  159.     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
  160.  
  161. // Operations
  162.     void EnableDocking(DWORD dwDockStyle);
  163.  
  164. // Overridables
  165.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler) = 0;
  166.  
  167. // Implementation
  168. public:
  169.     virtual ~CControlBar();
  170. #ifdef _DEBUG
  171.     virtual void AssertValid() const;
  172.     virtual void Dump(CDumpContext& dc) const;
  173. #endif
  174.     virtual void DelayShow(BOOL bShow);
  175.     virtual BOOL IsVisible() const;
  176.     virtual DWORD RecalcDelayShow(AFX_SIZEPARENTPARAMS* lpLayout);
  177.  
  178.     virtual BOOL IsDockBar() const;
  179.     virtual BOOL DestroyWindow();
  180.     virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
  181.  
  182.     // info about bar (for status bar and toolbar)
  183.     int m_cxLeftBorder, m_cxRightBorder;
  184.     int m_cyTopBorder, m_cyBottomBorder;
  185.     int m_cxDefaultGap;         // default gap value
  186.     UINT m_nMRUWidth;   // For dynamic resizing.
  187.  
  188.     // array of elements
  189.     int m_nCount;
  190.     void* m_pData;        // m_nCount elements - type depends on derived class
  191.  
  192.     // support for delayed hide/show
  193.     enum StateFlags
  194.         { delayHide = 1, delayShow = 2, tempHide = 4, statusSet = 8 };
  195.     UINT m_nStateFlags;
  196.  
  197.     // support for docking
  198.     DWORD m_dwStyle;    // creation style (used for layout)
  199.     DWORD m_dwDockStyle;// indicates how bar can be docked
  200.     CFrameWnd* m_pDockSite; // current dock site, if dockable
  201.     CDockBar* m_pDockBar;   // current dock bar, if dockable
  202.     CDockContext* m_pDockContext;   // used during dragging
  203.  
  204.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  205.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  206.     virtual void PostNcDestroy();
  207.  
  208.     virtual void DoPaint(CDC* pDC);
  209.     void DrawBorders(CDC* pDC, CRect& rect);
  210.     void DrawGripper(CDC* pDC, const CRect& rect);
  211.  
  212.     // implementation helpers
  213.     virtual LRESULT WindowProc(UINT nMsg, WPARAM wParam, LPARAM lParam);
  214.     void CalcInsideRect(CRect& rect, BOOL bHorz) const; // adjusts borders etc
  215.     BOOL AllocElements(int nElements, int cbElement);
  216.     virtual BOOL SetStatusText(int nHit);
  217.     void ResetTimer(UINT nEvent, UINT nTime);
  218.     void EraseNonClient();
  219.  
  220.     void GetBarInfo(CControlBarInfo* pInfo);
  221.     void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd);
  222.  
  223.     //{{AFX_MSG(CControlBar)
  224.     afx_msg void OnTimer(UINT nIDEvent);
  225.     afx_msg int OnCreate(LPCREATESTRUCT lpcs);
  226.     afx_msg void OnDestroy();
  227.     afx_msg void OnPaint();
  228.     afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  229.     afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
  230.     afx_msg LRESULT OnSizeParent(WPARAM wParam, LPARAM lParam);
  231.     afx_msg LRESULT OnHelpHitTest(WPARAM wParam, LPARAM lParam);
  232.     afx_msg void OnInitialUpdate();
  233.     afx_msg LRESULT OnIdleUpdateCmdUI(WPARAM wParam, LPARAM lParam);
  234.     afx_msg void OnLButtonDown(UINT nFlags, CPoint pt );
  235.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint pt);
  236.     afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT nMsg);
  237.     //}}AFX_MSG
  238.     DECLARE_MESSAGE_MAP()
  239.  
  240.     friend class CFrameWnd;
  241.     friend class CDockBar;
  242. };
  243.  
  244. /////////////////////////////////////////////////////////////////////////////
  245. // CStatusBar control
  246.  
  247. class CStatusBarCtrl;   // forward reference (see afxcmn.h for definition)
  248. struct AFX_STATUSPANE;  // private to implementation
  249.  
  250. class CStatusBar : public CControlBar
  251. {
  252.     DECLARE_DYNAMIC(CStatusBar)
  253.  
  254. // Construction
  255. public:
  256.     CStatusBar();
  257.     BOOL Create(CWnd* pParentWnd,
  258.         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM,
  259.         UINT nID = AFX_IDW_STATUS_BAR);
  260.     BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle = 0,
  261.         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_BOTTOM,
  262.         UINT nID = AFX_IDW_STATUS_BAR);
  263.     BOOL SetIndicators(const UINT* lpIDArray, int nIDCount);
  264.  
  265. // Attributes
  266. public:
  267.     void SetBorders(LPCRECT lpRect);
  268.     void SetBorders(int cxLeft = 0, int cyTop = 0, int cxRight = 0, int cyBottom = 0);
  269.  
  270.     // standard control bar things
  271.     int CommandToIndex(UINT nIDFind) const;
  272.     UINT GetItemID(int nIndex) const;
  273.     void GetItemRect(int nIndex, LPRECT lpRect) const;
  274.  
  275.     // specific to CStatusBar
  276.     void GetPaneText(int nIndex, CString& rString) const;
  277.     CString GetPaneText(int nIndex) const;
  278.     BOOL SetPaneText(int nIndex, LPCTSTR lpszNewText, BOOL bUpdate = TRUE);
  279.     void GetPaneInfo(int nIndex, UINT& nID, UINT& nStyle, int& cxWidth) const;
  280.     void SetPaneInfo(int nIndex, UINT nID, UINT nStyle, int cxWidth);
  281.     UINT GetPaneStyle(int nIndex) const;
  282.     void SetPaneStyle(int nIndex, UINT nStyle);
  283.  
  284.     // for direct access to the underlying common control
  285.     CStatusBarCtrl& GetStatusBarCtrl() const;
  286.  
  287. // Overridables
  288.     virtual void DrawItem(LPDRAWITEMSTRUCT);
  289.  
  290. // Implementation
  291. public:
  292.     virtual ~CStatusBar();
  293.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  294.     BOOL PreCreateWindow(CREATESTRUCT& cs);
  295.     BOOL AllocElements(int nElements, int cbElement);
  296.     void CalcInsideRect(CRect& rect, BOOL bHorz) const;
  297.     virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
  298.  
  299. #ifdef _DEBUG
  300.     virtual void AssertValid() const;
  301.     virtual void Dump(CDumpContext& dc) const;
  302.     void EnableDocking(DWORD dwDockStyle);
  303. #endif
  304.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  305.  
  306. protected:
  307.     int m_nMinHeight;
  308.  
  309.     AFX_STATUSPANE* _GetPanePtr(int nIndex) const;
  310.     void UpdateAllPanes(BOOL bUpdateRects, BOOL bUpdateText);
  311.     virtual BOOL OnChildNotify(UINT message, WPARAM, LPARAM, LRESULT*);
  312.  
  313.     //{{AFX_MSG(CStatusBar)
  314.     afx_msg UINT OnNcHitTest(CPoint);
  315.     afx_msg void OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS*);
  316.     afx_msg void OnNcPaint();
  317.     afx_msg void OnPaint();
  318.     afx_msg void OnSize(UINT nType, int cx, int cy);
  319.     afx_msg void OnWindowPosChanging(LPWINDOWPOS);
  320.     afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
  321.     afx_msg LRESULT OnGetText(WPARAM wParam, LPARAM lParam);
  322.     afx_msg LRESULT OnGetTextLength(WPARAM wParam, LPARAM lParam);
  323.     afx_msg LRESULT OnSetMinHeight(WPARAM wParam, LPARAM lParam);
  324.     //}}AFX_MSG
  325.     DECLARE_MESSAGE_MAP()
  326. };
  327.  
  328. // Styles for status bar panes
  329. #define SBPS_NORMAL     0x0000
  330. #define SBPS_NOBORDERS  SBT_NOBORDERS
  331. #define SBPS_POPOUT     SBT_POPOUT
  332. #define SBPS_OWNERDRAW  SBT_OWNERDRAW
  333. #define SBPS_DISABLED   0x04000000
  334. #define SBPS_STRETCH    0x08000000  // stretch to fill status bar
  335.  
  336. /////////////////////////////////////////////////////////////////////////////
  337. // CToolBar control
  338.  
  339. HBITMAP AFXAPI AfxLoadSysColorBitmap(HINSTANCE hInst, HRSRC hRsrc, BOOL bMono = FALSE);
  340.  
  341. class CToolBarCtrl; // forward reference (see afxcmn.h for definition)
  342.  
  343. class CToolBar : public CControlBar
  344. {
  345.     DECLARE_DYNAMIC(CToolBar)
  346.  
  347. // Construction
  348. public:
  349.     CToolBar();
  350.     BOOL Create(CWnd* pParentWnd,
  351.         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP,
  352.         UINT nID = AFX_IDW_TOOLBAR);
  353.     BOOL CreateEx(CWnd* pParentWnd, DWORD dwCtrlStyle = TBSTYLE_FLAT,
  354.         DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_ALIGN_TOP,
  355.         CRect rcBorders = CRect(0, 0, 0, 0),
  356.         UINT nID = AFX_IDW_TOOLBAR);
  357.  
  358.     void SetSizes(SIZE sizeButton, SIZE sizeImage);
  359.         // button size should be bigger than image
  360.     void SetHeight(int cyHeight);
  361.         // call after SetSizes, height overrides bitmap size
  362.     BOOL LoadToolBar(LPCTSTR lpszResourceName);
  363.     BOOL LoadToolBar(UINT nIDResource);
  364.     BOOL LoadBitmap(LPCTSTR lpszResourceName);
  365.     BOOL LoadBitmap(UINT nIDResource);
  366.     BOOL SetBitmap(HBITMAP hbmImageWell);
  367.     BOOL SetButtons(const UINT* lpIDArray, int nIDCount);
  368.         // lpIDArray can be NULL to allocate empty buttons
  369.  
  370. // Attributes
  371. public:
  372.     // standard control bar things
  373.     int CommandToIndex(UINT nIDFind) const;
  374.     UINT GetItemID(int nIndex) const;
  375.     virtual void GetItemRect(int nIndex, LPRECT lpRect) const;
  376.     UINT GetButtonStyle(int nIndex) const;
  377.     void SetButtonStyle(int nIndex, UINT nStyle);
  378.  
  379.     // for changing button info
  380.     void GetButtonInfo(int nIndex, UINT& nID, UINT& nStyle, int& iImage) const;
  381.     void SetButtonInfo(int nIndex, UINT nID, UINT nStyle, int iImage);
  382.     BOOL SetButtonText(int nIndex, LPCTSTR lpszText);
  383.     CString GetButtonText(int nIndex) const;
  384.     void GetButtonText(int nIndex, CString& rString) const;
  385.  
  386.     // for direct access to the underlying common control
  387.     CToolBarCtrl& GetToolBarCtrl() const;
  388.  
  389. // Implementation
  390. public:
  391.     virtual ~CToolBar();
  392.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  393.     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
  394.     virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
  395.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  396.     void SetOwner(CWnd* pOwnerWnd);
  397.     BOOL AddReplaceBitmap(HBITMAP hbmImageWell);
  398.     virtual void OnBarStyleChange(DWORD dwOldStyle, DWORD dwNewStyle);
  399.  
  400. #ifdef _DEBUG
  401.     virtual void AssertValid() const;
  402.     virtual void Dump(CDumpContext& dc) const;
  403. #endif
  404.  
  405. protected:
  406.     HRSRC m_hRsrcImageWell; // handle to loaded resource for image well
  407.     HINSTANCE m_hInstImageWell; // instance handle to load image well from
  408.     HBITMAP m_hbmImageWell; // contains color mapped button images
  409.     BOOL m_bDelayedButtonLayout; // used to manage when button layout should be done
  410.  
  411.     CSize m_sizeImage;  // current image size
  412.     CSize m_sizeButton; // current button size
  413.  
  414.     CMapStringToPtr* m_pStringMap;  // used as CMapStringToUInt
  415.  
  416.     // implementation helpers
  417.     void _GetButton(int nIndex, TBBUTTON* pButton) const;
  418.     void _SetButton(int nIndex, TBBUTTON* pButton);
  419.     CSize CalcLayout(DWORD nMode, int nLength = -1);
  420.     CSize CalcSize(TBBUTTON* pData, int nCount);
  421.     int WrapToolBar(TBBUTTON* pData, int nCount, int nWidth);
  422.     void SizeToolBar(TBBUTTON* pData, int nCount, int nLength, BOOL bVert = FALSE);
  423.     void Layout(); // called for for delayed button layout
  424.  
  425.     //{{AFX_MSG(CToolBar)
  426.     afx_msg UINT OnNcHitTest(CPoint);
  427.     afx_msg void OnNcPaint();
  428.     afx_msg void OnPaint();
  429.     afx_msg void OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS*);
  430.     afx_msg void OnWindowPosChanging(LPWINDOWPOS);
  431.     afx_msg void OnSysColorChange();
  432.     afx_msg LRESULT OnSetButtonSize(WPARAM, LPARAM);
  433.     afx_msg LRESULT OnSetBitmapSize(WPARAM, LPARAM);
  434.     afx_msg LRESULT OnPreserveZeroBorderHelper(WPARAM, LPARAM);
  435.     afx_msg BOOL OnNcCreate(LPCREATESTRUCT);
  436.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  437.     //}}AFX_MSG
  438.     DECLARE_MESSAGE_MAP()
  439.  
  440.     LRESULT OnSetSizeHelper(CSize& size, LPARAM lParam);
  441. };
  442.  
  443. // Styles for toolbar buttons
  444. #define TBBS_BUTTON     MAKELONG(TBSTYLE_BUTTON, 0) // this entry is button
  445. #define TBBS_SEPARATOR  MAKELONG(TBSTYLE_SEP, 0)    // this entry is a separator
  446. #define TBBS_CHECKBOX   MAKELONG(TBSTYLE_CHECK, 0)  // this is an auto check button
  447. #define TBBS_GROUP      MAKELONG(TBSTYLE_GROUP, 0)  // marks the start of a group
  448. #define TBBS_CHECKGROUP (TBBS_GROUP|TBBS_CHECKBOX)  // normal use of TBBS_GROUP
  449. #define TBBS_DROPDOWN   MAKELONG(TBSTYLE_DROPDOWN, 0) // drop down style
  450. #define TBBS_AUTOSIZE   MAKELONG(TBSTYLE_AUTOSIZE, 0) // autocalc button width
  451. #define TBBS_NOPREFIX   MAKELONG(TBSTYLE_NOPREFIX, 0) // no accel prefix for this button
  452.  
  453. // styles for display states
  454. #define TBBS_CHECKED    MAKELONG(0, TBSTATE_CHECKED)    // button is checked/down
  455. #define TBBS_PRESSED    MAKELONG(0, TBSTATE_PRESSED)    // button is being depressed
  456. #define TBBS_DISABLED   MAKELONG(0, TBSTATE_ENABLED)    // button is disabled
  457. #define TBBS_INDETERMINATE  MAKELONG(0, TBSTATE_INDETERMINATE)  // third state
  458. #define TBBS_HIDDEN     MAKELONG(0, TBSTATE_HIDDEN) // button is hidden
  459. #define TBBS_WRAPPED    MAKELONG(0, TBSTATE_WRAP)   // button is wrapped at this point
  460. #define TBBS_ELLIPSES   MAKELONG(0, TBSTATE_ELIPSES)
  461. #define TBBS_MARKED     MAKELONG(0, TBSTATE_MARKED)
  462.  
  463. ////////////////////////////////////////////
  464. // CDialogBar control
  465. // This is a control bar built from a dialog template. It is a modeless
  466. // dialog that delegates all control notifications to the parent window
  467. // of the control bar [the grandparent of the control]
  468.  
  469. class CDialogBar : public CControlBar
  470. {
  471.     DECLARE_DYNAMIC(CDialogBar)
  472.  
  473. // Construction
  474. public:
  475.     CDialogBar();
  476.     BOOL Create(CWnd* pParentWnd, LPCTSTR lpszTemplateName,
  477.             UINT nStyle, UINT nID);
  478.     BOOL Create(CWnd* pParentWnd, UINT nIDTemplate,
  479.             UINT nStyle, UINT nID);
  480.  
  481. // Implementation
  482. public:
  483.     virtual ~CDialogBar();
  484.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  485.     CSize m_sizeDefault;
  486.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  487.  
  488. protected:
  489. #ifndef _AFX_NO_OCC_SUPPORT
  490.     // data and functions necessary for OLE control containment
  491.     _AFX_OCC_DIALOG_INFO* m_pOccDialogInfo;
  492.     LPCTSTR m_lpszTemplateName;
  493.     virtual BOOL SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  494.  
  495.     //{{AFX_MSG(CDialogBar)
  496.     DECLARE_MESSAGE_MAP()
  497.     //}}AFX_MSG
  498.     afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);
  499. #endif
  500. };
  501.  
  502. ////////////////////////////////////////////
  503. // CReBar control
  504.  
  505. class CReBarCtrl;
  506.  
  507. class CReBar : public CControlBar
  508. {
  509.     DECLARE_DYNAMIC(CReBar)
  510.  
  511. // Construction
  512. public:
  513.     CReBar();
  514.     BOOL Create(CWnd* pParentWnd, DWORD dwCtrlStyle = RBS_BANDBORDERS,
  515.         DWORD dwStyle = WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_TOP,
  516.         UINT nID = AFX_IDW_REBAR);
  517.  
  518. // Attributes
  519. public:
  520.     // for direct access to the underlying common control
  521.     CReBarCtrl& GetReBarCtrl() const;
  522.  
  523. // Operations
  524. public:
  525.     BOOL AddBar(CWnd* pBar, LPCTSTR pszText = NULL, CBitmap* pbmp = NULL,
  526.         DWORD dwStyle = RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP);
  527.     BOOL AddBar(CWnd* pBar, COLORREF clrFore, COLORREF clrBack,
  528.         LPCTSTR pszText = NULL, DWORD dwStyle = RBBS_GRIPPERALWAYS);
  529.  
  530. // Implementation
  531.     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  532.     virtual int OnToolHitTest(CPoint point, TOOLINFO* pTI) const;
  533.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  534.     virtual CSize CalcDynamicLayout(int nLength, DWORD nMode);
  535. #ifdef _DEBUG
  536.     void EnableDocking(DWORD dwDockStyle);
  537. #endif
  538.  
  539. protected:
  540.     virtual LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
  541.     BOOL _AddBar(CWnd* pBar, REBARBANDINFO* pRBBI);
  542.  
  543.     //{{AFX_MSG(CReBar)
  544.     afx_msg BOOL OnNcCreate(LPCREATESTRUCT);
  545.     afx_msg void OnPaint();
  546.     afx_msg void OnHeightChange(NMHDR* pNMHDR, LRESULT* pResult);
  547.     afx_msg void OnNcPaint();
  548.     afx_msg void OnNcCalcSize(BOOL, NCCALCSIZE_PARAMS*);
  549.     afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  550.     afx_msg LRESULT OnShowBand(WPARAM wParam, LPARAM lParam);
  551.     afx_msg void OnRecalcParent();
  552.     //}}AFX_MSG
  553.     DECLARE_MESSAGE_MAP()
  554. };
  555.  
  556. /////////////////////////////////////////////////////////////////////////////
  557. // Splitter Window
  558.  
  559. #define SPLS_DYNAMIC_SPLIT  0x0001
  560. #define SPLS_INVERT_TRACKER 0x0002  // obsolete (now ignored)
  561.  
  562. class CSplitterWnd : public CWnd
  563. {
  564.     DECLARE_DYNAMIC(CSplitterWnd)
  565.  
  566. // Construction
  567. public:
  568.     CSplitterWnd();
  569.     // Create a single view type splitter with multiple splits
  570.     BOOL Create(CWnd* pParentWnd,
  571.                 int nMaxRows, int nMaxCols, SIZE sizeMin,
  572.                 CCreateContext* pContext,
  573.                 DWORD dwStyle = WS_CHILD | WS_VISIBLE |
  574.                     WS_HSCROLL | WS_VSCROLL | SPLS_DYNAMIC_SPLIT,
  575.                 UINT nID = AFX_IDW_PANE_FIRST);
  576.  
  577.     // Create a multiple view type splitter with static layout
  578.     BOOL CreateStatic(CWnd* pParentWnd,
  579.                 int nRows, int nCols,
  580.                 DWORD dwStyle = WS_CHILD | WS_VISIBLE,
  581.                 UINT nID = AFX_IDW_PANE_FIRST);
  582.  
  583.     virtual BOOL CreateView(int row, int col, CRuntimeClass* pViewClass,
  584.             SIZE sizeInit, CCreateContext* pContext);
  585.  
  586. // Attributes
  587. public:
  588.     int GetRowCount() const;
  589.     int GetColumnCount() const;
  590.  
  591.     // information about a specific row or column
  592.     void GetRowInfo(int row, int& cyCur, int& cyMin) const;
  593.     void SetRowInfo(int row, int cyIdeal, int cyMin);
  594.     void GetColumnInfo(int col, int& cxCur, int& cxMin) const;
  595.     void SetColumnInfo(int col, int cxIdeal, int cxMin);
  596.  
  597.     // for setting and getting shared scroll bar style
  598.     DWORD GetScrollStyle() const;
  599.     void SetScrollStyle(DWORD dwStyle);
  600.  
  601.     // views inside the splitter
  602.     CWnd* GetPane(int row, int col) const;
  603.     BOOL IsChildPane(CWnd* pWnd, int* pRow, int* pCol);
  604.     BOOL IsChildPane(CWnd* pWnd, int& row, int& col); // obsolete
  605.     int IdFromRowCol(int row, int col) const;
  606.  
  607.     BOOL IsTracking();  // TRUE during split operation
  608.  
  609. // Operations
  610. public:
  611.     virtual void RecalcLayout();    // call after changing sizes
  612.  
  613. // Overridables
  614. protected:
  615.     // to customize the drawing
  616.     enum ESplitType { splitBox, splitBar, splitIntersection, splitBorder };
  617.     virtual void OnDrawSplitter(CDC* pDC, ESplitType nType, const CRect& rect);
  618.     virtual void OnInvertTracker(const CRect& rect);
  619.  
  620. public:
  621.     // for customizing scrollbar regions
  622.     virtual BOOL CreateScrollBarCtrl(DWORD dwStyle, UINT nID);
  623.  
  624.     // for customizing DYNAMIC_SPLIT behavior
  625.     virtual void DeleteView(int row, int col);
  626.     virtual BOOL SplitRow(int cyBefore);
  627.     virtual BOOL SplitColumn(int cxBefore);
  628.     virtual void DeleteRow(int rowDelete);
  629.     virtual void DeleteColumn(int colDelete);
  630.  
  631.     // determining active pane from focus or active view in frame
  632.     virtual CWnd* GetActivePane(int* pRow = NULL, int* pCol = NULL);
  633.     virtual void SetActivePane(int row, int col, CWnd* pWnd = NULL);
  634. protected:
  635.     CWnd* GetActivePane(int& row, int& col); // obsolete
  636.  
  637. public:
  638.     // high level command operations - called by default view implementation
  639.     virtual BOOL CanActivateNext(BOOL bPrev = FALSE);
  640.     virtual void ActivateNext(BOOL bPrev = FALSE);
  641.     virtual BOOL DoKeyboardSplit();
  642.  
  643.     // synchronized scrolling
  644.     virtual BOOL DoScroll(CView* pViewFrom, UINT nScrollCode,
  645.         BOOL bDoScroll = TRUE);
  646.     virtual BOOL DoScrollBy(CView* pViewFrom, CSize sizeScroll,
  647.         BOOL bDoScroll = TRUE);
  648.  
  649. // Implementation
  650. public:
  651.     virtual ~CSplitterWnd();
  652. #ifdef _DEBUG
  653.     virtual void AssertValid() const;
  654.     virtual void Dump(CDumpContext& dc) const;
  655. #endif
  656.  
  657.     // implementation structure
  658.     struct CRowColInfo
  659.     {
  660.         int nMinSize;       // below that try not to show
  661.         int nIdealSize;     // user set size
  662.         // variable depending on the available size layout
  663.         int nCurSize;       // 0 => invisible, -1 => nonexistant
  664.     };
  665.  
  666. protected:
  667.     // customizable implementation attributes (set by constructor or Create)
  668.     CRuntimeClass* m_pDynamicViewClass;
  669.     int m_nMaxRows, m_nMaxCols;
  670.  
  671.     // implementation attributes which control layout of the splitter
  672.     int m_cxSplitter, m_cySplitter;         // size of splitter bar
  673.     int m_cxBorderShare, m_cyBorderShare;   // space on either side of splitter
  674.     int m_cxSplitterGap, m_cySplitterGap;   // amount of space between panes
  675.     int m_cxBorder, m_cyBorder;             // borders in client area
  676.  
  677.     // current state information
  678.     int m_nRows, m_nCols;
  679.     BOOL m_bHasHScroll, m_bHasVScroll;
  680.     CRowColInfo* m_pColInfo;
  681.     CRowColInfo* m_pRowInfo;
  682.  
  683.     // Tracking info - only valid when 'm_bTracking' is set
  684.     BOOL m_bTracking, m_bTracking2;
  685.     CPoint m_ptTrackOffset;
  686.     CRect m_rectLimit;
  687.     CRect m_rectTracker, m_rectTracker2;
  688.     int m_htTrack;
  689.  
  690.     // implementation routines
  691.     BOOL CreateCommon(CWnd* pParentWnd, SIZE sizeMin, DWORD dwStyle, UINT nID);
  692.     virtual int HitTest(CPoint pt) const;
  693.     virtual void GetInsideRect(CRect& rect) const;
  694.     virtual void GetHitRect(int ht, CRect& rect);
  695.     virtual void TrackRowSize(int y, int row);
  696.     virtual void TrackColumnSize(int x, int col);
  697.     virtual void DrawAllSplitBars(CDC* pDC, int cxInside, int cyInside);
  698.     virtual void SetSplitCursor(int ht);
  699.     CWnd* GetSizingParent();
  700.  
  701.     // starting and stopping tracking
  702.     virtual void StartTracking(int ht);
  703.     virtual void StopTracking(BOOL bAccept);
  704.  
  705.     // special command routing to frame
  706.     virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam);
  707.     virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
  708.  
  709.     //{{AFX_MSG(CSplitterWnd)
  710.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  711.     afx_msg void OnMouseMove(UINT nFlags, CPoint pt);
  712.     afx_msg void OnPaint();
  713.     afx_msg void OnLButtonDown(UINT nFlags, CPoint pt);
  714.     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint pt);
  715.     afx_msg void OnLButtonUp(UINT nFlags, CPoint pt);
  716.     afx_msg void OnCancelMode();
  717.     afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  718.     afx_msg void OnSize(UINT nType, int cx, int cy);
  719.     afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  720.     afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  721.     afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
  722.     afx_msg BOOL OnNcCreate(LPCREATESTRUCT lpcs);
  723.     afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  724.     afx_msg void OnDisplayChange();
  725.     //}}AFX_MSG
  726.     DECLARE_MESSAGE_MAP()
  727. };
  728.  
  729. /////////////////////////////////////////////////////////////////////////////
  730. // CFormView - generic view constructed from a dialog template
  731.  
  732. class CFormView : public CScrollView
  733. {
  734.     DECLARE_DYNAMIC(CFormView)
  735.  
  736. // Construction
  737. protected:      // must derive your own class
  738.     CFormView(LPCTSTR lpszTemplateName);
  739.     CFormView(UINT nIDTemplate);
  740.  
  741. // Implementation
  742. public:
  743. #ifdef _DEBUG
  744.     virtual void AssertValid() const;
  745.     virtual void Dump(CDumpContext& dc) const;
  746. #endif
  747.     virtual void OnInitialUpdate();
  748.  
  749. protected:
  750.     LPCTSTR m_lpszTemplateName;
  751.     CCreateContext* m_pCreateContext;
  752.     HWND m_hWndFocus;   // last window to have focus
  753.  
  754.     virtual void OnDraw(CDC* pDC);      // default does nothing
  755.     // special case override of child window creation
  756.     virtual BOOL Create(LPCTSTR, LPCTSTR, DWORD,
  757.         const RECT&, CWnd*, UINT, CCreateContext*);
  758.     virtual BOOL PreTranslateMessage(MSG* pMsg);
  759.     virtual void OnActivateView(BOOL, CView*, CView*);
  760.     virtual void OnActivateFrame(UINT, CFrameWnd*);
  761.     BOOL SaveFocusControl();    // updates m_hWndFocus
  762.  
  763. #ifndef _AFX_NO_OCC_SUPPORT
  764.     // data and functions necessary for OLE control containment
  765.     _AFX_OCC_DIALOG_INFO* m_pOccDialogInfo;
  766.     virtual BOOL SetOccDialogInfo(_AFX_OCC_DIALOG_INFO* pOccDialogInfo);
  767.     afx_msg LRESULT HandleInitDialog(WPARAM, LPARAM);
  768. #endif
  769.  
  770.     //{{AFX_MSG(CFormView)
  771.     afx_msg int OnCreate(LPCREATESTRUCT lpcs);
  772.     afx_msg void OnSetFocus(CWnd* pOldWnd);
  773.     //}}AFX_MSG
  774.     DECLARE_MESSAGE_MAP()
  775. };
  776.  
  777. /////////////////////////////////////////////////////////////////////////////
  778. // CEditView - simple text editor view
  779.  
  780. class CEditView : public CCtrlView
  781. {
  782.     DECLARE_DYNCREATE(CEditView)
  783.  
  784. // Construction
  785. public:
  786.     CEditView();
  787.  
  788. // Attributes
  789. public:
  790.     static AFX_DATA const DWORD dwStyleDefault;
  791.     // CEdit control access
  792.     CEdit& GetEditCtrl() const;
  793.  
  794.     // presentation attributes
  795.     CFont* GetPrinterFont() const;
  796.     void SetPrinterFont(CFont* pFont);
  797.     void SetTabStops(int nTabStops);
  798.  
  799.     // other attributes
  800.     void GetSelectedText(CString& strResult) const;
  801.  
  802.     // buffer access
  803.     LPCTSTR LockBuffer() const;
  804.     void UnlockBuffer() const;
  805.     UINT GetBufferLength() const;
  806.  
  807. // Operations
  808. public:
  809.     BOOL FindText(LPCTSTR lpszFind, BOOL bNext = TRUE, BOOL bCase = TRUE);
  810.     void SerializeRaw(CArchive& ar);
  811.     UINT PrintInsideRect(CDC* pDC, RECT& rectLayout, UINT nIndexStart,
  812.         UINT nIndexStop);
  813.  
  814. // Overrideables
  815. protected:
  816.     virtual void OnFindNext(LPCTSTR lpszFind, BOOL bNext, BOOL bCase);
  817.     virtual void OnReplaceSel(LPCTSTR lpszFind, BOOL bNext, BOOL bCase,
  818.         LPCTSTR lpszReplace);
  819.     virtual void OnReplaceAll(LPCTSTR lpszFind, LPCTSTR lpszReplace,
  820.         BOOL bCase);
  821.     virtual void OnTextNotFound(LPCTSTR lpszFind);
  822.  
  823. // Implementation
  824. public:
  825.     virtual ~CEditView();
  826. #ifdef _DEBUG
  827.     virtual void AssertValid() const;
  828.     virtual void Dump(CDumpContext& dc) const;
  829. #endif
  830.     virtual void Serialize(CArchive& ar);
  831.     virtual void DeleteContents();
  832.     void ReadFromArchive(CArchive& ar, UINT nLen);
  833.     void WriteToArchive(CArchive& ar);
  834.     virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo);
  835.  
  836.     static AFX_DATA const UINT nMaxSize;
  837.         // maximum number of characters supported
  838.  
  839. protected:
  840.     int m_nTabStops;            // tab stops in dialog units
  841.     LPTSTR m_pShadowBuffer;     // special shadow buffer only used in Win32s
  842.     UINT m_nShadowSize;
  843.  
  844.     CUIntArray m_aPageStart;    // array of starting pages
  845.     HFONT m_hPrinterFont;       // if NULL, mirror display font
  846.     HFONT m_hMirrorFont;        // font object used when mirroring
  847.  
  848.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  849.     // printing support
  850.     virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
  851.     virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
  852.     virtual void OnPrint(CDC* pDC, CPrintInfo* pInfo);
  853.     virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo = NULL);
  854.     BOOL PaginateTo(CDC* pDC, CPrintInfo* pInfo);
  855.  
  856.     // find & replace support
  857.     void OnEditFindReplace(BOOL bFindOnly);
  858.     BOOL InitializeReplace();
  859.     BOOL SameAsSelected(LPCTSTR lpszCompare, BOOL bCase);
  860.  
  861.     // special overrides for implementation
  862.     virtual void CalcWindowRect(LPRECT lpClientRect,
  863.         UINT nAdjustType = adjustBorder);
  864.  
  865.     //{{AFX_MSG(CEditView)
  866.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  867.     afx_msg LRESULT OnSetFont(WPARAM wParam, LPARAM lParam);
  868.     afx_msg void OnUpdateNeedSel(CCmdUI* pCmdUI);
  869.     afx_msg void OnUpdateNeedClip(CCmdUI* pCmdUI);
  870.     afx_msg void OnUpdateNeedText(CCmdUI* pCmdUI);
  871.     afx_msg void OnUpdateNeedFind(CCmdUI* pCmdUI);
  872.     afx_msg void OnUpdateEditUndo(CCmdUI* pCmdUI);
  873.     afx_msg BOOL OnEditChange();
  874.     afx_msg void OnEditCut();
  875.     afx_msg void OnEditCopy();
  876.     afx_msg void OnEditPaste();
  877.     afx_msg void OnEditClear();
  878.     afx_msg void OnEditUndo();
  879.     afx_msg void OnEditSelectAll();
  880.     afx_msg void OnEditFind();
  881.     afx_msg void OnEditReplace();
  882.     afx_msg void OnEditRepeat();
  883.     afx_msg LRESULT OnFindReplaceCmd(WPARAM wParam, LPARAM lParam);
  884.     afx_msg void OnDestroy();
  885.     //}}AFX_MSG
  886.     DECLARE_MESSAGE_MAP()
  887. };
  888.  
  889. /////////////////////////////////////////////////////////////////////////////
  890. // CMetaFileDC
  891.  
  892. class CMetaFileDC : public CDC
  893. {
  894.     DECLARE_DYNAMIC(CMetaFileDC)
  895.  
  896. // Constructors
  897. public:
  898.     CMetaFileDC();
  899.     BOOL Create(LPCTSTR lpszFilename = NULL);
  900.     BOOL CreateEnhanced(CDC* pDCRef, LPCTSTR lpszFileName,
  901.         LPCRECT lpBounds, LPCTSTR lpszDescription);
  902.  
  903. // Operations
  904.     HMETAFILE Close();
  905.     HENHMETAFILE CloseEnhanced();
  906.  
  907. // Implementation
  908. public:
  909.     virtual void SetAttribDC(HDC hDC);  // Set the Attribute DC
  910.  
  911. protected:
  912.     virtual void SetOutputDC(HDC hDC);  // Set the Output DC -- Not allowed
  913.     virtual void ReleaseOutputDC();     // Release the Output DC -- Not allowed
  914.  
  915. public:
  916.     virtual ~CMetaFileDC();
  917.  
  918. // Clipping Functions (use the Attribute DC's clip region)
  919.     virtual int GetClipBox(LPRECT lpRect) const;
  920.     virtual BOOL PtVisible(int x, int y) const;
  921.             BOOL PtVisible(POINT point) const;
  922.     virtual BOOL RectVisible(LPCRECT lpRect) const;
  923.  
  924. // Text Functions
  925.     virtual BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount);
  926.             BOOL TextOut(int x, int y, const CString& str);
  927.     virtual BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  928.                 LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths);
  929.             BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  930.                 const CString& str, LPINT lpDxWidths);
  931.     virtual CSize TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount,
  932.                 int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
  933.             CSize TabbedTextOut(int x, int y, const CString& str,
  934.                 int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
  935.     virtual int DrawText(LPCTSTR lpszString, int nCount, LPRECT lpRect,
  936.                 UINT nFormat);
  937.             int DrawText(const CString& str, LPRECT lpRect, UINT nFormat);
  938.  
  939. // Printer Escape Functions
  940.     virtual int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData);
  941.  
  942. // Viewport Functions
  943.     virtual CPoint SetViewportOrg(int x, int y);
  944.             CPoint SetViewportOrg(POINT point);
  945.     virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
  946.     virtual CSize SetViewportExt(int x, int y);
  947.             CSize SetViewportExt(SIZE size);
  948.     virtual CSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
  949.  
  950. protected:
  951.     void AdjustCP(int cx);
  952. };
  953.  
  954. /////////////////////////////////////////////////////////////////////////////
  955. // CRectTracker - simple rectangular tracking rectangle w/resize handles
  956.  
  957. class CRectTracker
  958. {
  959. public:
  960. // Constructors
  961.     CRectTracker();
  962.     CRectTracker(LPCRECT lpSrcRect, UINT nStyle);
  963.  
  964. // Style Flags
  965.     enum StyleFlags
  966.     {
  967.         solidLine = 1, dottedLine = 2, hatchedBorder = 4,
  968.         resizeInside = 8, resizeOutside = 16, hatchInside = 32,
  969.     };
  970.  
  971. // Hit-Test codes
  972.     enum TrackerHit
  973.     {
  974.         hitNothing = -1,
  975.         hitTopLeft = 0, hitTopRight = 1, hitBottomRight = 2, hitBottomLeft = 3,
  976.         hitTop = 4, hitRight = 5, hitBottom = 6, hitLeft = 7, hitMiddle = 8
  977.     };
  978.  
  979. // Attributes
  980.     UINT m_nStyle;      // current state
  981.     CRect m_rect;       // current position (always in pixels)
  982.     CSize m_sizeMin;    // minimum X and Y size during track operation
  983.     int m_nHandleSize;  // size of resize handles (default from WIN.INI)
  984.  
  985. // Operations
  986.     void Draw(CDC* pDC) const;
  987.     void GetTrueRect(LPRECT lpTrueRect) const;
  988.     BOOL SetCursor(CWnd* pWnd, UINT nHitTest) const;
  989.     BOOL Track(CWnd* pWnd, CPoint point, BOOL bAllowInvert = FALSE,
  990.         CWnd* pWndClipTo = NULL);
  991.     BOOL TrackRubberBand(CWnd* pWnd, CPoint point, BOOL bAllowInvert = TRUE);
  992.     int HitTest(CPoint point) const;
  993.     int NormalizeHit(int nHandle) const;
  994.  
  995. // Overridables
  996.     virtual void DrawTrackerRect(LPCRECT lpRect, CWnd* pWndClipTo,
  997.         CDC* pDC, CWnd* pWnd);
  998.     virtual void AdjustRect(int nHandle, LPRECT lpRect);
  999.     virtual void OnChangedRect(const CRect& rectOld);
  1000.     virtual UINT GetHandleMask() const;
  1001.  
  1002. // Implementation
  1003. public:
  1004.     virtual ~CRectTracker();
  1005.  
  1006. protected:
  1007.     BOOL m_bAllowInvert;    // flag passed to Track or TrackRubberBand
  1008.     CRect m_rectLast;
  1009.     CSize m_sizeLast;
  1010.     BOOL m_bErase;          // TRUE if DrawTrackerRect is called for erasing
  1011.     BOOL m_bFinalErase;     // TRUE if DragTrackerRect called for final erase
  1012.  
  1013.     // implementation helpers
  1014.     int HitTestHandles(CPoint point) const;
  1015.     void GetHandleRect(int nHandle, CRect* pHandleRect) const;
  1016.     void GetModifyPointers(int nHandle, int**ppx, int**ppy, int* px, int*py);
  1017.     virtual int GetHandleSize(LPCRECT lpRect = NULL) const;
  1018.     BOOL TrackHandle(int nHandle, CWnd* pWnd, CPoint point, CWnd* pWndClipTo);
  1019.     void Construct();
  1020. };
  1021.  
  1022. /////////////////////////////////////////////////////////////////////////////
  1023. // Informational data structures
  1024.  
  1025. struct CPrintInfo // Printing information structure
  1026. {
  1027.     CPrintInfo();
  1028.     ~CPrintInfo();
  1029.  
  1030.     CPrintDialog* m_pPD;     // pointer to print dialog
  1031.  
  1032.     BOOL m_bDocObject;       // TRUE if printing by IPrint interface
  1033.     BOOL m_bPreview;         // TRUE if in preview mode
  1034.     BOOL m_bDirect;          // TRUE if bypassing Print Dialog
  1035.     BOOL m_bContinuePrinting;// set to FALSE to prematurely end printing
  1036.     UINT m_nCurPage;         // Current page
  1037.     UINT m_nNumPreviewPages; // Desired number of preview pages
  1038.     CString m_strPageDesc;   // Format string for page number display
  1039.     LPVOID m_lpUserData;     // pointer to user created struct
  1040.     CRect m_rectDraw;        // rectangle defining current usable page area
  1041.  
  1042.     // these only valid if m_bDocObject
  1043.     UINT m_nOffsetPage;      // offset of first page in combined IPrint job
  1044.     DWORD m_dwFlags;         // flags passed to IPrint::Print
  1045.  
  1046.     void SetMinPage(UINT nMinPage);
  1047.     void SetMaxPage(UINT nMaxPage);
  1048.     UINT GetMinPage() const;
  1049.     UINT GetMaxPage() const;
  1050.     UINT GetFromPage() const;
  1051.     UINT GetToPage() const;
  1052.     UINT GetOffsetPage() const;
  1053. };
  1054.  
  1055. struct CPrintPreviewState   // Print Preview context/state
  1056. {
  1057.     UINT nIDMainPane;          // main pane ID to hide
  1058.     HMENU hMenu;               // saved hMenu
  1059.     DWORD dwStates;            // Control Bar Visible states (bit map)
  1060.     CView* pViewActiveOld;     // save old active view during preview
  1061.     BOOL (CALLBACK* lpfnCloseProc)(CFrameWnd* pFrameWnd);
  1062.     HACCEL hAccelTable;       // saved accelerator table
  1063.  
  1064. // Implementation
  1065.     CPrintPreviewState();
  1066. };
  1067.  
  1068. struct CCreateContext   // Creation information structure
  1069.     // All fields are optional and may be NULL
  1070. {
  1071.     // for creating new views
  1072.     CRuntimeClass* m_pNewViewClass; // runtime class of view to create or NULL
  1073.     CDocument* m_pCurrentDoc;
  1074.  
  1075.     // for creating MDI children (CMDIChildWnd::LoadFrame)
  1076.     CDocTemplate* m_pNewDocTemplate;
  1077.  
  1078.     // for sharing view/frame state from the original view/frame
  1079.     CView* m_pLastView;
  1080.     CFrameWnd* m_pCurrentFrame;
  1081.  
  1082. // Implementation
  1083.     CCreateContext();
  1084. };
  1085.  
  1086. /////////////////////////////////////////////////////////////////////////////
  1087. // Inline function declarations
  1088.  
  1089. #ifdef _AFX_PACKING
  1090. #pragma pack(pop)
  1091. #endif
  1092.  
  1093. #ifdef _AFX_ENABLE_INLINES
  1094. #define _AFXEXT_INLINE AFX_INLINE
  1095. #include <afxext.inl>
  1096. #endif
  1097.  
  1098. #undef AFX_DATA
  1099. #define AFX_DATA
  1100.  
  1101. #ifdef _AFX_MINREBUILD
  1102. #pragma component(minrebuild, on)
  1103. #endif
  1104. #ifndef _AFX_FULLTYPEINFO
  1105. #pragma component(mintypeinfo, off)
  1106. #endif
  1107.  
  1108. #endif //__AFXEXT_H__
  1109.  
  1110. /////////////////////////////////////////////////////////////////////////////
  1111.