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

800 lines
25 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. // Note: This header file contains useful classes that are documented only
  11. // in the MFC Technical Notes. These classes may change from version to
  12. // version, so be prepared to change your code accordingly if you utilize
  13. // this header. In the future, commonly used portions of this header
  14. // may be moved and officially documented.
  15. #ifndef __AFXPRIV_H__
  16. #define __AFXPRIV_H__
  17. #ifndef __AFXADV_H__
  18. #include <afxadv.h>
  19. #endif
  20. #ifndef _INC_MALLOC
  21. #include <malloc.h>
  22. #endif
  23. #ifndef __AFXEXT_H__
  24. #include <afxext.h>
  25. #endif
  26. #ifdef _AFX_MINREBUILD
  27. #pragma component(minrebuild, off)
  28. #endif
  29. #ifndef _AFX_FULLTYPEINFO
  30. #pragma component(mintypeinfo, on)
  31. #endif
  32. #ifdef _AFX_PACKING
  33. #pragma pack(push, _AFX_PACKING)
  34. #endif
  35. /////////////////////////////////////////////////////////////////////////////
  36. // AFXPRIV - MFC Private Classes
  37. // Implementation structures
  38. struct AFX_SIZEPARENTPARAMS; // Control bar implementation
  39. struct AFX_CMDHANDLERINFO; // Command routing implementation
  40. // Classes declared in this file
  41. //CDC
  42. class CPreviewDC; // Virtual DC for print preview
  43. //CCmdTarget
  44. //CWnd
  45. //CView
  46. class CPreviewView; // Print preview view
  47. //CFrameWnd
  48. class COleCntrFrameWnd;
  49. //CMiniFrameWnd
  50. class CMiniDockFrameWnd;
  51. class CDockContext; // for dragging control bars
  52. /////////////////////////////////////////////////////////////////////////////
  53. #undef AFX_DATA
  54. #define AFX_DATA AFX_CORE_DATA
  55. /////////////////////////////////////////////////////////////////////////////
  56. // Global ID ranges (see Technical note TN020 for more details)
  57. // 8000 -> FFFF command IDs (used for menu items, accelerators and controls)
  58. #define IS_COMMAND_ID(nID) ((nID) & 0x8000)
  59. // 8000 -> DFFF : user commands
  60. // E000 -> EFFF : AFX commands and other things
  61. // F000 -> FFFF : standard windows commands and other things etc
  62. // E000 -> E7FF standard commands
  63. // E800 -> E8FF control bars (first 32 are special)
  64. // E900 -> EEFF standard window controls/components
  65. // EF00 -> EFFF SC_ menu help
  66. // F000 -> FFFF standard strings
  67. #define ID_COMMAND_FROM_SC(sc) (((sc - 0xF000) >> 4) + AFX_IDS_SCFIRST)
  68. // 0000 -> 7FFF IDR range
  69. // 0000 -> 6FFF : user resources
  70. // 7000 -> 7FFF : AFX (and standard windows) resources
  71. // IDR ranges (NOTE: IDR_ values must be <32768)
  72. #define ASSERT_VALID_IDR(nIDR) ASSERT((nIDR) != 0 && (nIDR) < 0x8000)
  73. /////////////////////////////////////////////////////////////////////////////
  74. // Context sensitive help support (see Technical note TN028 for more details)
  75. // Help ID bases
  76. #define HID_BASE_COMMAND 0x00010000UL // ID and IDM
  77. #define HID_BASE_RESOURCE 0x00020000UL // IDR and IDD
  78. #define HID_BASE_PROMPT 0x00030000UL // IDP
  79. #define HID_BASE_NCAREAS 0x00040000UL
  80. #define HID_BASE_CONTROL 0x00050000UL // IDC
  81. #define HID_BASE_DISPATCH 0x00060000UL // IDispatch help codes
  82. /////////////////////////////////////////////////////////////////////////////
  83. // Internal AFX Windows messages (see Technical note TN024 for more details)
  84. // (0x0360 - 0x037F are reserved for MFC)
  85. #define WM_QUERYAFXWNDPROC 0x0360 // lResult = 1 if processed by AfxWndProc
  86. #define WM_SIZEPARENT 0x0361 // lParam = &AFX_SIZEPARENTPARAMS
  87. #define WM_SETMESSAGESTRING 0x0362 // wParam = nIDS (or 0),
  88. // lParam = lpszOther (or NULL)
  89. #define WM_IDLEUPDATECMDUI 0x0363 // wParam == bDisableIfNoHandler
  90. #define WM_INITIALUPDATE 0x0364 // (params unused) - sent to children
  91. #define WM_COMMANDHELP 0x0365 // lResult = TRUE/FALSE,
  92. // lParam = dwContext
  93. #define WM_HELPHITTEST 0x0366 // lResult = dwContext,
  94. // lParam = MAKELONG(x,y)
  95. #define WM_EXITHELPMODE 0x0367 // (params unused)
  96. #define WM_RECALCPARENT 0x0368 // force RecalcLayout on frame window
  97. // (only for inplace frame windows)
  98. #define WM_SIZECHILD 0x0369 // special notify from COleResizeBar
  99. // wParam = ID of child window
  100. // lParam = lpRectNew (new position/size)
  101. #define WM_KICKIDLE 0x036A // (params unused) causes idles to kick in
  102. #define WM_QUERYCENTERWND 0x036B // lParam = HWND to use as centering parent
  103. #define WM_DISABLEMODAL 0x036C // lResult = 0, disable during modal state
  104. // lResult = 1, don't disable
  105. #define WM_FLOATSTATUS 0x036D // wParam combination of FS_* flags below
  106. // WM_ACTIVATETOPLEVEL is like WM_ACTIVATEAPP but works with hierarchies
  107. // of mixed processes (as is the case with OLE in-place activation)
  108. #define WM_ACTIVATETOPLEVEL 0x036E // wParam = nState (like WM_ACTIVATE)
  109. // lParam = pointer to HWND[2]
  110. // lParam[0] = hWnd getting WM_ACTIVATE
  111. // lParam[1] = hWndOther
  112. #define WM_QUERY3DCONTROLS 0x036F // lResult != 0 if 3D controls wanted
  113. // Note: Messages 0x0370, 0x0371, and 0x372 were incorrectly used by
  114. // some versions of Windows. To remain compatible, MFC does not
  115. // use messages in that range.
  116. #define WM_RESERVED_0370 0x0370
  117. #define WM_RESERVED_0371 0x0371
  118. #define WM_RESERVED_0372 0x0372
  119. // WM_SOCKET_NOTIFY and WM_SOCKET_DEAD are used internally by MFC's
  120. // Windows sockets implementation. For more information, see sockcore.cpp
  121. #define WM_SOCKET_NOTIFY 0x0373
  122. #define WM_SOCKET_DEAD 0x0374
  123. // same as WM_SETMESSAGESTRING except not popped if IsTracking()
  124. #define WM_POPMESSAGESTRING 0x0375
  125. #if _MFC_VER >= 0x0600
  126. // WM_HELPPROMPTADDR is used internally to get the address of
  127. // m_dwPromptContext from the associated frame window. This is used
  128. // during message boxes to setup for F1 help while that msg box is
  129. // displayed. lResult is the address of m_dwPromptContext.
  130. #define WM_HELPPROMPTADDR 0x0376
  131. #endif
  132. // Constants used in DLGINIT resources for OLE control containers
  133. // NOTE: These are NOT real Windows messages they are simply tags
  134. // used in the control resource and are never used as 'messages'
  135. #define WM_OCC_LOADFROMSTREAM 0x0376
  136. #define WM_OCC_LOADFROMSTORAGE 0x0377
  137. #define WM_OCC_INITNEW 0x0378
  138. #define WM_OCC_LOADFROMSTREAM_EX 0x037A
  139. #define WM_OCC_LOADFROMSTORAGE_EX 0x037B
  140. // Marker used while rearranging the message queue
  141. #define WM_QUEUE_SENTINEL 0x0379
  142. // Note: Messages 0x037C - 0x37F reserved for future MFC use.
  143. #define WM_RESERVED_037C 0x037C
  144. #define WM_RESERVED_037D 0x037D
  145. #define WM_RESERVED_037E 0x037E
  146. #if _MFC_VER >= 0x0600
  147. // WM_FORWARDMSG - used by ATL to forward a message to another window for processing
  148. // WPARAM - DWORD dwUserData - defined by user
  149. // LPARAM - LPMSG pMsg - a pointer to the MSG structure
  150. // return value - 0 if the message was not processed, nonzero if it was
  151. #define WM_FORWARDMSG 0x037F
  152. #else
  153. #define WM_RESERVED_037F 0x037F
  154. #endif
  155. // like ON_MESSAGE but no return value
  156. #define ON_MESSAGE_VOID(message, memberFxn) \
  157. { message, 0, 0, 0, AfxSig_vv, \
  158. (AFX_PMSG)(AFX_PMSGW)(void (AFX_MSG_CALL CWnd::*)(void))&memberFxn },
  159. // special struct for WM_SIZEPARENT
  160. struct AFX_SIZEPARENTPARAMS
  161. {
  162. HDWP hDWP; // handle for DeferWindowPos
  163. RECT rect; // parent client rectangle (trim as appropriate)
  164. SIZE sizeTotal; // total size on each side as layout proceeds
  165. BOOL bStretch; // should stretch to fill all space
  166. };
  167. // flags for wParam in the WM_FLOATSTATUS message
  168. enum { FS_SHOW = 0x01, FS_HIDE = 0x02,
  169. FS_ACTIVATE = 0x04, FS_DEACTIVATE = 0x08,
  170. FS_ENABLE = 0x10, FS_DISABLE = 0x20,
  171. FS_SYNCACTIVE = 0x40 };
  172. void AFXAPI AfxRepositionWindow(AFX_SIZEPARENTPARAMS* lpLayout,
  173. HWND hWnd, LPCRECT lpRect);
  174. /////////////////////////////////////////////////////////////////////////////
  175. // Implementation of command routing
  176. struct AFX_CMDHANDLERINFO
  177. {
  178. CCmdTarget* pTarget;
  179. void (AFX_MSG_CALL CCmdTarget::*pmf)(void);
  180. };
  181. /////////////////////////////////////////////////////////////////////////////
  182. // Robust file save support
  183. // opens a temp file if modeCreate specified and enough free space
  184. // renaming, etc occurs automatically if everything succeeds
  185. class CMirrorFile : public CFile
  186. {
  187. // Implementation
  188. public:
  189. virtual void Abort();
  190. virtual void Close();
  191. virtual BOOL Open(LPCTSTR lpszFileName, UINT nOpenFlags,
  192. CFileException* pError = NULL);
  193. #if _MFC_VER >= 0x0600
  194. static CString GetTempName(LPCTSTR pstrOriginalFile, BOOL bCreate);
  195. #endif
  196. protected:
  197. CString m_strMirrorName;
  198. };
  199. /////////////////////////////////////////////////////////////////////////////
  200. // Implementation of PrintPreview
  201. class CPreviewDC : public CDC
  202. {
  203. DECLARE_DYNAMIC(CPreviewDC)
  204. public:
  205. virtual void SetAttribDC(HDC hDC); // Set the Attribute DC
  206. virtual void SetOutputDC(HDC hDC);
  207. virtual void ReleaseOutputDC();
  208. // Constructors
  209. CPreviewDC();
  210. // Implementation
  211. public:
  212. virtual ~CPreviewDC();
  213. #ifdef _DEBUG
  214. virtual void AssertValid() const;
  215. virtual void Dump(CDumpContext& dc) const;
  216. #endif
  217. void SetScaleRatio(int nNumerator, int nDenominator);
  218. void SetTopLeftOffset(CSize TopLeft);
  219. void ClipToPage();
  220. // These conversion functions can be used without an output DC
  221. void PrinterDPtoScreenDP(LPPOINT lpPoint) const;
  222. // Device-Context Functions
  223. virtual int SaveDC();
  224. virtual BOOL RestoreDC(int nSavedDC);
  225. public:
  226. virtual CGdiObject* SelectStockObject(int nIndex);
  227. virtual CFont* SelectObject(CFont* pFont);
  228. // Drawing-Attribute Functions
  229. virtual COLORREF SetBkColor(COLORREF crColor);
  230. virtual COLORREF SetTextColor(COLORREF crColor);
  231. // Mapping Functions
  232. virtual int SetMapMode(int nMapMode);
  233. virtual CPoint SetViewportOrg(int x, int y);
  234. virtual CPoint OffsetViewportOrg(int nWidth, int nHeight);
  235. virtual CSize SetViewportExt(int x, int y);
  236. virtual CSize ScaleViewportExt(int xNum, int xDenom, int yNum, int yDenom);
  237. virtual CSize SetWindowExt(int x, int y);
  238. virtual CSize ScaleWindowExt(int xNum, int xDenom, int yNum, int yDenom);
  239. // Text Functions
  240. virtual BOOL TextOut(int x, int y, LPCTSTR lpszString, int nCount);
  241. virtual BOOL ExtTextOut(int x, int y, UINT nOptions, LPCRECT lpRect,
  242. LPCTSTR lpszString, UINT nCount, LPINT lpDxWidths);
  243. virtual CSize TabbedTextOut(int x, int y, LPCTSTR lpszString, int nCount,
  244. int nTabPositions, LPINT lpnTabStopPositions, int nTabOrigin);
  245. virtual int DrawText(LPCTSTR lpszString, int nCount, LPRECT lpRect,
  246. UINT nFormat);
  247. virtual BOOL GrayString(CBrush* pBrush,
  248. BOOL (CALLBACK* lpfnOutput)(HDC, LPARAM, int),
  249. LPARAM lpData, int nCount,
  250. int x, int y, int nWidth, int nHeight);
  251. // Printer Escape Functions
  252. virtual int Escape(int nEscape, int nCount, LPCSTR lpszInData, LPVOID lpOutData);
  253. // Implementation
  254. protected:
  255. void MirrorMappingMode(BOOL bCompute);
  256. void MirrorViewportOrg();
  257. void MirrorFont();
  258. void MirrorAttributes();
  259. CSize ComputeDeltas(int& x, LPCTSTR lpszString, UINT& nCount, BOOL bTabbed,
  260. UINT nTabStops, LPINT lpnTabStops, int nTabOrigin,
  261. LPTSTR lpszOutputString, int* pnDxWidths, int& nRightFixup);
  262. protected:
  263. int m_nScaleNum; // Scale ratio Numerator
  264. int m_nScaleDen; // Scale ratio Denominator
  265. int m_nSaveDCIndex; // DC Save index when Screen DC Attached
  266. int m_nSaveDCDelta; // delta between Attrib and output restore indices
  267. CSize m_sizeTopLeft;// Offset for top left corner of page
  268. HFONT m_hFont; // Font selected into the screen DC (NULL if none)
  269. HFONT m_hPrinterFont; // Font selected into the print DC
  270. CSize m_sizeWinExt; // cached window extents computed for screen
  271. CSize m_sizeVpExt; // cached viewport extents computed for screen
  272. };
  273. /////////////////////////////////////////////////////////////////////////////
  274. // CPreviewView
  275. class CDialogBar;
  276. class CPreviewView : public CScrollView
  277. {
  278. DECLARE_DYNCREATE(CPreviewView)
  279. // Constructors
  280. public:
  281. CPreviewView();
  282. BOOL SetPrintView(CView* pPrintView);
  283. // Attributes
  284. protected:
  285. CView* m_pOrigView;
  286. CView* m_pPrintView;
  287. CPreviewDC* m_pPreviewDC; // Output and attrib DCs Set, not created
  288. CDC m_dcPrint; // Actual printer DC
  289. // Operations
  290. void SetZoomState(UINT nNewState, UINT nPage, CPoint point);
  291. void SetCurrentPage(UINT nPage, BOOL bClearRatios);
  292. // Returns TRUE if in a page rect. Returns the page index
  293. // in nPage and the point converted to 1:1 screen device coordinates
  294. BOOL FindPageRect(CPoint& point, UINT& nPage);
  295. // Overridables
  296. virtual void OnActivateView(BOOL bActivate,
  297. CView* pActivateView, CView* pDeactiveView);
  298. // Returns .cx/.cy as the numerator/denominator pair for the ratio
  299. // using CSize for convenience
  300. virtual CSize CalcScaleRatio(CSize windowSize, CSize actualSize);
  301. virtual void PositionPage(UINT nPage);
  302. virtual void OnDisplayPageNumber(UINT nPage, UINT nPagesDisplayed);
  303. // Implementation
  304. public:
  305. virtual ~CPreviewView();
  306. virtual void OnPrepareDC(CDC* pDC, CPrintInfo* pInfo = NULL);
  307. #ifdef _DEBUG
  308. void AssertValid() const;
  309. void Dump(CDumpContext& dc) const;
  310. #endif
  311. protected:
  312. //{{AFX_MSG(CPreviewView)
  313. afx_msg void OnPreviewClose();
  314. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  315. afx_msg void OnSize(UINT nType, int cx, int cy);
  316. afx_msg void OnDraw(CDC* pDC);
  317. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  318. afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  319. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  320. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  321. afx_msg void OnNumPageChange();
  322. afx_msg void OnNextPage();
  323. afx_msg void OnPrevPage();
  324. afx_msg void OnPreviewPrint();
  325. afx_msg void OnZoomIn();
  326. afx_msg void OnZoomOut();
  327. afx_msg void OnUpdateNumPageChange(CCmdUI* pCmdUI);
  328. afx_msg void OnUpdateNextPage(CCmdUI* pCmdUI);
  329. afx_msg void OnUpdatePrevPage(CCmdUI* pCmdUI);
  330. afx_msg void OnUpdateZoomIn(CCmdUI* pCmdUI);
  331. afx_msg void OnUpdateZoomOut(CCmdUI* pCmdUI);
  332. afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  333. //}}AFX_MSG
  334. void DoZoom(UINT nPage, CPoint point);
  335. void SetScaledSize(UINT nPage);
  336. CSize CalcPageDisplaySize();
  337. CPrintPreviewState* m_pPreviewState; // State to restore
  338. CDialogBar* m_pToolBar; // Toolbar for preview
  339. struct PAGE_INFO
  340. {
  341. #if _MFC_VER >= 0x0600
  342. PAGE_INFO();
  343. #endif
  344. CRect rectScreen; // screen rect (screen device units)
  345. CSize sizeUnscaled; // unscaled screen rect (screen device units)
  346. CSize sizeScaleRatio; // scale ratio (cx/cy)
  347. CSize sizeZoomOutRatio; // scale ratio when zoomed out (cx/cy)
  348. };
  349. PAGE_INFO* m_pPageInfo; // Array of page info structures
  350. PAGE_INFO m_pageInfoArray[2]; // Embedded array for the default implementation
  351. BOOL m_bPageNumDisplayed;// Flags whether or not page number has yet
  352. // been displayed on status line
  353. UINT m_nZoomOutPages; // number of pages when zoomed out
  354. UINT m_nZoomState;
  355. UINT m_nMaxPages; // for sanity checks
  356. UINT m_nCurrentPage;
  357. UINT m_nPages;
  358. int m_nSecondPageOffset; // used to shift second page position
  359. HCURSOR m_hMagnifyCursor;
  360. CSize m_sizePrinterPPI; // printer pixels per inch
  361. CPoint m_ptCenterPoint;
  362. CPrintInfo* m_pPreviewInfo;
  363. DECLARE_MESSAGE_MAP()
  364. friend class CView;
  365. friend BOOL CALLBACK _AfxPreviewCloseProc(CFrameWnd* pFrameWnd);
  366. };
  367. // Zoom States
  368. #define ZOOM_OUT 0
  369. #define ZOOM_MIDDLE 1
  370. #define ZOOM_IN 2
  371. #if _MFC_VER >= 0x0600
  372. /////////////////////////////////////////////////////////////////////////////
  373. // mirroring support
  374. //WINBUG: some mirroring stuff will be in wingdi.h someday
  375. #ifndef LAYOUT_LTR
  376. #define LAYOUT_LTR 0x00000000
  377. #endif
  378. #ifndef LAYOUT_RTL
  379. #define LAYOUT_RTL 0x00000001
  380. #endif
  381. #ifndef NOMIRRORBITMAP
  382. #define NOMIRRORBITMAP 0x80000000
  383. #endif
  384. //WINBUG: some mirroring stuff will be in winuser.h someday
  385. #ifndef WS_EX_LAYOUTRTL
  386. #define WS_EX_LAYOUTRTL 0x00400000L
  387. #endif
  388. #endif
  389. /////////////////////////////////////////////////////////////////////////////
  390. // toolbar docking support
  391. class CDockContext
  392. {
  393. public:
  394. // Construction
  395. CDockContext(CControlBar* pBar);
  396. // Attributes
  397. CPoint m_ptLast; // last mouse position during drag
  398. CRect m_rectLast;
  399. CSize m_sizeLast;
  400. BOOL m_bDitherLast;
  401. // Rectangles used during dragging or resizing
  402. CRect m_rectDragHorz;
  403. CRect m_rectDragVert;
  404. CRect m_rectFrameDragHorz;
  405. CRect m_rectFrameDragVert;
  406. CControlBar* m_pBar; // the toolbar that created this context
  407. CFrameWnd* m_pDockSite; // the controlling frame of the CControlBar
  408. DWORD m_dwDockStyle; // allowable dock styles for bar
  409. DWORD m_dwOverDockStyle; // style of dock that rect is over
  410. DWORD m_dwStyle; // style of control bar
  411. BOOL m_bFlip; // if shift key is down
  412. BOOL m_bForceFrame; // if ctrl key is down
  413. CDC* m_pDC; // where to draw during drag
  414. BOOL m_bDragging;
  415. int m_nHitTest;
  416. UINT m_uMRUDockID;
  417. CRect m_rectMRUDockPos;
  418. DWORD m_dwMRUFloatStyle;
  419. CPoint m_ptMRUFloatPos;
  420. // Drag Operations
  421. virtual void StartDrag(CPoint pt);
  422. void Move(CPoint pt); // called when mouse has moved
  423. void EndDrag(); // drop
  424. void OnKey(int nChar, BOOL bDown);
  425. // Resize Operations
  426. virtual void StartResize(int nHitTest, CPoint pt);
  427. void Stretch(CPoint pt);
  428. void EndResize();
  429. // Double Click Operations
  430. virtual void ToggleDocking();
  431. // Operations
  432. void InitLoop();
  433. void CancelLoop();
  434. // Implementation
  435. public:
  436. ~CDockContext();
  437. BOOL Track();
  438. void DrawFocusRect(BOOL bRemoveRect = FALSE);
  439. // draws the correct outline
  440. void UpdateState(BOOL* pFlag, BOOL bNewValue);
  441. DWORD CanDock();
  442. CDockBar* GetDockBar(DWORD dwOverDockStyle);
  443. };
  444. /////////////////////////////////////////////////////////////////////////////
  445. // CControlBarInfo - used for docking serialization
  446. class CControlBarInfo
  447. {
  448. public:
  449. // Implementation
  450. CControlBarInfo();
  451. // Attributes
  452. UINT m_nBarID; // ID of this bar
  453. BOOL m_bVisible; // visibility of this bar
  454. BOOL m_bFloating; // whether floating or not
  455. BOOL m_bHorz; // orientation of floating dockbar
  456. BOOL m_bDockBar; // TRUE if a dockbar
  457. CPoint m_pointPos; // topleft point of window
  458. UINT m_nMRUWidth; // MRUWidth for Dynamic Toolbars
  459. BOOL m_bDocking; // TRUE if this bar has a DockContext
  460. UINT m_uMRUDockID; // most recent docked dockbar
  461. CRect m_rectMRUDockPos; // most recent docked position
  462. DWORD m_dwMRUFloatStyle; // most recent floating orientation
  463. CPoint m_ptMRUFloatPos; // most recent floating position
  464. CPtrArray m_arrBarID; // bar IDs for bars contained within this one
  465. CControlBar* m_pBar; // bar which this refers to (transient)
  466. void Serialize(CArchive& ar, CDockState* pDockState);
  467. BOOL LoadState(LPCTSTR lpszProfileName, int nIndex, CDockState* pDockState);
  468. BOOL SaveState(LPCTSTR lpszProfileName, int nIndex);
  469. };
  470. /////////////////////////////////////////////////////////////////////////////
  471. // CDockBar - used for docking
  472. class CDockBar : public CControlBar
  473. {
  474. DECLARE_DYNAMIC(CDockBar)
  475. // Construction
  476. public:
  477. CDockBar(BOOL bFloating = FALSE); // TRUE if attached to CMiniDockFrameWnd
  478. BOOL Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID);
  479. // Attributes
  480. BOOL m_bFloating;
  481. virtual BOOL IsDockBar() const;
  482. int GetDockedCount() const;
  483. virtual int GetDockedVisibleCount() const;
  484. // Operations
  485. void DockControlBar(CControlBar* pBar, LPCRECT lpRect = NULL);
  486. void ReDockControlBar(CControlBar* pBar, LPCRECT lpRect = NULL);
  487. #if _MFC_VER >= 0x0600
  488. BOOL RemoveControlBar(CControlBar*, int nPosExclude = -1, int nAddPlaceHolder = 0);
  489. #else
  490. BOOL RemoveControlBar(CControlBar*, int nPosExclude = -1, BOOL bAddPlaceHolder = FALSE);
  491. #endif
  492. void RemovePlaceHolder(CControlBar* pBar);
  493. // Implementation
  494. public:
  495. virtual ~CDockBar();
  496. #ifdef _DEBUG
  497. virtual void AssertValid() const;
  498. virtual void Dump(CDumpContext& dc) const;
  499. #endif
  500. virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  501. virtual void DoPaint(CDC* pDC);
  502. // public implementation helpers
  503. void GetBarInfo(CControlBarInfo* pInfo);
  504. void SetBarInfo(CControlBarInfo* pInfo, CFrameWnd* pFrameWnd);
  505. int FindBar(CControlBar* pBar, int nPosExclude = -1);
  506. void ShowAll(BOOL bShow);
  507. CPtrArray m_arrBars; // each element is a CControlBar
  508. protected:
  509. BOOL m_bLayoutQuery;
  510. CRect m_rectLayout;
  511. CControlBar* GetDockedControlBar(int nPos) const;
  512. // implementation helpers
  513. int Insert(CControlBar* pBar, CRect rect, CPoint ptMid);
  514. virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
  515. //{{AFX_MSG(CDockBar)
  516. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS* lpncsp);
  517. afx_msg void OnNcPaint();
  518. afx_msg void OnWindowPosChanging(LPWINDOWPOS lpWndPos);
  519. afx_msg void OnPaint();
  520. afx_msg LRESULT OnSizeParent(WPARAM, LPARAM);
  521. //}}AFX_MSG
  522. DECLARE_MESSAGE_MAP()
  523. friend class CMiniDockFrameWnd;
  524. };
  525. class CMiniDockFrameWnd : public CMiniFrameWnd
  526. {
  527. DECLARE_DYNCREATE(CMiniDockFrameWnd)
  528. public:
  529. // Construction
  530. CMiniDockFrameWnd();
  531. virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
  532. // Operations
  533. virtual void RecalcLayout(BOOL bNotify = TRUE);
  534. // Implementation
  535. public:
  536. CDockBar m_wndDockBar;
  537. //{{AFX_MSG(CMiniFrameWnd)
  538. afx_msg void OnClose();
  539. afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  540. afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
  541. //}}AFX_MSG
  542. afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  543. DECLARE_MESSAGE_MAP()
  544. };
  545. /////////////////////////////////////////////////////////////////////////////
  546. // COleCntrFrameWnd
  547. class COleIPFrameWnd;
  548. class COleCntrFrameWnd : public CFrameWnd
  549. {
  550. // Constructor
  551. public:
  552. COleCntrFrameWnd(COleIPFrameWnd* pInPlaceFrame);
  553. // Implementation
  554. protected:
  555. COleIPFrameWnd* m_pInPlaceFrame;
  556. virtual void PostNcDestroy();
  557. public:
  558. virtual ~COleCntrFrameWnd();
  559. virtual void RecalcLayout(BOOL bNotify = TRUE);
  560. void OnIdleUpdateCmdUI();
  561. virtual BOOL OnCmdMsg(UINT nID, int nCode, void* pExtra,
  562. AFX_CMDHANDLERINFO* pHandlerInfo);
  563. #ifdef _DEBUG
  564. void AssertValid() const;
  565. #endif
  566. };
  567. /////////////////////////////////////////////////////////////////////////////
  568. // CDialogTemplate
  569. class CDialogTemplate
  570. {
  571. // Constructors
  572. public:
  573. CDialogTemplate(const DLGTEMPLATE* pTemplate = NULL);
  574. CDialogTemplate(HGLOBAL hGlobal);
  575. // Attributes
  576. BOOL HasFont() const;
  577. BOOL SetFont(LPCTSTR lpFaceName, WORD nFontSize);
  578. BOOL SetSystemFont(WORD nFontSize = 0);
  579. BOOL GetFont(CString& strFaceName, WORD& nFontSize) const;
  580. void GetSizeInDialogUnits(SIZE* pSize) const;
  581. void GetSizeInPixels(SIZE* pSize) const;
  582. static BOOL AFX_CDECL GetFont(const DLGTEMPLATE* pTemplate,
  583. CString& strFaceName, WORD& nFontSize);
  584. // Operations
  585. BOOL Load(LPCTSTR lpDialogTemplateID);
  586. HGLOBAL Detach();
  587. // Implementation
  588. public:
  589. ~CDialogTemplate();
  590. HGLOBAL m_hTemplate;
  591. DWORD m_dwTemplateSize;
  592. BOOL m_bSystemFont;
  593. protected:
  594. static BYTE* AFX_CDECL GetFontSizeField(const DLGTEMPLATE* pTemplate);
  595. static UINT AFX_CDECL GetTemplateSize(const DLGTEMPLATE* pTemplate);
  596. BOOL SetTemplate(const DLGTEMPLATE* pTemplate, UINT cb);
  597. };
  598. /////////////////////////////////////////////////////////////////////////////
  599. // WM_NOTIFY support
  600. struct AFX_NOTIFY
  601. {
  602. LRESULT* pResult;
  603. NMHDR* pNMHDR;
  604. };
  605. /////////////////////////////////////////////////////////////////////////////
  606. // Global implementation helpers
  607. // window creation hooking
  608. void AFXAPI AfxHookWindowCreate(CWnd* pWnd);
  609. BOOL AFXAPI AfxUnhookWindowCreate();
  610. void AFXAPI AfxResetMsgCache();
  611. // for backward compatibility to previous versions
  612. #define _AfxHookWindowCreate AfxHookWindowCreate
  613. #define _AfxUnhookWindowCreate AfxUnhookWindowCreate
  614. // string helpers
  615. void AFXAPI AfxSetWindowText(HWND hWndCtrl, LPCTSTR lpszNew);
  616. int AFXAPI AfxLoadString(UINT nIDS, LPTSTR lpszBuf, UINT nMaxBuf = 256);
  617. HDC AFXAPI AfxCreateDC(HGLOBAL hDevNames, HGLOBAL hDevMode);
  618. void AFXAPI AfxGetModuleShortFileName(HINSTANCE hInst, CString& strShortName);
  619. // Failure dialog helpers
  620. void AFXAPI AfxFailMaxChars(CDataExchange* pDX, int nChars);
  621. void AFXAPI AfxFailRadio(CDataExchange* pDX);
  622. // DLL load helpers
  623. HINSTANCE AFXAPI AfxLoadDll(HINSTANCE* volatile hInst, LPCSTR lpszDLL);
  624. HINSTANCE AFXAPI AfxLoadDll(HINSTANCE* volatile hInst, LPCSTR lpszDLL,
  625. FARPROC* pProcPtrs, LPCSTR lpszProcName);
  626. #ifndef __AFXCONV_H__
  627. #include <afxconv.h>
  628. #endif
  629. /////////////////////////////////////////////////////////////////////////////
  630. #ifdef _AFX_PACKING
  631. #pragma pack(pop)
  632. #endif
  633. #undef AFX_DATA
  634. #define AFX_DATA
  635. #ifdef _AFX_MINREBUILD
  636. #pragma component(minrebuild, on)
  637. #endif
  638. #ifndef _AFX_FULLTYPEINFO
  639. #pragma component(mintypeinfo, off)
  640. #endif
  641. #endif // __AFXPRIV_H__
  642. /////////////////////////////////////////////////////////////////////////////
  643. #ifndef __AFXPRIV2_H__
  644. #include <afxpriv2.h>
  645. #endif