| 1 |
///////////////////////////////////////////////////////////////////////// |
| 2 |
// |
| 3 |
// CSizingControlBar Version 2.44 |
| 4 |
// |
| 5 |
// Created: Jan 24, 1998 Last Modified: March 31, 2002 |
| 6 |
// |
| 7 |
// See the official site at www.datamekanix.com for documentation and |
| 8 |
// the latest news. |
| 9 |
// |
| 10 |
///////////////////////////////////////////////////////////////////////// |
| 11 |
// Copyright (C) 1998-2002 by Cristi Posea. All rights reserved. |
| 12 |
// |
| 13 |
// This code is free for personal and commercial use, providing this |
| 14 |
// notice remains intact in the source files and all eventual changes are |
| 15 |
// clearly marked with comments. |
| 16 |
// |
| 17 |
// You must obtain the author's consent before you can include this code |
| 18 |
// in a software library. |
| 19 |
// |
| 20 |
// No warrantee of any kind, express or implied, is included with this |
| 21 |
// software; use at your own risk, responsibility for damages (if any) to |
| 22 |
// anyone resulting from the use of this software rests entirely with the |
| 23 |
// user. |
| 24 |
// |
| 25 |
// Send bug reports, bug fixes, enhancements, requests, flames, etc. to |
| 26 |
// cristi@datamekanix.com or post them at the message board at the site. |
| 27 |
///////////////////////////////////////////////////////////////////////// |
| 28 |
|
| 29 |
#if !defined(__SIZECBAR_H__) |
| 30 |
#define __SIZECBAR_H__ |
| 31 |
|
| 32 |
#include <afxpriv.h> // for CDockContext |
| 33 |
#include <afxtempl.h> // for CTypedPtrArray |
| 34 |
|
| 35 |
#if _MSC_VER >= 1000 |
| 36 |
#pragma once |
| 37 |
#endif // _MSC_VER >= 1000 |
| 38 |
|
| 39 |
|
| 40 |
#if defined(_SCB_MINIFRAME_CAPTION) && !defined(_SCB_REPLACE_MINIFRAME) |
| 41 |
#error "_SCB_MINIFRAME_CAPTION requires _SCB_REPLACE_MINIFRAME" |
| 42 |
#endif |
| 43 |
|
| 44 |
///////////////////////////////////////////////////////////////////////// |
| 45 |
// CSCBDockBar dummy class for access to protected members |
| 46 |
|
| 47 |
class CSCBDockBar : public CDockBar |
| 48 |
{ |
| 49 |
friend class CSizingControlBar; |
| 50 |
}; |
| 51 |
|
| 52 |
///////////////////////////////////////////////////////////////////////// |
| 53 |
// CSizingControlBar control bar styles |
| 54 |
|
| 55 |
#define SCBS_EDGELEFT 0x00000001 |
| 56 |
#define SCBS_EDGERIGHT 0x00000002 |
| 57 |
#define SCBS_EDGETOP 0x00000004 |
| 58 |
#define SCBS_EDGEBOTTOM 0x00000008 |
| 59 |
#define SCBS_EDGEALL 0x0000000F |
| 60 |
#define SCBS_SHOWEDGES 0x00000010 |
| 61 |
#define SCBS_SIZECHILD 0x00000020 |
| 62 |
|
| 63 |
///////////////////////////////////////////////////////////////////////// |
| 64 |
// CSizingControlBar control bar |
| 65 |
|
| 66 |
#ifndef baseCSizingControlBar |
| 67 |
#define baseCSizingControlBar CControlBar |
| 68 |
#endif |
| 69 |
|
| 70 |
class CSizingControlBar; |
| 71 |
typedef CTypedPtrArray <CPtrArray, CSizingControlBar*> CSCBArray; |
| 72 |
|
| 73 |
class CSizingControlBar : public baseCSizingControlBar |
| 74 |
{ |
| 75 |
DECLARE_DYNAMIC( CSizingControlBar ); |
| 76 |
|
| 77 |
// Construction |
| 78 |
public: |
| 79 |
CSizingControlBar(); |
| 80 |
|
| 81 |
virtual BOOL Create( LPCTSTR lpszWindowName, CWnd* pParentWnd, |
| 82 |
CSize sizeDefault, BOOL bHasGripper, |
| 83 |
UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP ); |
| 84 |
virtual BOOL Create( LPCTSTR lpszWindowName, CWnd* pParentWnd, |
| 85 |
UINT nID, DWORD dwStyle = WS_CHILD | WS_VISIBLE | CBRS_TOP ); |
| 86 |
|
| 87 |
// Attributes |
| 88 |
public: |
| 89 |
const BOOL IsFloating() const; |
| 90 |
const BOOL IsHorzDocked() const; |
| 91 |
const BOOL IsVertDocked() const; |
| 92 |
const BOOL IsSideTracking() const; |
| 93 |
const BOOL GetSCBStyle() const |
| 94 |
{ |
| 95 |
return m_dwSCBStyle; |
| 96 |
} |
| 97 |
|
| 98 |
// Operations |
| 99 |
public: |
| 100 |
#if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION) |
| 101 |
|
| 102 |
void EnableDocking( DWORD dwDockStyle ); |
| 103 |
#endif |
| 104 |
|
| 105 |
virtual void LoadState( LPCTSTR lpszProfileName ); |
| 106 |
virtual void SaveState( LPCTSTR lpszProfileName ); |
| 107 |
static void GlobalLoadState( CFrameWnd* pFrame, LPCTSTR lpszProfileName ); |
| 108 |
static void GlobalSaveState( CFrameWnd* pFrame, LPCTSTR lpszProfileName ); |
| 109 |
void SetSCBStyle( DWORD dwSCBStyle ) |
| 110 |
{ |
| 111 |
m_dwSCBStyle = ( dwSCBStyle & ~SCBS_EDGEALL ); |
| 112 |
} |
| 113 |
|
| 114 |
// Overridables |
| 115 |
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHndler ); |
| 116 |
|
| 117 |
// Overrides |
| 118 |
public: |
| 119 |
// ClassWizard generated virtual function overrides |
| 120 |
//{{AFX_VIRTUAL(CSizingControlBar) |
| 121 |
public: |
| 122 |
virtual CSize CalcFixedLayout( BOOL bStretch, BOOL bHorz ); |
| 123 |
virtual CSize CalcDynamicLayout( int nLength, DWORD dwMode ); |
| 124 |
//}}AFX_VIRTUAL |
| 125 |
|
| 126 |
// Implementation |
| 127 |
public: |
| 128 |
virtual ~CSizingControlBar(); |
| 129 |
|
| 130 |
protected: |
| 131 |
// implementation helpers |
| 132 |
UINT GetEdgeHTCode( int nEdge ); |
| 133 |
BOOL GetEdgeRect( CRect rcWnd, UINT nHitTest, CRect& rcEdge ); |
| 134 |
virtual void StartTracking( UINT nHitTest, CPoint point ); |
| 135 |
virtual void StopTracking(); |
| 136 |
virtual void OnTrackUpdateSize( CPoint& point ); |
| 137 |
virtual void OnTrackInvertTracker(); |
| 138 |
virtual void NcPaintGripper( CDC* pDC, CRect rcClient ); |
| 139 |
virtual void NcCalcClient( LPRECT pRc, UINT nDockBarID ); |
| 140 |
|
| 141 |
virtual void AlignControlBars(); |
| 142 |
void GetRowInfo( int& nFirst, int& nLast, int& nThis ); |
| 143 |
void GetRowSizingBars( CSCBArray& arrSCBars ); |
| 144 |
void GetRowSizingBars( CSCBArray& arrSCBars, int& nThis ); |
| 145 |
BOOL NegotiateSpace( int nLengthTotal, BOOL bHorz ); |
| 146 |
|
| 147 |
protected: |
| 148 |
DWORD m_dwSCBStyle; |
| 149 |
UINT m_htEdge; |
| 150 |
|
| 151 |
CSize m_szHorz; |
| 152 |
CSize m_szVert; |
| 153 |
CSize m_szFloat; |
| 154 |
CSize m_szMinHorz; |
| 155 |
CSize m_szMinVert; |
| 156 |
CSize m_szMinFloat; |
| 157 |
int m_nTrackPosMin; |
| 158 |
int m_nTrackPosMax; |
| 159 |
int m_nTrackPosOld; |
| 160 |
int m_nTrackEdgeOfs; |
| 161 |
BOOL m_bTracking; |
| 162 |
BOOL m_bKeepSize; |
| 163 |
BOOL m_bParentSizing; |
| 164 |
BOOL m_bDragShowContent; |
| 165 |
UINT m_nDockBarID; |
| 166 |
int m_cxEdge; |
| 167 |
|
| 168 |
// Generated message map functions |
| 169 |
protected: |
| 170 |
//{{AFX_MSG(CSizingControlBar) |
| 171 |
afx_msg int OnCreate( LPCREATESTRUCT lpCreateStruct ); |
| 172 |
afx_msg void OnNcPaint(); |
| 173 |
afx_msg void OnNcCalcSize( BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp ); |
| 174 |
afx_msg UINT OnNcHitTest( CPoint point ); |
| 175 |
afx_msg void OnCaptureChanged( CWnd *pWnd ); |
| 176 |
afx_msg void OnSettingChange( UINT uFlags, LPCTSTR lpszSection ); |
| 177 |
afx_msg void OnLButtonUp( UINT nFlags, CPoint point ); |
| 178 |
afx_msg void OnMouseMove( UINT nFlags, CPoint point ); |
| 179 |
afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point ); |
| 180 |
afx_msg void OnLButtonDown( UINT nFlags, CPoint point ); |
| 181 |
afx_msg void OnLButtonDblClk( UINT nFlags, CPoint point ); |
| 182 |
afx_msg void OnRButtonDown( UINT nFlags, CPoint point ); |
| 183 |
afx_msg void OnWindowPosChanging( WINDOWPOS FAR* lpwndpos ); |
| 184 |
afx_msg void OnPaint(); |
| 185 |
afx_msg void OnClose(); |
| 186 |
afx_msg void OnSize( UINT nType, int cx, int cy ); |
| 187 |
//}}AFX_MSG |
| 188 |
afx_msg LRESULT OnSetText( WPARAM wParam, LPARAM lParam ); |
| 189 |
|
| 190 |
DECLARE_MESSAGE_MAP() |
| 191 |
|
| 192 |
#ifdef _SCB_REPLACE_MINIFRAME |
| 193 |
friend class CSCBMiniDockFrameWnd; |
| 194 |
#endif //_SCB_REPLACE_MINIFRAME |
| 195 |
}; |
| 196 |
|
| 197 |
#ifdef _SCB_REPLACE_MINIFRAME |
| 198 |
#ifndef _SCB_MINIFRAME_CAPTION |
| 199 |
///////////////////////////////////////////////////////////////////////// |
| 200 |
// CSCBDockContext dockcontext |
| 201 |
|
| 202 |
class CSCBDockContext : public CDockContext |
| 203 |
{ |
| 204 |
public: |
| 205 |
// Construction |
| 206 |
CSCBDockContext( CControlBar* pBar ) : CDockContext( pBar ) |
| 207 |
{} |
| 208 |
|
| 209 |
// Drag Operations |
| 210 |
virtual void StartDrag( CPoint pt ); |
| 211 |
}; |
| 212 |
#endif //_SCB_MINIFRAME_CAPTION |
| 213 |
|
| 214 |
///////////////////////////////////////////////////////////////////////// |
| 215 |
// CSCBMiniDockFrameWnd miniframe |
| 216 |
|
| 217 |
#ifndef baseCSCBMiniDockFrameWnd |
| 218 |
#define baseCSCBMiniDockFrameWnd CMiniDockFrameWnd |
| 219 |
#endif |
| 220 |
|
| 221 |
class CSCBMiniDockFrameWnd : public baseCSCBMiniDockFrameWnd |
| 222 |
{ |
| 223 |
DECLARE_DYNCREATE( CSCBMiniDockFrameWnd ) |
| 224 |
|
| 225 |
// Overrides |
| 226 |
// ClassWizard generated virtual function overrides |
| 227 |
//{{AFX_VIRTUAL(CSCBMiniDockFrameWnd) |
| 228 |
public: |
| 229 |
virtual BOOL Create( CWnd* pParent, DWORD dwBarStyle ); |
| 230 |
//}}AFX_VIRTUAL |
| 231 |
|
| 232 |
// Implementation |
| 233 |
public: |
| 234 |
CSizingControlBar* GetSizingControlBar(); |
| 235 |
|
| 236 |
//{{AFX_MSG(CSCBMiniDockFrameWnd) |
| 237 |
afx_msg void OnNcLButtonDown( UINT nHitTest, CPoint point ); |
| 238 |
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI ); |
| 239 |
afx_msg void OnWindowPosChanging( WINDOWPOS FAR* lpwndpos ); |
| 240 |
afx_msg void OnSize( UINT nType, int cx, int cy ); |
| 241 |
//}}AFX_MSG |
| 242 |
DECLARE_MESSAGE_MAP() |
| 243 |
}; |
| 244 |
#endif //_SCB_REPLACE_MINIFRAME |
| 245 |
|
| 246 |
#endif // !defined(__SIZECBAR_H__) |