home *** CD-ROM | disk | FTP | other *** search
/ Prima Shareware 3 / DuCom_Prima-Shareware-3_cd1.bin / PROGRAMO / C / MRCE / SOURCE.ZIP / MRCPRIV.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-01-10  |  8.9 KB  |  286 lines

  1. // MRCEXT: Micro Focus Extension DLL for MFC 2.1+
  2. // Copyright (C)1994-5    Micro Focus Inc, 2465 East Bayshore Rd, Palo Alto, CA 94303.
  3. // 
  4. //  This program is free software; you can redistribute it and/or modify
  5. //  it under the terms of the GNU General Public License as published by
  6. //  the Free Software Foundation. In addition, you may also charge for any
  7. //  application    using MRCEXT, and are under no obligation to supply source
  8. //  code. You must accredit Micro Focus Inc in the "About Box", or banner
  9. //  of your application. 
  10. //
  11. //  This program is distributed in the hope that it will be useful,
  12. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. //  GNU General Public License for more details.
  15. //
  16. //  You should also have received a copy of the GNU General Public License with this
  17. //  software, also indicating additional rights you have when using MRCEXT.  
  18. //
  19. //
  20. // MRCPRIV.H
  21. // $Date:   10 Jan 1996 12:11:12  $
  22. // $Revision:   1.3  $
  23. // $Author:   MRC  $
  24. // MRCPRIV.H
  25. //
  26. // Private within extension module.
  27.  
  28. #ifndef __MRCPRIV_H__
  29. #define __MRCPRIV_H__
  30.  
  31. #undef AFX_DATA
  32. #define AFX_DATA AFX_EXT_DATA
  33.  
  34.  
  35. #ifdef _DEBUG
  36. //#define _VERBOSE_TRACE
  37. #endif
  38.  
  39.  
  40. #define REG_VERSION            "Version"
  41. #define REG_VERSION_NO        1        // current version of docking state
  42.  
  43.  
  44. /////////////////////////////////////////////////////////////////////////////
  45. typedef struct _ROWSIZEINFO
  46. {
  47.     int nFlexWidth;                 // space taken up by flexible bars
  48.     int nFixedWidth;                // space taken up by fixed size bars
  49.     int nMaxHeight;                 // max height taken  (both flexible and fixed height bars)
  50.     int nMaxFixedHeight;    // max height taken by a fixed size bar.
  51.     int nFlexBars;                  // number of sized bars
  52.     int nTotalBars;                 // total no of bars in the row.
  53.     int nTotalWidth;                    // fixed + flex width
  54. } ROWSIZEINFO;
  55.  
  56.  
  57. /////////////////////////////////////////////////////////////////////////////
  58. // CSplitterRect class - simple representation of splitter rectangles
  59. class CSplitterRect : public CObject
  60. {
  61. public:
  62.         CRect   m_rect;         // rectangle
  63.         char    m_type;         // Vertical or Horizontal
  64.         int             m_nPos;         // position at which it was inserted
  65.                                                 // ie points to pane immediately following it.
  66.  
  67. #define SPLITTER_VERT   1
  68. #define SPLITTER_HORZ   2
  69.  
  70.     CSplitterRect(int type, const RECT & rect);
  71.     void CSplitterRect::Draw(CDC *pDC);
  72. };
  73.  
  74. /////////////////////////////////////////////////////////////////////////////
  75. // CSizeDockBar window
  76. class CSizeDockBar : public CDockBar
  77. {
  78.     // Construction
  79. public:
  80.     DECLARE_DYNAMIC(CSizeDockBar)
  81.     CSizeDockBar();        // TRUE if inside MDI frame
  82.  
  83. // Attributes
  84. public:
  85.     CObArray        m_SplitArr;             // array of CSplitterRect's constructed by ReCalcLayout
  86.  
  87.     CSplitterRect * m_pSplitCapture;        // capture splitter rect (if any)
  88.     HCURSOR         m_hcurLast;                             // last cursor type
  89.  
  90.     // following items used to detect when DockBar has changed since last time, so we
  91.     // can re-arrange the rows if parent resizes, or bars are docked/floated/hidden
  92.     CSize           m_LayoutSize;   // size used in previous layout
  93.     int             m_CountBars;    // no of bars for previous layout - need to go better than this..
  94.     CPtrArray        m_arrHiddenBars;        // array of currently invisible bars
  95.  
  96. // Operations
  97. public:
  98.     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
  99.     void TileDockedBars();
  100.     void AdjustForNewBar(CControlBar *pBar);        
  101.     BOOL WasBarHidden(CControlBar *pBar);
  102.     
  103. protected:
  104.     // Splitter rectangles...
  105.     CSplitterRect * GetSplitter(int i)
  106.                 { return ((CSplitterRect *)(m_SplitArr[i])); };
  107.     void AddSplitterRect(int type, int x1, int y1, int x2, int y2, int nPos);
  108.     void DeleteSplitterRects();
  109.     void SetSplitterSizeInRange(int start, int type, int length);
  110.     CSplitterRect * SetHitCursor(CPoint pt);
  111.     CSplitterRect * HitTest(CPoint pt);
  112.     void StartTracking(CPoint pt);
  113.  
  114.         // Navigating rows
  115.     int StartPosOfRow(int nPos);
  116.     int StartPosOfPreviousRow(int nPos);
  117.  
  118.         // Resizing rows
  119.     BOOL IsRowSizeable(int nPos);
  120.  
  121.     void GetRowSizeInfo(int nPos,  ROWSIZEINFO * pRZI, const CPtrArray & arrBars);
  122.     BOOL AdjustAllRowSizes(int nNewSize);
  123.     BOOL AdjustRowSizes(int nPos, int nNewSize, CPtrArray & arrBars);
  124.     void TileDockedBarsRow(int nPos);
  125.  
  126.     int ShrinkRowToLeft(int nPos, int nAmount, BOOL bApply, int * pnFlex = NULL);
  127.     int ShrinkRowToRight(int nPos, int nAmount, BOOL bApply, int * pnFlex = NULL);
  128.     int CheckSumBars() const;
  129.  
  130. public:
  131.     // Dragging
  132.     int TestInsertPosition(CControlBar* pBarIns, CRect rect);
  133.     int BarsOnThisRow(CControlBar *pBarIns, CRect rect);
  134.         
  135.     // Miscellaneous
  136.     CMRCSizeControlBar * GetFirstControlBar ();
  137.  
  138.     BOOL IsBarHorizontal()
  139.                 { return (m_dwStyle & (CBRS_ALIGN_TOP | CBRS_ALIGN_BOTTOM)); };
  140.  
  141. #define IsSizeable(pBar) (BOOL) ((CControlBar *) pBar)->IsKindOf(RUNTIME_CLASS(CMRCSizeControlBar))
  142.  
  143. // Overrides
  144.     // ClassWizard generated virtual function overrides
  145.     //{{AFX_VIRTUAL(CSizeDockBar)
  146.     //}}AFX_VIRTUAL
  147.  
  148. // Implementation
  149. public:
  150.     virtual ~CSizeDockBar();
  151.  
  152.     // Generated message map functions
  153. protected:
  154.     //{{AFX_MSG(CSizeDockBar)
  155.     afx_msg void OnPaint();
  156.     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  157.     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  158.     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  159.     afx_msg BOOL OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  160.     //}}AFX_MSG
  161.     afx_msg LRESULT OnSizeParent(WPARAM, LPARAM);
  162.     DECLARE_MESSAGE_MAP()
  163. };
  164.  
  165.  
  166.  
  167. class CDragDockContext : public CDockContext
  168. {
  169. // Attributes
  170. public:
  171.     CRect m_rectDragDock;                           // rectangle indicating where we'll dock
  172.  
  173. protected:
  174.     CRect m_rectDragHorzAlone;        
  175.     CRect m_rectDragVertAlone;
  176.     CSizeDockBar * m_pTargetDockBar;
  177.     CPoint    m_ptStart;
  178.  
  179. // Construction
  180. public:
  181.     CDragDockContext(CControlBar* pBar);
  182.  
  183. // Operations
  184.     virtual void StartDrag(CPoint pt);    // only thing called externally
  185.     void Move(CPoint pt);       // called when mouse has moved
  186.     void EndDrag();             // drop
  187.     void CancelDrag();          // drag cancelled
  188.     void OnKey(int nChar, BOOL bDown);
  189.  
  190. // Implementation
  191. public:
  192.     ~CDragDockContext();
  193.     BOOL Track();
  194.     void DrawFocusRect(BOOL bRemoveRect = FALSE);
  195.     void UpdateState(BOOL* pFlag, BOOL bNewValue);
  196.     DWORD CanDock();
  197.     CDockBar* GetDockBar();
  198. };
  199.  
  200.  
  201. /////////////////////////////////////////////////////////////////////////////
  202. // CSizeDockFrame window
  203. class CSizableMiniDockFrameWnd : public CMiniDockFrameWnd
  204. {
  205.  
  206. friend CDragDockContext;         // access to IgnoreSysMove flag
  207. private:
  208.     DECLARE_DYNCREATE(CSizableMiniDockFrameWnd)
  209.  
  210.     //{{AFX_VIRTUAL(CSizableMiniDockFrameWnd)
  211.     protected:
  212.     virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  213.     //}}AFX_VIRTUAL
  214.  
  215. // Attributes
  216. public:
  217.     enum ContainedBarType { Unknown, MFCBase, MRCSizeBar } ;
  218.     enum ContainedBarType GetContainedBarType();
  219.     
  220. protected:
  221.     enum ContainedBarType m_nContainedBarType;    
  222.  
  223.     
  224.     //{{AFX_MSG(CSizableMiniDockFrameWnd)
  225.     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  226.     afx_msg void OnSize(UINT nType, int cx, int cy);
  227.     afx_msg void OnClose();
  228.     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint pt);
  229.     afx_msg UINT OnNcHitTest(CPoint point);
  230.     afx_msg int OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message);
  231. //}}AFX_MSG
  232.  
  233.     DECLARE_MESSAGE_MAP()
  234. };
  235.  
  236.  
  237. /////////////////////////////////////////////////////////////////////////////
  238. // CMRCMDIFloatWnd frame - used when floating a control bar in an MDI client frame
  239. /////////////////////////////////////////////////////////////////////////////
  240.  
  241. #define CMDIFloat_Parent CMDIChildWnd        // in case I change my mind on derivation !
  242.  
  243. class CMRCMDIFloatWnd : public CMDIFloat_Parent
  244. {
  245.     DECLARE_DYNCREATE(CMRCMDIFloatWnd)
  246. protected:
  247.     CMRCMDIFloatWnd();           // protected constructor used by dynamic creation
  248.  
  249. public:
  250.     CDockBar    m_wndMDIDockBar;        
  251.  
  252. // Attributes
  253. public:
  254.  
  255. // Operations
  256. public:
  257.     virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
  258.     void RecalcLayout(BOOL bNotify = TRUE);
  259.  
  260. // Overrides
  261.     // ClassWizard generated virtual function overrides
  262.     //{{AFX_VIRTUAL(CMRCMDIFloatWnd)
  263.     protected:
  264.     //}}AFX_VIRTUAL
  265.  
  266. // Implementation
  267. protected:
  268.     virtual ~CMRCMDIFloatWnd();
  269.  
  270.     // Generated message map functions
  271.     //{{AFX_MSG(CMRCMDIFloatWnd)
  272.     afx_msg void OnSize(UINT nType, int cx, int cy);
  273.     afx_msg void OnClose();
  274.     afx_msg void OnWindowPosChanged(WINDOWPOS FAR* lpwndpos);
  275.     //}}AFX_MSG
  276.     DECLARE_MESSAGE_MAP()
  277. };
  278.  
  279.  
  280. void AdjustForBorders(CRect& rect, DWORD dwStyle);
  281.  
  282.  
  283. #undef AFX_DATA
  284. #define AFX_DATA
  285. #endif
  286.