CRect CXTPDockingPaneSplitterContainer::_CalculateResultDockingRect(BOOL bHoriz, CXTPDockingPaneBaseList& lst, CRect rect, CXTPDockingPaneBase* pPaneI) { CXTPDockingPaneManager* pManager = pPaneI->GetDockingPaneManager(); int nSplitterSize = pManager->GetPaintManager()->m_nSplitterSize; int nTotalLength = 0; int nLengthAvail = 0; _AdjustPanesLength(pManager, lst, rect, bHoriz, FALSE, nTotalLength, nLengthAvail); POSITION pos = lst.GetHeadPosition(); CRect rcPane(rect); while (pos) { CXTPDockingPaneBase* pPane = lst.GetNext(pos); int nLength = -pPane->m_nLength; if (pPane->m_nLength > 0) { nLength = nTotalLength == 0 ? 0 : int((nLengthAvail * pPane->m_nLength) / nTotalLength); nTotalLength -= pPane->m_nLength; nLengthAvail = max(nLengthAvail - nLength, 0); } if (bHoriz) { rcPane.right = pos == NULL ? rect.right : rcPane.left + nLength; if (pPaneI == pPane) break; rcPane.left = rcPane.right + nSplitterSize; } else { rcPane.bottom = pos == NULL ? rect.bottom : rcPane.top + nLength; if (pPaneI == pPane) break; rcPane.top = rcPane.bottom + nSplitterSize; } } return rcPane; }
void CXTPDockingPaneSplitterContainer::OnSizeParent(CWnd* pParent, CRect rect, LPVOID lParam) { CXTPDockingPaneManager* pManager = GetDockingPaneManager(); CXTPDockingPanePaintManager* pPaintManager = pManager->GetPaintManager(); int nSplitterSize = pPaintManager->m_nSplitterSize; int nSplitterIndent = pPaintManager->m_bShowCaption ? pPaintManager->m_nSplitterIndent : 0; CXTPDockingPaneBase* pClient = pManager->GetClientPane(); AFX_SIZEPARENTPARAMS* lpLayout = (AFX_SIZEPARENTPARAMS*)lParam; m_pDockingSite = pParent; m_rcWindow = rect; BOOL bClientPane = !pManager->m_bHideClient; // getting list of nonempty panes CXTPDockingPaneBaseList lst; POSITION pos = GetHeadPosition(); while (pos) { CXTPDockingPaneBase* pPane = GetNext(pos); if (!pPane->IsEmpty()) lst.AddTail(pPane); if (!bClientPane && pPane->ContainPane(pClient)) bClientPane = TRUE; } if (!lst.IsEmpty() && bClientPane && pManager->m_bHideClient) { pClient->OnSizeParent(pParent, CXTPEmptyRect(), lParam); } if (lst.GetCount() == 0) return; if (lst.GetCount() == 1) { lst.GetHead()->OnSizeParent(pParent, rect, lParam); return; } if (m_bRecalcLayout) return; m_bRecalcLayout = TRUE; //ASSERT(m_lstSpliters.GetCount() == lst.GetCount() - 1); int nTotalLength = 0; int nLengthAvail = 0; _AdjustPanesLength(pManager, lst, rect, m_bHoriz, TRUE, nTotalLength, nLengthAvail); pos = lst.GetHeadPosition(); POSITION posSplitter = m_lstSpliters.GetHeadPosition(); CRect rcPane(rect); while (pos) { CXTPDockingPaneBase* pPane = lst.GetNext(pos); int nLength = -pPane->m_nLength; if (pPane->m_nLength > 0) { nLength = nTotalLength == 0 ? 0 : int((nLengthAvail * pPane->m_nLength) / nTotalLength); nTotalLength -= pPane->m_nLength; nLengthAvail = max(nLengthAvail - nLength, 0); } CRect rcSplitter; if (m_bHoriz) { rcPane.right = pos == NULL ? rect.right : rcPane.left + nLength; rcSplitter.SetRect(rcPane.right - nSplitterIndent, rect.top, rcPane.right + nSplitterSize + nSplitterIndent, rect.bottom); } else { rcPane.bottom = pos == NULL ? rect.bottom : rcPane.top + nLength; rcSplitter.SetRect(rect.left, rcPane.bottom - nSplitterIndent, rect.right, rcPane.bottom + nSplitterSize + nSplitterIndent); } if (lpLayout->hDWP != NULL && posSplitter) { CXTPDockingPaneSplitterWnd* pSplitter = m_lstSpliters.GetNext(posSplitter); if (pSplitter) { rcSplitter.IntersectRect(rcSplitter, rect); pSplitter->SetWindowPos(&CWnd::wndBottom, rcSplitter.left, rcSplitter.top, rcSplitter.Width(), rcSplitter.Height(), 0); pSplitter->Invalidate(FALSE); } } pPane->OnSizeParent(pParent, rcPane, lParam); if (m_bHoriz) { rcPane.left = rcPane.right + nSplitterSize; } else { rcPane.top = rcPane.bottom + nSplitterSize; } } m_bRecalcLayout = FALSE; }
HBRUSH CXTPPropertyPageTabNavigator::GetPageBrush(CDC* pDC, CXTPPropertyPage* pPage) { COLORREF clrClient = COLORREF_NULL; if (GetPaintManager()->GetColor() == xtpTabColorWinNative) { clrClient = COLOR_WINXP; } else { CXTPTabManagerItem* pItem = GetSelectedItem(); if (!pItem) return NULL; clrClient = GetPaintManager()->GetColorSet()->GetItemColor(pItem); } if (m_clrBrush != clrClient) { m_brushPage.DeleteObject(); m_clrBrush = clrClient; } if (m_brushPage.GetSafeHandle()) return m_brushPage; if (m_clrBrush == GetXtremeColor(COLOR_3DFACE)) return 0; if (m_clrBrush != COLOR_WINXP) { m_brushPage.CreateSolidBrush(m_clrBrush); return m_brushPage; } if (m_brushPage.GetSafeHandle() == 0) { CXTPClientRect rc(pPage); if (rc.IsRectEmpty()) return 0; CXTPWinThemeWrapper wrapper; wrapper.OpenTheme(0, L"TAB"); if (!wrapper.IsAppThemed()) return 0; CBitmap bmp; bmp.CreateCompatibleBitmap(pDC, rc.Width(), rc.Height()); { CRect rectContent(0, 0, 0, 0); if (FAILED(wrapper.GetThemeBackgroundContentRect(pDC->GetSafeHdc(), TABP_PANE, 0, rc, rectContent))) { rectContent = rc; rectContent.DeflateRect(2, 2, 4, 4); } CRect rcPane(-rectContent.left, -rectContent.top, rc.right + (rc.right - rectContent.right), rc.bottom + (rc.bottom - rectContent.bottom)); CXTPCompatibleDC dc(pDC, bmp); wrapper.DrawThemeBackground(dc, TABP_PANE, 0, rcPane, 0); } m_brushPage.Attach( ::CreatePatternBrush(bmp)); } return m_brushPage; }