afxext.h 36 KB

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