sizecbar.h

00001 
00002 //
00003 // CSizingControlBar            Version 2.43
00004 //
00005 // Created: Jan 24, 1998        Last Modified: August 03, 2000
00006 //
00007 // See the official site at www.datamekanix.com for documentation and
00008 // the latest news.
00009 //
00011 // Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
00012 //
00013 // This code is free for personal and commercial use, providing this 
00014 // notice remains intact in the source files and all eventual changes are
00015 // clearly marked with comments.
00016 //
00017 // You must obtain the author's consent before you can include this code
00018 // in a software library.
00019 //
00020 // No warrantee of any kind, express or implied, is included with this
00021 // software; use at your own risk, responsibility for damages (if any) to
00022 // anyone resulting from the use of this software rests entirely with the
00023 // user.
00024 //
00025 // Send bug reports, bug fixes, enhancements, requests, flames, etc. to
00026 // [email protected] or post them at the message board at the site.
00028 
00029 #if !defined(__SIZECBAR_H__)
00030 #define __SIZECBAR_H__
00031 
00032 #include <afxpriv.h>    // for CDockContext
00033 #include <afxtempl.h>   // for CTypedPtrArray
00034 
00035 #if _MSC_VER >= 1000
00036 #pragma once
00037 #endif // _MSC_VER >= 1000
00038 
00039 
00040 #if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME)
00041     #error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME"
00042 #endif
00043 
00045 // CSCBDockBar dummy class for access to protected members
00046 
00047 class CSCBDockBar : public CDockBar
00048 {
00049     friend class CSizingControlBar;
00050 };
00051 
00053 // CSizingControlBar control bar styles
00054 
00055 #define SCBS_EDGELEFT       0x00000001
00056 #define SCBS_EDGERIGHT      0x00000002
00057 #define SCBS_EDGETOP        0x00000004
00058 #define SCBS_EDGEBOTTOM     0x00000008
00059 #define SCBS_EDGEALL        0x0000000F
00060 #define SCBS_SHOWEDGES      0x00000010
00061 #define SCBS_SIZECHILD      0x00000020
00062 
00064 // CSizingControlBar control bar
00065 
00066 #ifndef baseCSizingControlBar
00067 #define baseCSizingControlBar CControlBar
00068 #endif
00069 
00070 class CSizingControlBar;
00071 typedef CTypedPtrArray <CPtrArray, CSizingControlBar*> CSCBArray;
00072 
00073 class CSizingControlBar : public baseCSizingControlBar
00074 {
00075     DECLARE_DYNAMIC(CSizingControlBar);
00076 
00077 // Construction
00078 public:
00079     CSizingControlBar();
00080 
00081     virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
00082         CSize sizeDefault, BOOL bHasGripper,
00083         UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
00084     virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
00085         UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
00086 
00087 // Attributes
00088 public:
00089     const BOOL IsFloating() const;
00090     const BOOL IsHorzDocked() const;
00091     const BOOL IsVertDocked() const;
00092     const BOOL IsSideTracking() const;
00093     const BOOL GetSCBStyle() const {return m_dwSCBStyle;}
00094 
00095 // Operations
00096 public:
00097 #if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
00098     void EnableDocking(DWORD dwDockStyle);
00099 #endif
00100     virtual void LoadState(LPCTSTR lpszProfileName);
00101     virtual void SaveState(LPCTSTR lpszProfileName);
00102     static void GlobalLoadState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
00103     static void GlobalSaveState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
00104     void SetSCBStyle(DWORD dwSCBStyle)
00105         {m_dwSCBStyle = (dwSCBStyle & ~SCBS_EDGEALL);}
00106 
00107         void SetHeight(const int nHeight)
00108         {
00109                 m_szFloat.cy = m_szHorz.cy = m_szVert.cy = nHeight;
00110                 m_pDockSite->DelayRecalcLayout();
00111         }
00112 
00113 
00114 // Overridables
00115     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00116 
00117 // Overrides
00118 public:
00119     // ClassWizard generated virtual function overrides
00120     //{{AFX_VIRTUAL(CSizingControlBar)
00121     public:
00122     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
00123     virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
00124     //}}AFX_VIRTUAL
00125 
00126 // Implementation
00127 public:
00128     virtual ~CSizingControlBar();
00129     
00130 protected:
00131     // implementation helpers
00132     UINT GetEdgeHTCode(int nEdge);
00133     BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
00134     virtual void StartTracking(UINT nHitTest, CPoint point);
00135     virtual void StopTracking();
00136     virtual void OnTrackUpdateSize(CPoint& point);
00137     virtual void OnTrackInvertTracker();
00138     virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
00139     virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);
00140 
00141     virtual void AlignControlBars();
00142     void GetRowInfo(int& nFirst, int& nLast, int& nThis);
00143     void GetRowSizingBars(CSCBArray& arrSCBars);
00144     void GetRowSizingBars(CSCBArray& arrSCBars, int& nThis);
00145     BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz);
00146 
00147 protected:
00148     DWORD   m_dwSCBStyle;
00149     UINT    m_htEdge;
00150 
00151     CSize   m_szHorz;
00152     CSize   m_szVert;
00153     CSize   m_szFloat;
00154     CSize   m_szMinHorz;
00155     CSize   m_szMinVert;
00156     CSize   m_szMinFloat;
00157     int     m_nTrackPosMin;
00158     int     m_nTrackPosMax;
00159     int     m_nTrackPosOld;
00160     int     m_nTrackEdgeOfs;
00161     BOOL    m_bTracking;
00162     BOOL    m_bKeepSize;
00163     BOOL    m_bParentSizing;
00164     BOOL    m_bDragShowContent;
00165     UINT    m_nDockBarID;
00166     int     m_cxEdge;
00167 
00168         BOOL    m_bFixedFloat;
00169         CSize   m_szFixedFloat;
00170 
00171 // Generated message map functions
00172 protected:
00173     //{{AFX_MSG(CSizingControlBar)
00174     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00175     afx_msg void OnNcPaint();
00176     afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
00177     afx_msg LRESULT OnNcHitTest(CPoint point);
00178     afx_msg void OnCaptureChanged(CWnd *pWnd);
00179     afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
00180     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00181     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00182     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
00183     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00184     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00185     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00186     afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
00187     afx_msg void OnPaint();
00188     afx_msg void OnClose();
00189     afx_msg void OnSize(UINT nType, int cx, int cy);
00190     //}}AFX_MSG
00191     afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
00192 
00193     DECLARE_MESSAGE_MAP()
00194 
00195 #ifdef _SCB_REPLACE_MINIFRAME
00196     friend class CSCBMiniDockFrameWnd;
00197 #endif //_SCB_REPLACE_MINIFRAME
00198 };
00199 
00200 #ifdef _SCB_REPLACE_MINIFRAME
00201 #ifndef _SCB_MINIFRAME_CAPTION
00202 
00203 // CSCBDockContext dockcontext
00204 
00205 class CSCBDockContext : public CDockContext
00206 {
00207 public:
00208 // Construction
00209     CSCBDockContext(CControlBar* pBar) : CDockContext(pBar) {}
00210 
00211 // Drag Operations
00212     virtual void StartDrag(CPoint pt);
00213 };
00214 #endif //_SCB_MINIFRAME_CAPTION
00215 
00217 // CSCBMiniDockFrameWnd miniframe
00218 
00219 #ifndef baseCSCBMiniDockFrameWnd
00220 #define baseCSCBMiniDockFrameWnd CMiniDockFrameWnd
00221 #endif
00222 
00223 class CSCBMiniDockFrameWnd : public baseCSCBMiniDockFrameWnd
00224 {
00225     DECLARE_DYNCREATE(CSCBMiniDockFrameWnd)
00226 
00227 // Overrides
00228     // ClassWizard generated virtual function overrides
00229     //{{AFX_VIRTUAL(CSCBMiniDockFrameWnd)
00230     public:
00231     virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
00232     //}}AFX_VIRTUAL
00233 
00234 // Implementation
00235 public:
00236     CSizingControlBar* GetSizingControlBar();
00237 
00238     //{{AFX_MSG(CSCBMiniDockFrameWnd)
00239     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
00240     afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
00241     afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
00242     afx_msg void OnSize(UINT nType, int cx, int cy);
00243     //}}AFX_MSG
00244     DECLARE_MESSAGE_MAP()
00245 };
00246 #endif //_SCB_REPLACE_MINIFRAME
00247 
00248 #endif // !defined(__SIZECBAR_H__)
00249 

Generated on Tue Dec 13 14:47:58 2005 for guliverkli by  doxygen 1.4.5