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