sizingcb.h

Go to the documentation of this file.
00001 #ifndef GENERATING_DOXYGEN_OUTPUT
00002 /**
00003  * \file sizingcb.h <mgui/sizingcb.h>
00004  * \brief Definitions for CSizingControlBar classes
00005  *
00006  * This combines the sizecbar.h, scbarg.h and scbarcf.h headers from the
00007  * original download from www.datamekanix.com.  - mju 7 Feb 2001
00008  *
00009  * \if NODOC
00010  * $Log: sizingcb.h_v $
00011  * Revision 1.3  2003/10/03 19:58:19  linux32build!build
00012  * Doxygen
00013  *
00014  * Revision 1.2  2003/09/15 13:49:32  fileserver!dwilliss
00015  * Doxygen
00016  *
00017  * Revision 1.1  2002/12/11 15:22:30  mju
00018  * Initial revision
00019  *
00020  * 
00021  * 1     2/07/01 11:32a Mju
00022  * \endif
00023 **/
00024 
00025 #if !defined(INC_MGUI_SIZINGCB_H) && defined(WIN32_MFC)
00026 #define  INC_MGUI_SIZINGCB_H
00027 
00028 #if _MSC_VER >= 1000
00029 #pragma once
00030 #endif //!< _MSC_VER >= 1000
00031 
00032 /////////////////////////////////////////////////////////////////////////!
00033 //!
00034 //! CSizingControlBar            Version 2.43
00035 //!
00036 //! Created: Jan 24, 1998        Last Modified: August 03, 2000
00037 //!
00038 //! See the official site at www.datamekanix.com for documentation and
00039 //! the latest news.
00040 //!
00041 /////////////////////////////////////////////////////////////////////////!
00042 //! Copyright (C) 1998-2000 by Cristi Posea. All rights reserved.
00043 //!
00044 //! This code is free for personal and commercial use, providing this 
00045 //! notice remains intact in the source files and all eventual changes are
00046 //! clearly marked with comments.
00047 //!
00048 //! You must obtain the author's consent before you can include this code
00049 //! in a software library.
00050 //!
00051 //! No warrantee of any kind, express or implied, is included with this
00052 //! software; use at your own risk, responsibility for damages (if any) to
00053 //! anyone resulting from the use of this software rests entirely with the
00054 //! user.
00055 //!
00056 //! Send bug reports, bug fixes, enhancements, requests, flames, etc. to
00057 //! cristi@datamekanix.com or post them at the message board at the site.
00058 /////////////////////////////////////////////////////////////////////////!
00059 
00060 
00061 #include <afxpriv.h>    //! for CDockContext
00062 #include <afxtempl.h>   //! for CTypedPtrArray
00063 
00064 #if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME)
00065     #error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME"
00066 #endif
00067 
00068 /////////////////////////////////////////////////////////////////////////!
00069 //! CSCBDockBar dummy class for access to protected members
00070 
00071 class CSCBDockBar : public CDockBar
00072 {
00073     friend class CSizingControlBar;
00074 };
00075 
00076 /////////////////////////////////////////////////////////////////////////!
00077 //! CSizingControlBar control bar styles
00078 
00079 #define SCBS_EDGELEFT       0x00000001
00080 #define SCBS_EDGERIGHT      0x00000002
00081 #define SCBS_EDGETOP        0x00000004
00082 #define SCBS_EDGEBOTTOM     0x00000008
00083 #define SCBS_EDGEALL        0x0000000F
00084 #define SCBS_SHOWEDGES      0x00000010
00085 #define SCBS_SIZECHILD      0x00000020
00086 
00087 /////////////////////////////////////////////////////////////////////////!
00088 //! CSizingControlBar control bar
00089 
00090 #ifndef baseCSizingControlBar
00091 #define baseCSizingControlBar CControlBar
00092 #endif
00093 
00094 class CSizingControlBar;
00095 typedef CTypedPtrArray <CPtrArray, CSizingControlBar*> CSCBArray;
00096 
00097 class CSizingControlBar : public baseCSizingControlBar
00098 {
00099     DECLARE_DYNAMIC(CSizingControlBar);
00100 
00101 //! Construction
00102 public:
00103     CSizingControlBar();
00104 
00105     virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
00106         CSize sizeDefault, BOOL bHasGripper,
00107         UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
00108     virtual BOOL Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
00109         UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP);
00110 
00111 //! Attributes
00112 public:
00113     const BOOL IsFloating() const;
00114     const BOOL IsHorzDocked() const;
00115     const BOOL IsVertDocked() const;
00116     const BOOL IsSideTracking() const;
00117     const BOOL GetSCBStyle() const {return m_dwSCBStyle;}
00118 
00119 //! Operations
00120 public:
00121 #if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
00122     void EnableDocking(DWORD dwDockStyle);
00123 #endif
00124     virtual void LoadState(LPCTSTR lpszProfileName);
00125     virtual void SaveState(LPCTSTR lpszProfileName);
00126     static void GlobalLoadState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
00127     static void GlobalSaveState(CFrameWnd* pFrame, LPCTSTR lpszProfileName);
00128     void SetSCBStyle(DWORD dwSCBStyle)
00129         {m_dwSCBStyle = (dwSCBStyle & ~SCBS_EDGEALL);}
00130 
00131 //! Overridables
00132     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00133 
00134 //! Overrides
00135 public:
00136     //! ClassWizard generated virtual function overrides
00137     //!{{AFX_VIRTUAL(CSizingControlBar)
00138     public:
00139     virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
00140     virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
00141     //!}}AFX_VIRTUAL
00142 
00143 //! Implementation
00144 public:
00145     virtual ~CSizingControlBar();
00146     
00147 protected:
00148     //! implementation helpers
00149     UINT GetEdgeHTCode(int nEdge);
00150     BOOL GetEdgeRect(CRect rcWnd, UINT nHitTest, CRect& rcEdge);
00151     virtual void StartTracking(UINT nHitTest, CPoint point);
00152     virtual void StopTracking();
00153     virtual void OnTrackUpdateSize(CPoint& point);
00154     virtual void OnTrackInvertTracker();
00155     virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
00156     virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);
00157 
00158     virtual void AlignControlBars();
00159     void GetRowInfo(int& nFirst, int& nLast, int& nThis);
00160     void GetRowSizingBars(CSCBArray& arrSCBars);
00161     void GetRowSizingBars(CSCBArray& arrSCBars, int& nThis);
00162     BOOL NegotiateSpace(int nLengthTotal, BOOL bHorz);
00163 
00164 protected:
00165     DWORD   m_dwSCBStyle;
00166     UINT    m_htEdge;
00167 
00168     CSize   m_szHorz;
00169     CSize   m_szVert;
00170     CSize   m_szFloat;
00171     CSize   m_szMinHorz;
00172     CSize   m_szMinVert;
00173     CSize   m_szMinFloat;
00174     int     m_nTrackPosMin;
00175     int     m_nTrackPosMax;
00176     int     m_nTrackPosOld;
00177     int     m_nTrackEdgeOfs;
00178     BOOL    m_bTracking;
00179     BOOL    m_bKeepSize;
00180     BOOL    m_bParentSizing;
00181     BOOL    m_bDragShowContent;
00182     UINT    m_nDockBarID;
00183     int     m_cxEdge;
00184 
00185 //! Generated message map functions
00186 protected:
00187     //!{{AFX_MSG(CSizingControlBar)
00188     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
00189     afx_msg void OnNcPaint();
00190     afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
00191     afx_msg UINT OnNcHitTest(CPoint point);
00192     afx_msg void OnCaptureChanged(CWnd *pWnd);
00193     afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);
00194     afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
00195     afx_msg void OnMouseMove(UINT nFlags, CPoint point);
00196     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
00197     afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
00198     afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
00199     afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
00200     afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
00201     afx_msg void OnPaint();
00202     afx_msg void OnClose();
00203     afx_msg void OnSize(UINT nType, int cx, int cy);
00204     //!}}AFX_MSG
00205     afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
00206 
00207     DECLARE_MESSAGE_MAP()
00208 
00209 #ifdef _SCB_REPLACE_MINIFRAME
00210     friend class CSCBMiniDockFrameWnd;
00211 #endif //!<_SCB_REPLACE_MINIFRAME
00212 };
00213 
00214 #ifdef _SCB_REPLACE_MINIFRAME
00215 #ifndef _SCB_MINIFRAME_CAPTION
00216 /////////////////////////////////////////////////////////////////////////!
00217 //! CSCBDockContext dockcontext
00218 
00219 class CSCBDockContext : public CDockContext
00220 {
00221 public:
00222 //! Construction
00223     CSCBDockContext(CControlBar* pBar) : CDockContext(pBar) {}
00224 
00225 //! Drag Operations
00226     virtual void StartDrag(CPoint pt);
00227 };
00228 #endif //!<_SCB_MINIFRAME_CAPTION
00229 
00230 /////////////////////////////////////////////////////////////////////////!
00231 //! CSCBMiniDockFrameWnd miniframe
00232 
00233 #ifndef baseCSCBMiniDockFrameWnd
00234 #define baseCSCBMiniDockFrameWnd CMiniDockFrameWnd
00235 #endif
00236 
00237 class CSCBMiniDockFrameWnd : public baseCSCBMiniDockFrameWnd
00238 {
00239     DECLARE_DYNCREATE(CSCBMiniDockFrameWnd)
00240 
00241 //! Overrides
00242     //! ClassWizard generated virtual function overrides
00243     //!{{AFX_VIRTUAL(CSCBMiniDockFrameWnd)
00244     public:
00245     virtual BOOL Create(CWnd* pParent, DWORD dwBarStyle);
00246     //!}}AFX_VIRTUAL
00247 
00248 //! Implementation
00249 public:
00250     CSizingControlBar* GetSizingControlBar();
00251 
00252     //!{{AFX_MSG(CSCBMiniDockFrameWnd)
00253     afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
00254     afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
00255     afx_msg void OnWindowPosChanging(WINDOWPOS FAR* lpwndpos);
00256     afx_msg void OnSize(UINT nType, int cx, int cy);
00257     //!}}AFX_MSG
00258     DECLARE_MESSAGE_MAP()
00259 };
00260 #endif //!<_SCB_REPLACE_MINIFRAME
00261 
00262 
00263 
00264 /////////////////////////////////////////////////////////////////////////!
00265 //! CSCBButton (button info) helper class
00266 
00267 class CSCBButton
00268 {
00269 public:
00270     CSCBButton();
00271 
00272     void Move(CPoint ptTo) {ptOrg = ptTo; };
00273     CRect GetRect() { return CRect(ptOrg, CSize(11, 11)); };
00274     void Paint(CDC* pDC);
00275 
00276     BOOL    bPushed;
00277     BOOL    bRaised;
00278 
00279 protected:
00280     CPoint  ptOrg;
00281 };
00282 
00283 /////////////////////////////////////////////////////////////////////////!
00284 //! CSizingControlBar control bar
00285 
00286 #ifndef baseCSizingControlBarG
00287 #define baseCSizingControlBarG CSizingControlBar
00288 #endif
00289 
00290 class CSizingControlBarG : public baseCSizingControlBarG
00291 {
00292     DECLARE_DYNAMIC(CSizingControlBarG);
00293 
00294 //! Construction
00295 public:
00296     CSizingControlBarG();
00297 
00298 //! Attributes
00299 public:
00300     virtual BOOL HasGripper() const;
00301 
00302 //! Operations
00303 public:
00304 
00305 //! Overridables
00306     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00307 
00308 //! Overrides
00309 public:
00310     //! ClassWizard generated virtual function overrides
00311     //!{{AFX_VIRTUAL(CSizingControlBarG)
00312     //!}}AFX_VIRTUAL
00313 
00314 //! Implementation
00315 public:
00316     virtual ~CSizingControlBarG();
00317     
00318 protected:
00319     //! implementation helpers
00320     virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
00321     virtual void NcCalcClient(LPRECT pRc, UINT nDockBarID);
00322 
00323 protected:
00324     int     m_cyGripper;
00325 
00326     CSCBButton m_biHide;
00327 
00328 //! Generated message map functions
00329 protected:
00330     //!{{AFX_MSG(CSizingControlBarG)
00331     afx_msg UINT OnNcHitTest(CPoint point);
00332     afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
00333     //!}}AFX_MSG
00334 
00335     DECLARE_MESSAGE_MAP()
00336 };
00337 
00338 
00339 /////////////////////////////////////////////////////////////////////////!
00340 //! CSizingControlBarCF
00341 
00342 #ifndef baseCSizingControlBarCF
00343 #define baseCSizingControlBarCF CSizingControlBarG
00344 #endif
00345 
00346 class CSizingControlBarCF : public baseCSizingControlBarCF
00347 {
00348     DECLARE_DYNAMIC(CSizingControlBarCF)
00349 
00350 //! Construction
00351 public:
00352     CSizingControlBarCF();
00353 
00354 //! Overridables
00355     virtual void OnUpdateCmdUI(CFrameWnd* pTarget, BOOL bDisableIfNoHndler);
00356 
00357 //! Implementation
00358 protected:
00359     //! implementation helpers
00360     virtual void NcPaintGripper(CDC* pDC, CRect rcClient);
00361 
00362 protected:
00363     BOOL    m_bActive; //!< a child has focus
00364     CString m_sFontFace;
00365 
00366 //! Generated message map functions
00367 protected:
00368     //!{{AFX_MSG(CSizingControlBarCF)
00369     //!}}AFX_MSG
00370     afx_msg LRESULT OnSetText(WPARAM wParam, LPARAM lParam);
00371 
00372     DECLARE_MESSAGE_MAP()
00373 };
00374 
00375 /////////////////////////////////////////////////////////////////////////!
00376 
00377 #endif   // INC_MGUI_SIZINGCB_H
00378 #endif // GENERATING_DOXYGEN_OUTPUT

Generated on Tue Dec 14 13:18:18 2004 for TNTsdk by  doxygen 1.3.8-20040913