123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416 |
- #include "stdafx.h"
- #include "sizecbar.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- IMPLEMENT_DYNAMIC(CSizingControlBar, baseCSizingControlBar);
- BOOL CSizingControlBar::m_bTracking=FALSE;
- CSizingControlBar::CSizingControlBar()
- {
- m_szMinHorz = CSize(33, 32);
- m_szMinVert = CSize(33, 32);
- m_szMinFloat = CSize(37, 32);
- m_szHorz = CSize(500, 500);
- m_szVert = CSize(200, 200);
- m_szFloat = CSize(200, 200);
- m_bTracking = FALSE;
- m_bKeepSize = FALSE;
- m_bParentSizing = FALSE;
- m_cxEdge = 5;
- m_bDragShowContent = FALSE;
- m_nDockBarID = 0;
- m_dwSCBStyle = 0;
- }
- CSizingControlBar::~CSizingControlBar()
- {
- }
- BEGIN_MESSAGE_MAP(CSizingControlBar, baseCSizingControlBar)
-
- ON_WM_CREATE()
- ON_WM_PAINT()
- ON_WM_NCPAINT()
- ON_WM_NCCALCSIZE()
- ON_WM_WINDOWPOSCHANGING()
- ON_WM_CAPTURECHANGED()
- ON_WM_SETTINGCHANGE()
- ON_WM_LBUTTONUP()
- ON_WM_MOUSEMOVE()
- ON_WM_NCLBUTTONDOWN()
- ON_WM_LBUTTONDOWN()
- ON_WM_LBUTTONDBLCLK()
- ON_WM_RBUTTONDOWN()
- ON_WM_NCMOUSEMOVE()
- ON_WM_NCHITTEST()
- ON_WM_CLOSE()
- ON_WM_SIZE()
-
- ON_MESSAGE(WM_SETTEXT, OnSetText)
- END_MESSAGE_MAP()
- BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName, CWnd* pParentWnd,
- CSize sizeDefault, BOOL bHasGripper,
- UINT nID, DWORD dwStyle)
- {
- UNUSED_ALWAYS(bHasGripper);
- m_szHorz = m_szVert = m_szFloat = sizeDefault;
- return Create(lpszWindowName, pParentWnd, nID, dwStyle);
- }
- BOOL CSizingControlBar::Create(LPCTSTR lpszWindowName,
- CWnd* pParentWnd, UINT nID,
- DWORD dwStyle)
- {
-
- ASSERT_VALID(pParentWnd);
-
-
- ASSERT (!((dwStyle & CBRS_SIZE_FIXED) &&
- (dwStyle & CBRS_SIZE_DYNAMIC)));
- m_dwStyle = dwStyle & CBRS_ALL;
-
- CString wndclass = ::AfxRegisterWndClass(CS_DBLCLKS,
- ::LoadCursor(NULL, IDC_ARROW),
- ::GetSysColorBrush(COLOR_BTNFACE), 0);
- dwStyle &= ~CBRS_ALL;
- dwStyle |= WS_CLIPCHILDREN;
- if (!CWnd::Create(wndclass, lpszWindowName, dwStyle,
- CRect(0, 0, 0, 0), pParentWnd, nID))
- return FALSE;
- return TRUE;
- }
- #if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
- void CSizingControlBar::EnableDocking(DWORD dwDockStyle)
- {
-
- ASSERT((dwDockStyle & ~(CBRS_ALIGN_ANY|CBRS_FLOAT_MULTI)) == 0);
-
- ASSERT((dwDockStyle & CBRS_FLOAT_MULTI) == 0);
-
- ASSERT((m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
- m_dwDockStyle = dwDockStyle;
- if (m_pDockContext == NULL)
- m_pDockContext = new CSCBDockContext(this);
-
- if (m_hWndOwner == NULL)
- m_hWndOwner = ::GetParent(m_hWnd);
- }
- #endif
- int CSizingControlBar::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (baseCSizingControlBar::OnCreate(lpCreateStruct) == -1)
- return -1;
-
-
- m_bDragShowContent = FALSE;
-
-
-
-
- return 0;
- }
- LRESULT CSizingControlBar::OnSetText(WPARAM wParam, LPARAM lParam)
- {
- UNUSED_ALWAYS(wParam);
- LRESULT lResult = CWnd::Default();
- if (IsFloating() &&
- GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)))
- {
- m_pDockBar->SetWindowText((LPCTSTR) lParam);
- GetParentFrame()->DelayRecalcLayout();
- }
- return lResult;
- }
- const BOOL CSizingControlBar::IsFloating() const
- {
- return !IsHorzDocked() && !IsVertDocked();
- }
- const BOOL CSizingControlBar::IsHorzDocked() const
- {
- return (m_nDockBarID == AFX_IDW_DOCKBAR_TOP ||
- m_nDockBarID == AFX_IDW_DOCKBAR_BOTTOM);
- }
- const BOOL CSizingControlBar::IsVertDocked() const
- {
- return (m_nDockBarID == AFX_IDW_DOCKBAR_LEFT ||
- m_nDockBarID == AFX_IDW_DOCKBAR_RIGHT);
- }
- const BOOL CSizingControlBar::IsSideTracking() const
- {
-
- ASSERT(m_bTracking && !IsFloating());
- return (m_htEdge == HTLEFT || m_htEdge == HTRIGHT) ?
- IsHorzDocked() : IsVertDocked();
- }
- CSize CSizingControlBar::CalcFixedLayout(BOOL bStretch, BOOL bHorz)
- {
- if (bStretch)
- if (bHorz)
- return CSize(32767, m_szHorz.cy);
- else
- return CSize(m_szVert.cx, 32767);
-
- CSCBDockBar* pDockBar = (CSCBDockBar*) m_pDockBar;
-
-
- CSCBArray arrSCBars;
- GetRowSizingBars(arrSCBars);
- AFX_SIZEPARENTPARAMS layout;
- layout.hDWP = pDockBar->m_bLayoutQuery ?
- NULL : ::BeginDeferWindowPos(arrSCBars.GetSize());
- for (int i = 0; i < arrSCBars.GetSize(); i++)
- if (arrSCBars[i]->m_nStateFlags & (delayHide|delayShow))
- arrSCBars[i]->RecalcDelayShow(&layout);
- if (layout.hDWP != NULL)
- ::EndDeferWindowPos(layout.hDWP);
-
- CRect rc = pDockBar->m_rectLayout;
- if (rc.IsRectEmpty())
- m_pDockSite->GetClientRect(&rc);
- int nLengthTotal = bHorz ? rc.Width() + 2 : rc.Height() - 2;
- if (IsVisible() && !IsFloating() &&
- m_bParentSizing && arrSCBars[0] == this)
- if (NegotiateSpace(nLengthTotal, (bHorz != FALSE)))
- AlignControlBars();
- m_bParentSizing = FALSE;
- if (bHorz)
- return CSize(max(m_szMinHorz.cx, m_szHorz.cx),
- max(m_szMinHorz.cy, m_szHorz.cy));
- return CSize(max(m_szMinVert.cx, m_szVert.cx),
- max(m_szMinVert.cy, m_szVert.cy));
- }
- CSize CSizingControlBar::CalcDynamicLayout(int nLength, DWORD dwMode)
- {
- if (dwMode & (LM_HORZDOCK | LM_VERTDOCK))
- {
- if (nLength == -1)
- m_bParentSizing = TRUE;
- return baseCSizingControlBar::CalcDynamicLayout(nLength, dwMode);
- }
- if (dwMode & LM_MRUWIDTH) return m_szFloat;
- if (dwMode & LM_COMMIT) return m_szFloat;
- #ifndef _SCB_REPLACE_MINIFRAME
-
- int nHitTest = m_pDockContext->m_nHitTest;
- if (IsFloating() &&
- (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT ||
- nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT))
- {
- CPoint ptCursor;
- ::GetCursorPos(&ptCursor);
- CRect rFrame, rBar;
- GetParentFrame()->GetWindowRect(&rFrame);
- GetWindowRect(&rBar);
-
- if (nHitTest == HTTOPLEFT || nHitTest == HTBOTTOMLEFT)
- {
- m_szFloat.cx = rFrame.left + rBar.Width() - ptCursor.x;
- m_pDockContext->m_rectFrameDragHorz.left =
- min(ptCursor.x, rFrame.left + rBar.Width() - m_szMinFloat.cx);
- }
- if (nHitTest == HTTOPLEFT || nHitTest == HTTOPRIGHT)
- {
- m_szFloat.cy = rFrame.top + rBar.Height() - ptCursor.y;
- m_pDockContext->m_rectFrameDragHorz.top =
- min(ptCursor.y, rFrame.top + rBar.Height() - m_szMinFloat.cy);
- }
- if (nHitTest == HTTOPRIGHT || nHitTest == HTBOTTOMRIGHT)
- m_szFloat.cx = rBar.Width() + ptCursor.x - rFrame.right;
- if (nHitTest == HTBOTTOMLEFT || nHitTest == HTBOTTOMRIGHT)
- m_szFloat.cy = rBar.Height() + ptCursor.y - rFrame.bottom;
- }
- else
- #endif
- ((dwMode & LM_LENGTHY) ? m_szFloat.cy : m_szFloat.cx) = nLength;
- m_szFloat.cx = max(m_szFloat.cx, m_szMinFloat.cx);
- m_szFloat.cy = max(m_szFloat.cy, m_szMinFloat.cy);
- return m_szFloat;
- }
- void CSizingControlBar::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
- {
-
- lpwndpos->flags |= SWP_FRAMECHANGED;
- baseCSizingControlBar::OnWindowPosChanging(lpwndpos);
-
- m_nDockBarID = GetParent()->GetDlgCtrlID();
- if (!IsFloating())
- if (lpwndpos->flags & SWP_SHOWWINDOW)
- m_bKeepSize = TRUE;
- }
- void CSizingControlBar::OnLButtonDown(UINT nFlags, CPoint point)
- {
- if (m_pDockBar != NULL)
- {
-
- ASSERT(m_pDockContext != NULL);
- ClientToScreen(&point);
- m_pDockContext->StartDrag(point);
- }
- else
- CWnd::OnLButtonDown(nFlags, point);
- }
- void CSizingControlBar::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- if (m_pDockBar != NULL)
- {
-
- ASSERT(m_pDockContext != NULL);
- m_pDockContext->ToggleDocking();
- }
- else
- CWnd::OnLButtonDblClk(nFlags, point);
- }
- void CSizingControlBar::OnNcLButtonDown(UINT nHitTest, CPoint point)
- {
- UNUSED_ALWAYS(point);
- if (m_bTracking || IsFloating())
- return;
- if ((nHitTest >= HTSIZEFIRST) && (nHitTest <= HTSIZELAST))
- StartTracking(nHitTest, point);
- }
- void CSizingControlBar::OnLButtonUp(UINT nFlags, CPoint point)
- {
- if (m_bTracking)
- StopTracking();
- baseCSizingControlBar::OnLButtonUp(nFlags, point);
- }
- void CSizingControlBar::OnRButtonDown(UINT nFlags, CPoint point)
- {
- if (m_bTracking)
- StopTracking();
- baseCSizingControlBar::OnRButtonDown(nFlags, point);
- }
- void CSizingControlBar::OnMouseMove(UINT nFlags, CPoint point)
- {
- if (m_bTracking)
- {
- CPoint ptScreen = point;
- ClientToScreen(&ptScreen);
- OnTrackUpdateSize(ptScreen);
- }
- baseCSizingControlBar::OnMouseMove(nFlags, point);
- }
- void CSizingControlBar::OnCaptureChanged(CWnd *pWnd)
- {
- if (m_bTracking && (pWnd != this))
- StopTracking();
- baseCSizingControlBar::OnCaptureChanged(pWnd);
- }
- void CSizingControlBar::OnNcCalcSize(BOOL bCalcValidRects,
- NCCALCSIZE_PARAMS FAR* lpncsp)
- {
- UNUSED_ALWAYS(bCalcValidRects);
- #ifndef _SCB_REPLACE_MINIFRAME
-
- if (IsFloating())
- {
- CFrameWnd* pFrame = GetParentFrame();
- if (pFrame != NULL &&
- pFrame->IsKindOf(RUNTIME_CLASS(CMiniFrameWnd)))
- {
- DWORD dwStyle = ::GetWindowLong(pFrame->m_hWnd, GWL_STYLE);
- if ((dwStyle & MFS_4THICKFRAME) != 0)
- {
- pFrame->ModifyStyle(MFS_4THICKFRAME, 0);
- GetParent()->ModifyStyle(0, WS_CLIPCHILDREN);
- }
- }
- }
- #endif _SCB_REPLACE_MINIFRAME
-
- m_dwSCBStyle &= ~SCBS_EDGEALL;
-
- if (!IsFloating() && m_pDockBar != NULL)
- {
- CSCBArray arrSCBars;
- int nThis;
- GetRowSizingBars(arrSCBars, nThis);
- BOOL bHorz = IsHorzDocked();
- if (nThis > 0)
- m_dwSCBStyle |= bHorz ? SCBS_EDGELEFT : SCBS_EDGETOP;
- if (nThis < arrSCBars.GetUpperBound())
- m_dwSCBStyle |= bHorz ? SCBS_EDGERIGHT : SCBS_EDGEBOTTOM;
- }
- NcCalcClient(&lpncsp->rgrc[0], m_nDockBarID);
- }
- void CSizingControlBar::NcCalcClient(LPRECT pRc, UINT nDockBarID)
- {
- CRect rc(pRc);
- rc.DeflateRect(0, 3, 1, 1);
- if (nDockBarID != AFX_IDW_DOCKBAR_FLOAT)
- rc.DeflateRect(2, 0, 2, 2);
- switch(nDockBarID)
- {
- case AFX_IDW_DOCKBAR_TOP:
- m_dwSCBStyle |= SCBS_EDGEBOTTOM;
- break;
- case AFX_IDW_DOCKBAR_BOTTOM:
- m_dwSCBStyle |= SCBS_EDGETOP;
- break;
- case AFX_IDW_DOCKBAR_LEFT:
- m_dwSCBStyle |= SCBS_EDGERIGHT;
- break;
- case AFX_IDW_DOCKBAR_RIGHT:
- m_dwSCBStyle |= SCBS_EDGELEFT;
- break;
- }
-
- if (m_dwSCBStyle & SCBS_SHOWEDGES)
- rc.DeflateRect(
- (m_dwSCBStyle & SCBS_EDGELEFT) ? m_cxEdge : 0,
- (m_dwSCBStyle & SCBS_EDGETOP) ? m_cxEdge : 0,
- (m_dwSCBStyle & SCBS_EDGERIGHT) ? m_cxEdge : 0,
- (m_dwSCBStyle & SCBS_EDGEBOTTOM) ? m_cxEdge : 0);
- *pRc = rc;
- }
- void CSizingControlBar::OnNcPaint()
- {
-
- CWindowDC dc(this);
- CRect rcClient, rcBar;
- GetClientRect(rcClient);
- ClientToScreen(rcClient);
- GetWindowRect(rcBar);
- rcClient.OffsetRect(-rcBar.TopLeft());
- rcBar.OffsetRect(-rcBar.TopLeft());
- CDC mdc;
- mdc.CreateCompatibleDC(&dc);
-
- CBitmap bm;
- bm.CreateCompatibleBitmap(&dc, rcBar.Width(), rcBar.Height());
- CBitmap* pOldBm = mdc.SelectObject(&bm);
-
- CRect rcDraw = rcBar;
- DrawBorders(&mdc, rcDraw);
-
- mdc.FillRect(rcDraw, CBrush::FromHandle(
- (HBRUSH) GetClassLong(m_hWnd, GCL_HBRBACKGROUND)));
- if (m_dwSCBStyle & SCBS_SHOWEDGES)
- {
- CRect rcEdge;
- for (int i = 0; i < 4; i++)
- if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
- mdc.Draw3dRect(rcEdge, ::GetSysColor(COLOR_BTNHIGHLIGHT),
- ::GetSysColor(COLOR_BTNSHADOW));
- }
- NcPaintGripper(&mdc, rcClient);
-
- dc.IntersectClipRect(rcBar);
- dc.ExcludeClipRect(rcClient);
- dc.BitBlt(0, 0, rcBar.Width(), rcBar.Height(), &mdc, 0, 0, SRCCOPY);
- ReleaseDC(&dc);
- mdc.SelectObject(pOldBm);
- bm.DeleteObject();
- mdc.DeleteDC();
- }
- void CSizingControlBar::NcPaintGripper(CDC* pDC, CRect rcClient)
- {
- UNUSED_ALWAYS(pDC);
- UNUSED_ALWAYS(rcClient);
- }
- void CSizingControlBar::OnPaint()
- {
-
- CPaintDC dc(this);
- }
- LRESULT CSizingControlBar::OnNcHitTest(CPoint point)
- {
- CRect rcBar, rcEdge;
- GetWindowRect(rcBar);
- if (!IsFloating())
- for (int i = 0; i < 4; i++)
- if (GetEdgeRect(rcBar, GetEdgeHTCode(i), rcEdge))
- if (rcEdge.PtInRect(point))
- return GetEdgeHTCode(i);
- return HTCLIENT;
- }
- void CSizingControlBar::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
- {
- baseCSizingControlBar::OnSettingChange(uFlags, lpszSection);
- m_bDragShowContent = FALSE;
-
-
- }
- void CSizingControlBar::OnSize(UINT nType, int cx, int cy)
- {
- UNUSED_ALWAYS(nType);
-
- if ((m_dwSCBStyle & SCBS_SIZECHILD) != 0)
- {
-
- CWnd* pWnd = GetWindow(GW_CHILD);
- if (pWnd != NULL)
- {
- pWnd->MoveWindow(0, 0, cx, cy);
- ASSERT(pWnd->GetWindow(GW_HWNDNEXT) == NULL);
- }
- }
- }
- void CSizingControlBar::OnClose()
- {
-
-
- }
- void CSizingControlBar::StartTracking(UINT nHitTest, CPoint point)
- {
- SetCapture();
-
- if (!m_bDragShowContent)
- RedrawWindow(NULL, NULL, RDW_ALLCHILDREN | RDW_UPDATENOW);
- m_htEdge = nHitTest;
- m_bTracking = TRUE;
- BOOL bHorz = IsHorzDocked();
- BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
- m_nTrackPosOld = bHorzTracking ? point.x : point.y;
- CRect rcBar, rcEdge;
- GetWindowRect(rcBar);
- GetEdgeRect(rcBar, m_htEdge, rcEdge);
- m_nTrackEdgeOfs = m_nTrackPosOld -
- (bHorzTracking ? rcEdge.CenterPoint().x : rcEdge.CenterPoint().y);
-
- CSCBArray arrSCBars;
- int nThis;
- GetRowSizingBars(arrSCBars, nThis);
- m_nTrackPosMin = m_nTrackPosMax = m_nTrackPosOld;
- if (!IsSideTracking())
- {
-
- int nMinWidth = bHorz ? m_szMinHorz.cy : m_szMinVert.cx;
- for (int i = 0; i < arrSCBars.GetSize(); i++)
- nMinWidth = max(nMinWidth, bHorz ?
- arrSCBars[i]->m_szMinHorz.cy :
- arrSCBars[i]->m_szMinVert.cx);
- int nExcessWidth = (bHorz ? m_szHorz.cy : m_szVert.cx) - nMinWidth;
-
-
- CRect rcT;
- m_pDockSite->RepositionBars(0, 0xFFFF, AFX_IDW_PANE_FIRST,
- reposQuery, &rcT, NULL, TRUE);
- int nMaxWidth = bHorz ? rcT.Height() - 2 : rcT.Width() - 2;
- BOOL bTopOrLeft = m_htEdge == HTTOP || m_htEdge == HTLEFT;
- m_nTrackPosMin -= bTopOrLeft ? nMaxWidth : nExcessWidth;
- m_nTrackPosMax += bTopOrLeft ? nExcessWidth : nMaxWidth;
- }
- else
- {
-
-
-
- if (m_htEdge == HTBOTTOM || m_htEdge == HTRIGHT)
- nThis++;
- for (int i = 0; i < arrSCBars.GetSize(); i++)
- {
- CSizingControlBar* pBar = arrSCBars[i];
- int nExcessWidth = bHorz ?
- pBar->m_szHorz.cx - pBar->m_szMinHorz.cx :
- pBar->m_szVert.cy - pBar->m_szMinVert.cy;
- if (i < nThis)
- m_nTrackPosMin -= nExcessWidth;
- else
- m_nTrackPosMax += nExcessWidth;
- }
- }
- OnTrackInvertTracker();
- }
- void CSizingControlBar::StopTracking()
- {
- OnTrackInvertTracker();
- m_bTracking = FALSE;
- ReleaseCapture();
- m_pDockSite->DelayRecalcLayout();
- }
- void CSizingControlBar::OnTrackUpdateSize(CPoint& point)
- {
- ASSERT(!IsFloating());
- BOOL bHorzTrack = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
- int nTrackPos = bHorzTrack ? point.x : point.y;
- nTrackPos = max(m_nTrackPosMin, min(m_nTrackPosMax, nTrackPos));
- int nDelta = nTrackPos - m_nTrackPosOld;
- if (nDelta == 0)
- return;
- OnTrackInvertTracker();
- m_nTrackPosOld = nTrackPos;
-
- BOOL bHorz = IsHorzDocked();
- CSize sizeNew = bHorz ? m_szHorz : m_szVert;
- switch (m_htEdge)
- {
- case HTLEFT: sizeNew -= CSize(nDelta, 0); break;
- case HTTOP: sizeNew -= CSize(0, nDelta); break;
- case HTRIGHT: sizeNew += CSize(nDelta, 0); break;
- case HTBOTTOM: sizeNew += CSize(0, nDelta); break;
- }
- CSCBArray arrSCBars;
- int nThis;
- GetRowSizingBars(arrSCBars, nThis);
- if (!IsSideTracking())
- for (int i = 0; i < arrSCBars.GetSize(); i++)
- {
- CSizingControlBar* pBar = arrSCBars[i];
-
- (bHorz ? pBar->m_szHorz.cy : pBar->m_szVert.cx) =
- bHorz ? sizeNew.cy : sizeNew.cx;
- }
- else
- {
- int nGrowingBar = nThis;
- BOOL bBefore = m_htEdge == HTTOP || m_htEdge == HTLEFT;
- if (bBefore && nDelta > 0)
- nGrowingBar--;
- if (!bBefore && nDelta < 0)
- nGrowingBar++;
- if (nGrowingBar != nThis)
- bBefore = !bBefore;
-
- nDelta = abs(nDelta);
- CSizingControlBar* pBar = arrSCBars[nGrowingBar];
- (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) += nDelta;
-
- int nFirst = bBefore ? nGrowingBar - 1 : nGrowingBar + 1;
- int nLimit = bBefore ? -1 : arrSCBars.GetSize();
- for (int i = nFirst; nDelta != 0 && i != nLimit; i += (bBefore ? -1 : 1))
- {
- CSizingControlBar* pBar = arrSCBars[i];
-
- int nDeltaT = min(nDelta,
- (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -
- (bHorz ? pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy));
- (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) -= nDeltaT;
- nDelta -= nDeltaT;
- }
- }
- OnTrackInvertTracker();
- if (m_bDragShowContent)
- m_pDockSite->DelayRecalcLayout();
- }
- void CSizingControlBar::OnTrackInvertTracker()
- {
- ASSERT(m_bTracking);
- if (m_bDragShowContent)
- return;
- BOOL bHorz = IsHorzDocked();
- CRect rc, rcBar, rcDock, rcFrame;
- GetWindowRect(rcBar);
- m_pDockBar->GetWindowRect(rcDock);
- m_pDockSite->GetWindowRect(rcFrame);
- VERIFY(GetEdgeRect(rcBar, m_htEdge, rc));
- if (!IsSideTracking())
- rc = bHorz ?
- CRect(rcDock.left + 1, rc.top, rcDock.right - 1, rc.bottom) :
- CRect(rc.left, rcDock.top + 1, rc.right, rcDock.bottom - 1);
- BOOL bHorzTracking = m_htEdge == HTLEFT || m_htEdge == HTRIGHT;
- int nOfs = m_nTrackPosOld - m_nTrackEdgeOfs;
- nOfs -= bHorzTracking ? rc.CenterPoint().x : rc.CenterPoint().y;
- rc.OffsetRect(bHorzTracking ? nOfs : 0, bHorzTracking ? 0 : nOfs);
- rc.OffsetRect(-rcFrame.TopLeft());
- CDC *pDC = m_pDockSite->GetDCEx(NULL,
- DCX_WINDOW | DCX_CACHE | DCX_LOCKWINDOWUPDATE);
- CBrush* pBrush = CDC::GetHalftoneBrush();
- CBrush* pBrushOld = pDC->SelectObject(pBrush);
- pDC->PatBlt(rc.left, rc.top, rc.Width(), rc.Height(), PATINVERT);
-
- pDC->SelectObject(pBrushOld);
- m_pDockSite->ReleaseDC(pDC);
- }
- BOOL CSizingControlBar::GetEdgeRect(CRect rcWnd, UINT nHitTest,
- CRect& rcEdge)
- {
- rcEdge = rcWnd;
- if (m_dwSCBStyle & SCBS_SHOWEDGES)
- rcEdge.DeflateRect(1, 1);
- BOOL bHorz = IsHorzDocked();
- switch (nHitTest)
- {
- case HTLEFT:
- if (!(m_dwSCBStyle & SCBS_EDGELEFT)) return FALSE;
- rcEdge.right = rcEdge.left + m_cxEdge;
- rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
- break;
- case HTTOP:
- if (!(m_dwSCBStyle & SCBS_EDGETOP)) return FALSE;
- rcEdge.bottom = rcEdge.top + m_cxEdge;
- rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
- break;
- case HTRIGHT:
- if (!(m_dwSCBStyle & SCBS_EDGERIGHT)) return FALSE;
- rcEdge.left = rcEdge.right - m_cxEdge;
- rcEdge.DeflateRect(0, bHorz ? m_cxEdge: 0);
- break;
- case HTBOTTOM:
- if (!(m_dwSCBStyle & SCBS_EDGEBOTTOM)) return FALSE;
- rcEdge.top = rcEdge.bottom - m_cxEdge;
- rcEdge.DeflateRect(bHorz ? 0 : m_cxEdge, 0);
- break;
- default:
- ASSERT(FALSE);
- }
- return TRUE;
- }
- UINT CSizingControlBar::GetEdgeHTCode(int nEdge)
- {
- if (nEdge == 0) return HTLEFT;
- if (nEdge == 1) return HTTOP;
- if (nEdge == 2) return HTRIGHT;
- if (nEdge == 3) return HTBOTTOM;
- ASSERT(FALSE);
- return HTNOWHERE;
- }
- void CSizingControlBar::GetRowInfo(int& nFirst, int& nLast, int& nThis)
- {
- ASSERT_VALID(m_pDockBar);
- nThis = m_pDockBar->FindBar(this);
- ASSERT(nThis != -1);
- int i, nBars = m_pDockBar->m_arrBars.GetSize();
-
- for (nFirst = -1, i = nThis - 1; i >= 0 && nFirst == -1; i--)
- if (m_pDockBar->m_arrBars[i] == NULL)
- nFirst = i + 1;
- for (nLast = -1, i = nThis + 1; i < nBars && nLast == -1; i++)
- if (m_pDockBar->m_arrBars[i] == NULL)
- nLast = i - 1;
- ASSERT((nLast != -1) && (nFirst != -1));
- }
- void CSizingControlBar::GetRowSizingBars(CSCBArray& arrSCBars)
- {
- int nThis;
- GetRowSizingBars(arrSCBars, nThis);
- }
- void CSizingControlBar::GetRowSizingBars(CSCBArray& arrSCBars, int& nThis)
- {
- arrSCBars.RemoveAll();
- int nFirstT, nLastT, nThisT;
- GetRowInfo(nFirstT, nLastT, nThisT);
- nThis = -1;
- for (int i = nFirstT; i <= nLastT; i++)
- {
- CSizingControlBar* pBar =
- (CSizingControlBar*) m_pDockBar->m_arrBars[i];
- if (HIWORD(pBar) == 0) continue;
- if (!pBar->IsVisible()) continue;
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
- {
- if (pBar == this)
- nThis = arrSCBars.GetSize();
- arrSCBars.Add(pBar);
- }
- }
- }
- BOOL CSizingControlBar::NegotiateSpace(int nLengthTotal, BOOL bHorz)
- {
- ASSERT(bHorz == IsHorzDocked());
- int nFirst, nLast, nThis;
- GetRowInfo(nFirst, nLast, nThis);
- int nLengthAvail = nLengthTotal;
- int nLengthActual = 0;
- int nLengthMin = 2;
- int nWidthMax = 0;
- CSizingControlBar* pBar;
- for (int i = nFirst; i <= nLast; i++)
- {
- pBar = (CSizingControlBar*) m_pDockBar->m_arrBars[i];
- if (HIWORD(pBar) == 0) continue;
- if (!pBar->IsVisible()) continue;
- BOOL bIsSizingBar =
- pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar));
- int nLengthBar;
- if (bIsSizingBar)
- nLengthBar = bHorz ? pBar->m_szMinHorz.cx - 2 :
- pBar->m_szMinVert.cy - 2;
- else
- {
- CRect rcBar;
- pBar->GetWindowRect(&rcBar);
- nLengthBar = bHorz ? rcBar.Width() - 2 : rcBar.Height() - 2;
- }
- nLengthMin += nLengthBar;
- if (nLengthMin > nLengthTotal)
- {
-
- if (i < nThis)
- {
- m_pDockBar->m_arrBars.InsertAt(i + 1,
- (CControlBar*) NULL);
- return FALSE;
- }
-
-
- if (i == nThis)
- {
- if (bHorz)
- m_szHorz.cx = m_szMinHorz.cx;
- else
- m_szVert.cy = m_szMinVert.cy;
- return TRUE;
- }
-
- m_pDockBar->m_arrBars.InsertAt(i, (CControlBar*) NULL);
- nLast = i - 1;
- break;
- }
- if (bIsSizingBar)
- {
-
- nLengthActual += bHorz ? pBar->m_szHorz.cx :
- pBar->m_szVert.cy ;
- nWidthMax = max(nWidthMax, bHorz ? pBar->m_szHorz.cy :
- pBar->m_szVert.cx);
- }
- else
- nLengthAvail -= nLengthBar;
- }
- CSCBArray arrSCBars;
- GetRowSizingBars(arrSCBars);
- int nNumBars = arrSCBars.GetSize();
- int nDelta = nLengthAvail - nLengthActual;
-
- if (nNumBars == 1)
- {
- ASSERT(arrSCBars[0] == this);
- if (nDelta == 0)
- return TRUE;
-
- m_bKeepSize = FALSE;
- (bHorz ? m_szHorz.cx : m_szVert.cy) += nDelta;
- return TRUE;
- }
-
- for (int i = 0; i < nNumBars; i++)
- if (bHorz)
- arrSCBars[i]->m_szHorz.cy = nWidthMax;
- else
- arrSCBars[i]->m_szVert.cx = nWidthMax;
-
-
- while (nDelta != 0)
- {
- int nDeltaOld = nDelta;
- for (int i = 0; i < nNumBars; i++)
- {
- pBar = arrSCBars[i];
- int nLMin = bHorz ?
- pBar->m_szMinHorz.cx : pBar->m_szMinVert.cy;
- int nL = bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy;
- if ((nL == nLMin) && (nDelta < 0) ||
- pBar->m_bKeepSize)
- continue;
-
- int nDelta2 = (nDelta == 0) ? 0 : ((nDelta < 0) ? -1 : 1);
- (bHorz ? pBar->m_szHorz.cx : pBar->m_szVert.cy) += nDelta2;
- nDelta -= nDelta2;
- if (nDelta == 0) break;
- }
-
- if ((nDeltaOld == nDelta) || (nDelta == 0))
- for (int i = 0; i < nNumBars; i++)
- arrSCBars[i]->m_bKeepSize = FALSE;
- }
- return TRUE;
- }
- void CSizingControlBar::AlignControlBars()
- {
- int nFirst, nLast, nThis;
- GetRowInfo(nFirst, nLast, nThis);
- BOOL bHorz = IsHorzDocked();
- BOOL bNeedRecalc = FALSE;
- int nAlign = 0;
- CRect rc, rcDock;
- m_pDockBar->GetWindowRect(&rcDock);
- for (int i = nFirst; i <= nLast; i++)
- {
- CSizingControlBar* pBar =
- (CSizingControlBar*) m_pDockBar->m_arrBars[i];
- if (HIWORD(pBar) == 0) continue;
- if (!pBar->IsVisible()) continue;
- pBar->GetWindowRect(&rc);
- rc.OffsetRect(-rcDock.TopLeft());
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
- rc = CRect(rc.TopLeft(),
- bHorz ? pBar->m_szHorz : pBar->m_szVert);
- if ((bHorz ? rc.left : rc.top) != nAlign)
- {
- if (!bHorz)
- rc.OffsetRect(0, nAlign - rc.top - 2);
- else if (m_nDockBarID == AFX_IDW_DOCKBAR_TOP)
- rc.OffsetRect(nAlign - rc.left, -2);
- else
- rc.OffsetRect(nAlign - rc.left, 0);
- if(!m_bTracking)
- pBar->MoveWindow(rc);
- bNeedRecalc = TRUE;
- }
- nAlign += (bHorz ? rc.Width() : rc.Height()) - 2;
- }
- if (bNeedRecalc)
- m_pDockSite->DelayRecalcLayout();
- }
- void CSizingControlBar::OnUpdateCmdUI(CFrameWnd* pTarget,
- BOOL bDisableIfNoHndler)
- {
- UNUSED_ALWAYS(bDisableIfNoHndler);
- UNUSED_ALWAYS(pTarget);
- }
- void CSizingControlBar::LoadState(LPCTSTR lpszProfileName)
- {
- ASSERT_VALID(this);
- ASSERT(GetSafeHwnd());
- #if defined(_SCB_REPLACE_MINIFRAME) && !defined(_SCB_MINIFRAME_CAPTION)
-
- CDockState state;
- state.LoadState(lpszProfileName);
- UINT nID = GetDlgCtrlID();
- for (int i = 0; i < state.m_arrBarInfo.GetSize(); i++)
- {
- CControlBarInfo* pInfo = (CControlBarInfo*)state.m_arrBarInfo[i];
- ASSERT(pInfo != NULL);
- if (!pInfo->m_bFloating)
- continue;
-
-
- for (int j = 0; j < pInfo->m_arrBarID.GetSize(); j++)
- if ((DWORD) pInfo->m_arrBarID[j] == nID)
- {
-
- pInfo->m_pointPos.x++;
- pInfo->m_pointPos.y +=
- ::GetSystemMetrics(SM_CYSMCAPTION) + 1;
- pInfo->SaveState(lpszProfileName, i);
- }
- }
- #endif
- CWinApp* pApp = AfxGetApp();
- TCHAR szSection[256];
- wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
- GetDlgCtrlID());
- m_szHorz.cx = max(m_szMinHorz.cx, (int) pApp->GetProfileInt(
- szSection, _T("sizeHorzCX"), m_szHorz.cx));
- m_szHorz.cy = max(m_szMinHorz.cy, (int) pApp->GetProfileInt(
- szSection, _T("sizeHorzCY"), m_szHorz.cy));
- m_szVert.cx = max(m_szMinVert.cx, (int) pApp->GetProfileInt(
- szSection, _T("sizeVertCX"), m_szVert.cx));
- m_szVert.cy = max(m_szMinVert.cy, (int) pApp->GetProfileInt(
- szSection, _T("sizeVertCY"), m_szVert.cy));
- m_szFloat.cx = max(m_szMinFloat.cx, (int) pApp->GetProfileInt(
- szSection, _T("sizeFloatCX"), m_szFloat.cx));
- m_szFloat.cy = max(m_szMinFloat.cy, (int) pApp->GetProfileInt(
- szSection, _T("sizeFloatCY"), m_szFloat.cy));
- }
- void CSizingControlBar::SaveState(LPCTSTR lpszProfileName)
- {
-
-
- ASSERT_VALID(this);
- ASSERT(GetSafeHwnd());
- CWinApp* pApp = AfxGetApp();
- TCHAR szSection[256];
- wsprintf(szSection, _T("%s-SCBar-%d"), lpszProfileName,
- GetDlgCtrlID());
- pApp->WriteProfileInt(szSection, _T("sizeHorzCX"), m_szHorz.cx);
- pApp->WriteProfileInt(szSection, _T("sizeHorzCY"), m_szHorz.cy);
- pApp->WriteProfileInt(szSection, _T("sizeVertCX"), m_szVert.cx);
- pApp->WriteProfileInt(szSection, _T("sizeVertCY"), m_szVert.cy);
- pApp->WriteProfileInt(szSection, _T("sizeFloatCX"), m_szFloat.cx);
- pApp->WriteProfileInt(szSection, _T("sizeFloatCY"), m_szFloat.cy);
- }
- void CSizingControlBar::GlobalLoadState(CFrameWnd* pFrame,
- LPCTSTR lpszProfileName)
- {
- POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- while (pos != NULL)
- {
- CSizingControlBar* pBar =
- (CSizingControlBar*) pFrame->m_listControlBars.GetNext(pos);
- ASSERT(pBar != NULL);
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
- pBar->LoadState(lpszProfileName);
- }
- }
- void CSizingControlBar::GlobalSaveState(CFrameWnd* pFrame,
- LPCTSTR lpszProfileName)
- {
- POSITION pos = pFrame->m_listControlBars.GetHeadPosition();
- while (pos != NULL)
- {
- CSizingControlBar* pBar =
- (CSizingControlBar*) pFrame->m_listControlBars.GetNext(pos);
- ASSERT(pBar != NULL);
- if (pBar->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
- pBar->SaveState(lpszProfileName);
- }
- }
- #ifdef _SCB_REPLACE_MINIFRAME
- #ifndef _SCB_MINIFRAME_CAPTION
- static void AdjustRectangle(CRect& rect, CPoint pt)
- {
- int nXOffset = (pt.x < rect.left) ? (pt.x - rect.left) :
- (pt.x > rect.right) ? (pt.x - rect.right) : 0;
- int nYOffset = (pt.y < rect.top) ? (pt.y - rect.top) :
- (pt.y > rect.bottom) ? (pt.y - rect.bottom) : 0;
- rect.OffsetRect(nXOffset, nYOffset);
- }
- void CSCBDockContext::StartDrag(CPoint pt)
- {
- ASSERT_VALID(m_pBar);
- m_bDragging = TRUE;
- InitLoop();
- ASSERT((m_pBar->m_dwStyle & CBRS_SIZE_DYNAMIC) != 0);
-
- CRect rect;
- m_pBar->GetWindowRect(rect);
- m_ptLast = pt;
- CSize sizeHorz = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_HORZDOCK);
- CSize sizeVert = m_pBar->CalcDynamicLayout(0, LM_VERTDOCK);
- CSize sizeFloat = m_pBar->CalcDynamicLayout(0, LM_HORZ | LM_MRUWIDTH);
- m_rectDragHorz = CRect(rect.TopLeft(), sizeHorz);
- m_rectDragVert = CRect(rect.TopLeft(), sizeVert);
-
- m_rectFrameDragHorz = CRect(rect.TopLeft(), sizeFloat);
- #ifdef _MAC
- CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz,
- WS_THICKFRAME, WS_EX_FORCESIZEBOX);
- #else
- CMiniFrameWnd::CalcBorders(&m_rectFrameDragHorz, WS_THICKFRAME);
- #endif
- m_rectFrameDragHorz.DeflateRect(2, 2);
- m_rectFrameDragVert = m_rectFrameDragHorz;
-
-
- AdjustRectangle(m_rectDragHorz, pt);
- AdjustRectangle(m_rectDragVert, pt);
- AdjustRectangle(m_rectFrameDragHorz, pt);
- AdjustRectangle(m_rectFrameDragVert, pt);
-
- m_dwOverDockStyle = CanDock();
- Move(pt);
- Track();
- }
- #endif
- IMPLEMENT_DYNCREATE(CSCBMiniDockFrameWnd, baseCSCBMiniDockFrameWnd);
- BEGIN_MESSAGE_MAP(CSCBMiniDockFrameWnd, baseCSCBMiniDockFrameWnd)
-
- ON_WM_NCLBUTTONDOWN()
- ON_WM_GETMINMAXINFO()
- ON_WM_WINDOWPOSCHANGING()
- ON_WM_SIZE()
-
- END_MESSAGE_MAP()
- BOOL CSCBMiniDockFrameWnd::Create(CWnd* pParent, DWORD dwBarStyle)
- {
-
-
- m_bInRecalcLayout = TRUE;
- DWORD dwStyle = WS_POPUP|WS_CAPTION|WS_SYSMENU|MFS_MOVEFRAME|
- MFS_4THICKFRAME|MFS_SYNCACTIVE|MFS_BLOCKSYSMENU|
- FWS_SNAPTOBARS;
- if (dwBarStyle & CBRS_SIZE_DYNAMIC)
- dwStyle &= ~MFS_MOVEFRAME;
- DWORD dwExStyle = 0;
- #ifdef _MAC
- if (dwBarStyle & CBRS_SIZE_DYNAMIC)
- dwExStyle |= WS_EX_FORCESIZEBOX;
- else
- dwStyle &= ~(MFS_MOVEFRAME|MFS_4THICKFRAME);
- #endif
- if (!CMiniFrameWnd::CreateEx(dwExStyle,
- NULL, &afxChNil, dwStyle, rectDefault, pParent))
- {
- m_bInRecalcLayout = FALSE;
- return FALSE;
- }
- dwStyle = dwBarStyle & (CBRS_ALIGN_LEFT|CBRS_ALIGN_RIGHT) ?
- CBRS_ALIGN_LEFT : CBRS_ALIGN_TOP;
- dwStyle |= dwBarStyle & CBRS_FLOAT_MULTI;
- CMenu* pSysMenu = GetSystemMenu(FALSE);
-
- CString strHide;
- if (strHide.LoadString(AFX_IDS_HIDE))
- {
- pSysMenu->DeleteMenu(SC_CLOSE, MF_BYCOMMAND);
- pSysMenu->AppendMenu(MF_STRING|MF_ENABLED, SC_CLOSE, strHide);
- }
-
- if (!m_wndDockBar.Create(pParent, WS_CHILD | WS_VISIBLE | dwStyle,
- AFX_IDW_DOCKBAR_FLOAT))
- {
- m_bInRecalcLayout = FALSE;
- return FALSE;
- }
-
- m_wndDockBar.SetParent(this);
- m_bInRecalcLayout = FALSE;
- return TRUE;
- }
- void CSCBMiniDockFrameWnd::OnNcLButtonDown(UINT nHitTest, CPoint point)
- {
- if (nHitTest == HTCAPTION || nHitTest == HTCLOSE)
- {
- baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
- return;
- }
- if (GetSizingControlBar() != NULL)
- CMiniFrameWnd::OnNcLButtonDown(nHitTest, point);
- else
- baseCSCBMiniDockFrameWnd::OnNcLButtonDown(nHitTest, point);
- }
- CSizingControlBar* CSCBMiniDockFrameWnd::GetSizingControlBar()
- {
- CWnd* pWnd = GetWindow(GW_CHILD);
- if (pWnd == NULL)
- return NULL;
-
- pWnd = pWnd->GetWindow(GW_CHILD);
- if (pWnd == NULL)
- return NULL;
- if (!pWnd->IsKindOf(RUNTIME_CLASS(CSizingControlBar)))
- return NULL;
- return (CSizingControlBar*) pWnd;
- }
- void CSCBMiniDockFrameWnd::OnSize(UINT nType, int cx, int cy)
- {
- CSizingControlBar* pBar = GetSizingControlBar();
- if ((pBar != NULL) && (GetStyle() & MFS_4THICKFRAME) == 0
- && pBar->IsVisible())
- pBar->m_szFloat = CSize(cx + 4, cy + 4);
- baseCSCBMiniDockFrameWnd::OnSize(nType, cx, cy);
- }
- void CSCBMiniDockFrameWnd::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
- {
- baseCSCBMiniDockFrameWnd::OnGetMinMaxInfo(lpMMI);
- CSizingControlBar* pBar = GetSizingControlBar();
- if (pBar != NULL)
- {
- CRect r(CPoint(0, 0), pBar->m_szMinFloat - CSize(4, 4));
- #ifndef _SCB_MINIFRAME_CAPTION
- CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME);
- #else
- CMiniFrameWnd::CalcBorders(&r, WS_THICKFRAME|WS_CAPTION);
- #endif
- lpMMI->ptMinTrackSize.x = r.Width();
- lpMMI->ptMinTrackSize.y = r.Height();
- }
- }
- void CSCBMiniDockFrameWnd::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos)
- {
- if ((GetStyle() & MFS_4THICKFRAME) != 0)
- {
- CSizingControlBar* pBar = GetSizingControlBar();
- if (pBar != NULL)
- {
- lpwndpos->flags |= SWP_NOSIZE;
-
- pBar->m_pDockBar->ModifyStyle(0, WS_CLIPCHILDREN);
-
- ModifyStyle(MFS_4THICKFRAME, 0);
- #ifndef _SCB_MINIFRAME_CAPTION
-
- ModifyStyle(WS_SYSMENU|WS_CAPTION, 0);
- #endif
- DelayRecalcLayout();
- pBar->PostMessage(WM_NCPAINT);
- }
- }
- CMiniFrameWnd::OnWindowPosChanging(lpwndpos);
- }
- #endif
|