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