示例#1
0
void CReportCtrl::Initialize(const CReportCtrl::ColInfo cols[], int nColCount, UINT nOpFlag)
{
	m_nOpFlag = nOpFlag;
	m_cols = cols;
	m_nColCount = nColCount;

	AllowEdit(nOpFlag != 0);
	SetGridStyle(FALSE,xtpReportGridSolid);
	GetPaintManager()->SetColumnStyle(xtpReportColumnResource);
	GetPaintManager()->m_strNoItems.Empty();

	for (int i=0; i<nColCount; ++i)
	{
		const ColInfo &c = cols[i];
		if (c.fmt != FmtIdOnly)
		{
			CXTPReportColumn *pCol = new CXTPReportColumn(GetColumns()->GetCount(),c.caption,c.width,
			!c.fixed,XTP_REPORT_NOICON,c.sortable);
			pCol->AllowRemove(FALSE);
			pCol->SetAllowDrag(FALSE);
			AddColumn(pCol);
		}
	}

	if (nOpFlag & OpModify)
		m_pSubmitOpCol = AddOpCol(IndexModify);
	if (nOpFlag & OpReset)
		m_pResetOpCol = AddOpCol(IndexReset);
	if (nOpFlag & OpDelete)
		m_pDeleteOpCol = AddOpCol(IndexDelete);
 

}
int CXTPCalendarDayViewTimeScale::CalcWidth(CDC* pDC)
{
	// calculate actual correct width
	int nWidth1 = m_nWidth, nWidth2 = m_nWidth;

	// calculate width for midnight
	COleDateTime dtMid(0, 0);
	CString strHour, strMin;
	Format(dtMid, TRUE, &strHour, &strMin);

	COleDateTimeSpan spScaleInterval = GetScaleInterval();
	int nRowHeight = XTP_SAFE_GET1(m_pDayView, GetRowHeight(), 1);
	int nHourHeight = nRowHeight * (CXTPCalendarUtils::GetTotalMinutes(spScaleInterval) < 60 ? 2 : 1);

	XTP_SAFE_CALL3(m_pDayView, GetPaintManager(), GetDayViewTimeScaleCellPart(),
		CalcWidth(pDC, strHour, strMin, nHourHeight, nWidth1));

	// calculate width for midday
	dtMid += COleDateTimeSpan(0, 12, 0, 0);
	Format(dtMid, TRUE, &strHour, &strMin);

	XTP_SAFE_CALL3(m_pDayView, GetPaintManager(), GetDayViewTimeScaleCellPart(),
		CalcWidth(pDC, strHour, strMin, nHourHeight, nWidth2));

	// choose the widest one
	m_nWidth = max(nWidth1, nWidth2);

	return m_nWidth;
}
CRect CXTPTaskPanelGroup::GetTargetCaptionRect() const
{
	int nCaptionRight = m_rcGroupTarget.right;
	if (m_pPanel->GetScrollButton(TRUE)->pGroupCaption == this)
		nCaptionRight = m_pPanel->GetScrollButton(TRUE)->rcButton.left - GetPaintManager()->GetGroupSpacing(m_pPanel) - 1;
	if (m_pPanel->GetScrollButton(FALSE)->pGroupCaption == this)
		nCaptionRight = m_pPanel->GetScrollButton(FALSE)->rcButton.left - GetPaintManager()->GetGroupSpacing(m_pPanel) - 1;

	return CRect(m_rcGroupTarget.left, m_rcGroupTarget.top, nCaptionRight, m_rcGroupTarget.top + m_nCaptionHeight);
}
void CXTPTaskPanelGroup::RepositionScrollOffset()
{
	int nItemCount = GetItemCount();
	int nLastVisibleItem = m_pItems->GetNextVisibleIndex(nItemCount, -1);

	int nScrollOffset = min(GetOffsetItem(), nLastVisibleItem);

	if (nScrollOffset > 0)
	{
		CRect rcItem(GetAt(nLastVisibleItem)->GetItemRect());

		int nTopMargin = GetPaintManager()->GetGroupInnerMargins(this).top;

		while ((nScrollOffset > 0) && ((rcItem.bottom - GetAt(nScrollOffset - 1)->GetItemRect().top + nTopMargin
			< m_nExpandedClientHeight) || !GetAt(nScrollOffset - 1)->IsVisible()))
		{
			nScrollOffset--;
		}
	}
	SetOffsetItem(nScrollOffset, FALSE);

	for (int i = 0; i < nItemCount; i++)
	{
		CXTPTaskPanelGroupItem* pItem = GetAt(i);

		if (pItem->IsItemFocused() || (pItem->IsItemSelected() && GetTaskPanel()->m_bSelectItemOnFocus))
		{
			EnsureVisible(pItem, FALSE);
			break;
		}
	}
}
int CXTPTaskPanelGroup::CalcInsideHeight()
{
	CRect rc;
	m_pPanel->GetClientRect(&rc);
	int nInsideHeight = rc.Height();

	CXTPTaskPanelPaintManager* pPaintManager = GetPaintManager();

	int nGroupSpacing = pPaintManager->GetGroupSpacing(m_pPanel);
	CRect rcMargins = pPaintManager->GetControlMargins(m_pPanel);

	int nGroupCount = m_pPanel->GetGroupCount();
	int nVisibleCount = 0;

	for (int i = 0; i < nGroupCount; i++)
	{
		CXTPTaskPanelGroup* pGroup = m_pPanel->GetAt(i);
		if (!pGroup->IsVisible())
			continue;

		nVisibleCount++;

		CRect rcMarginsOuter = pPaintManager->GetGroupOuterMargins(pGroup);

		nInsideHeight -= pGroup->m_nCaptionHeight + rcMarginsOuter.top + rcMarginsOuter.bottom;
		if (pGroup->IsExpanded() && pGroup != m_pPanel->GetActiveGroup())
			nInsideHeight -= pGroup->m_nExpandedClientHeight;
	}
	nInsideHeight -= nVisibleCount > 0 ? nGroupSpacing * (nVisibleCount - 1) : 0;
	nInsideHeight -= rcMargins.top + rcMargins.bottom;

	return nInsideHeight;
}
void CXTPPropertyPageTabNavigator::OnSysColorChange()
{
	CXTPTabControl::OnSysColorChange();

	GetPaintManager()->RefreshMetrics();
	m_brushPage.DeleteObject();
}
示例#7
0
void CXTPTabManager::EnsureVisible(CXTPTabManagerItem* pItem)
{
	if (!pItem)
		return;

	GetPaintManager()->EnsureVisible(this, pItem);
}
示例#8
0
void CXTPRibbonTabPopupToolBar::DrawCommandBar(CDC* pDC, CRect rcClipBox)
{
	CXTPRibbonPaintManager* pPaintManager = GetPaintManager()->GetRibbonPaintManager();

	pPaintManager->FillTabPopupToolBar(pDC, this);
	pPaintManager->FillGroupRect(pDC, m_pRibbonTab, m_rcGroups);
	pDC->SetBkMode(TRANSPARENT);

	CXTPRibbonGroups* pGroups = m_pRibbonTab->GetGroups();
	for (int i = 0; i < pGroups->GetCount(); i++)
	{
		CXTPRibbonGroup* pGroup = pGroups->GetAt(i);

		if (pGroup->IsVisible() && CRect().IntersectRect(rcClipBox, pGroup->GetRect()))
		{
			pGroup->Draw(pDC, rcClipBox);
		}
	}

	if (m_pControlScrollGroupsLeft->IsVisible())
	{
		m_pControlScrollGroupsLeft->Draw(pDC);
	}

	if (m_pControlScrollGroupsRight->IsVisible())
	{
		m_pControlScrollGroupsRight->Draw(pDC);
	}
}
示例#9
0
void CXTPTabManager::GetItemMetrics(CSize* lpszNormal, CSize* lpszMin /*= NULL*/, CSize* lpszMax /*= NULL*/) const
{
	CXTPTabPaintManager* pPaintManager = GetPaintManager();
	if (lpszNormal) *lpszNormal = CSize(pPaintManager->m_nFixedTabWidth, 0);
	if (lpszMin) *lpszMin = CSize(pPaintManager->m_nMinTabWidth, 0);
	if (lpszMax) *lpszMax = CSize(pPaintManager->m_nMaxTabWidth, 0);
}
void CControlLineStyleSelector::Draw(CDC* pDC)
{
	CRect rc(m_rcControl);
	int nCount = sizeof(lineStyles) / sizeof(lineStyles[0]);
	
	for (int i = 0; i < nCount; i++)
	{
		CRect rcButton = GetRect(i);
		
		if (i == m_nSelected || lineStyles[i].iLineStyle == m_iLineStyle)
		{
			BOOL bPressed = GetPressed() && i == m_nSelected;
			//GetPaintManager()->DrawControlEntry(pDC, &rcButton, m_bEnabled, 1, bPressed, lineStyles[i].iLineStyle == m_iLineStyle, FALSE, GetParent()->GetPosition());
         GetPaintManager()->DrawRectangle(pDC, &rcButton, i == m_nSelected, bPressed, m_bEnabled, lineStyles[i].iLineStyle == m_iLineStyle, FALSE,GetParent()->GetType(), GetParent()->GetPosition());
		}
			
		Gdiplus::Graphics gdipGraphics(pDC->m_hDC);
		Gdiplus::Pen pen(Gdiplus::Color(255, 0, 0, 0), 3);
		pen.SetDashCap(Gdiplus::DashCapFlat);
		pen.SetDashPattern(lineStyles[i].dashValues, lineStyles[i].iDashValueCount);
		pen.SetDashStyle(Gdiplus::DashStyleCustom);

		int yPos = rcButton.top + XTP_LS_SELECTOR_HEIGHT / 2;
			
		if (!m_bEnabled) 
		{
			pen.SetColor(Gdiplus::Color(255, 128, 128, 128));
		}
		
		gdipGraphics.DrawLine(&pen, Gdiplus::Point(rcButton.left, yPos), Gdiplus::Point(rcButton.right, yPos));

	}
}
void CXTPDockingPaneSidePanel::OnLButtonDown(UINT /*nFlags*/, CPoint point)
{
	if (m_bCollapsed && !m_bExpanded)
	{
		Expand();
		GetCursorPos(&point);
		ScreenToClient(&point);
		InvalidatePane(FALSE);
		UpdateWindow();
	}

	_RestoreFocus();

	CXTPDockingPaneCaptionButton* pButton = HitTestCaptionButton(point);

	if (pButton)
	{
		if (pButton->Click(this, point))
		{
			OnCaptionButtonClick(pButton);
		}

		return;
	}

	CRect rcCaption = GetPaintManager()->GetPaneCaptionRect(this);

	if (rcCaption.PtInRect(point))
	{
		ClientToScreen(&point);
		OnCaptionLButtonDown(point);
	}
}
示例#12
0
void CSimpleReport::SetFontHeader(const char* fontname, int sz)
{
	LOGFONT lf;
	m_fontText.DeleteObject();
	m_fontText.CreateFont(sz, 0, 0, 0, FW_NORMAL, false, false, 0, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, fontname);
	m_fontText.GetLogFont(&lf);
	GetPaintManager()->SetCaptionFont(lf);
}
void CXTPDockingPaneSidePanel::OnPaint()
{
	CPaintDC dcPaint(this);
	CXTPClientRect rc(this);
	CXTPBufferDC dc(dcPaint);

	GetPaintManager()->DrawSidePanel(&dc, this, rc);
}
BOOL CXTPSyntaxEditPropertiesPageFont::GetSafeLogFont(LOGFONT& lf)
{
	if (m_editFont.GetSafeHandle())
	{
		m_editFont.GetLogFont(&lf);
		return TRUE;
	}

	CFont* pFont = GetPaintManager() ? GetPaintManager()->GetFont() : NULL;
	if (pFont && pFont->GetSafeHandle())
	{
		pFont->GetLogFont(&lf);
		return TRUE;
	}

	return FALSE;
}
示例#15
0
void CXTPTabManager::SetItemMetrics(CSize szNormal, CSize szMin /*= CSize(0, 0)*/, CSize szMax /*= CSize(0, 0)*/)
{
	CXTPTabPaintManager* pPaintManager = GetPaintManager();
	pPaintManager->m_nFixedTabWidth = szNormal.cx;
	pPaintManager->m_nMinTabWidth = szMin.cx;
	pPaintManager->m_nMaxTabWidth = szMax.cx;

	Reposition();
}
示例#16
0
int CXTPTaskPanelGroup::GetScrollOffsetPos() const
{
	int nScrollOffset = GetOffsetItem();

	if (nScrollOffset > 0 && nScrollOffset < GetItemCount())
	{
		return GetAt(nScrollOffset)->GetItemRect().top - GetPaintManager()->GetGroupInnerMargins(this).top;
	}
	return 0;
}
示例#17
0
CSimpleReport::CSimpleReport()
{ 
	FocusSubItems(TRUE);
	AllowEdit(TRUE);
	EditOnClick(FALSE);
	SetMultipleSelection(FALSE);

//	GetPaintManager()->SetGridStyle(TRUE, xtpReportGridLargeDots);
//	GetPaintManager()->SetGridColor(RGB(200,200,200));

	GetPaintManager()->SetGridStyle(FALSE, xtpReportGridSolid);
	GetPaintManager()->SetGridColor(RGB(220,220,220));
	GetPaintManager()->SetGridStyle(TRUE, xtpReportGridSolid);
	GetPaintManager()->SetGridColor(RGB(220,220,220));

#if _XTPLIB_VERSION_PREFIX == 1020
	GetPaintManager()->m_columnStyle = xtpReportColumnOffice2003;
#else // if _XTPLIB_VERSION_PREFIX == 1200
	GetPaintManager()->SetColumnStyle(xtpReportColumnOffice2007);
#endif
	GetPaintManager()->m_bDrawSortTriangleAlways = TRUE;
	GetPaintManager()->m_bHotTracking = TRUE;
	GetPaintManager()->m_clrHighlight = RGB(170, 200, 255);
	GetPaintManager()->m_clrHighlightText = RGB(0, 0, 0);
//	GetPaintManager()->m_clrSelectedRow = RGB(200, 230, 230);
//	GetPaintManager()->m_clrSelectedRowText = RGB(0, 0, 0);

	GetReportHeader()->AllowColumnRemove(FALSE);
	GetReportHeader()->AllowColumnSort(TRUE);
	GetReportHeader()->AllowColumnResize(TRUE);
	GetReportHeader()->AllowColumnReorder(TRUE);

	SetFontText("Arial", 14);
	SetFontHeader("Arial", 14);
//	SetColorBack(RGB(240, 255, 255));
//	SetColorHightLight(RGB(0, 0, 0), RGB(255, 255, 0));

	callback_add = NULL;
	callback_del = NULL;
	callback_copy = NULL;
	callback_newrec = NULL;
	m_bAdd = false;
}
BOOL CXTPSyntaxEditPropertiesPageFont::WriteRegistryValues()
{
	// update paint manager font(paint manager font is set with CXTPSyntaxEditCtrl::CreateFontIndirect).
	LOGFONT lf = {0};
	if (!GetSafeLogFont(lf))
		return FALSE;

	if (!m_pEditView || !GetPaintManager())
		return FALSE;

	m_pEditView->SetFontIndirect(&lf, TRUE);

	// commit values to registry.
	GetPaintManager()->SetTextColor(m_crText, TRUE);
	GetPaintManager()->SetBackColor(m_crBack, TRUE);
	GetPaintManager()->SetHiliteTextColor(m_crHiliteText, TRUE);
	GetPaintManager()->SetHiliteBackColor(m_crHiliteBack, TRUE);

	return TRUE;
}
void CXTPCalendarWeekView::Draw(CDC* pDC)
{
	XTP_SAFE_CALL2(GetPaintManager(), GetWeekViewPart(), OnDraw(pDC, this));

	// Draw events

	int nDays = m_arDays.GetCount();
	for (int nDay = 0; nDay < nDays; nDay++)
	{
		XTP_SAFE_CALL1(m_arDays.GetAt(nDay), Draw(pDC));
	}
}
void CXTPPropertyPageTabNavigator::PageToSize(AFX_SIZEPARENTPARAMS* pLayout, CSize szPage, CRect& rcPage, CSize& szClient)
{
	CRect rcTabControl(0, 0, szPage.cx, szPage.cy);

	CClientDC dc(this);
	GetPaintManager()->RepositionTabControl(this, &dc, rcTabControl);

	AdjustRect(TRUE, &rcTabControl);
	rcTabControl.InflateRect(m_rcPageMargin);


	szClient = CSize(rcTabControl.Width() + m_rcNavigatorMargin.left + m_rcNavigatorMargin.right,
		rcTabControl.Height() + m_rcNavigatorMargin.top + m_rcNavigatorMargin.bottom);

	rcPage = CRect(CPoint(m_rcNavigatorMargin.left - rcTabControl.left,
		m_rcNavigatorMargin.top - rcTabControl.top), szPage);

	AfxRepositionWindow(pLayout, m_hWnd, CRect(m_rcNavigatorMargin.TopLeft(), rcTabControl.Size()));

	GetPaintManager()->RepositionTabControl(this, &dc, CRect(0, 0, rcTabControl.Width(), rcTabControl.Height()));
}
void CXTPDockingPaneSidePanel::OnLButtonDblClk(UINT /*nFlags*/, CPoint point)
{
	if (HitTestCaptionButton(point))
		return;

	CRect rcCaption = GetPaintManager()->GetPaneCaptionRect(this);

	if (rcCaption.PtInRect(point))
	{
		GetDockingPaneManager()->ToggleDocking(GetTopContainer());
	}
}
BOOL CXTPSyntaxEditPropertiesPageFont::ReadRegistryValues()
{
	LOGFONT lf = {0};
	if (!GetSafeLogFont(lf))
		return FALSE;

	if (!CreateSafeFontIndirect(m_editFont, lf))
		return FALSE;

	if (!GetPaintManager())
		return FALSE;

	m_crText        = GetPaintManager()->GetTextColor();
	m_crBack        = GetPaintManager()->GetBackColor();
	m_crHiliteText  = GetPaintManager()->GetHiliteTextColor();
	m_crHiliteBack  = GetPaintManager()->GetHiliteBackColor();
	m_bStrikeOut    = (BOOL)lf.lfStrikeOut;
	m_bUnderline    = (BOOL)lf.lfUnderline;

	return TRUE;
}
void CXTPDockingPaneSplitterContainer::GetMinMaxInfo(LPMINMAXINFO pMinMaxInfo) const
{
	CXTPDockingPaneBase::GetMinMaxInfo(pMinMaxInfo);

	int nCount = 0;

	POSITION pos = GetHeadPosition();
	while (pos)
	{
		CXTPDockingPaneBase* pPane = GetNext(pos);
		if (pPane->IsEmpty())
			continue;

		nCount++;

		MINMAXINFO info;
		pPane->GetMinMaxInfo(&info);

		if (nCount == 1)
		{
			*pMinMaxInfo = info;

		}
		else
		{
			GetMinSize(pMinMaxInfo, m_bHoriz) += GetMinSize(&info, m_bHoriz);
			GetMaxSize(pMinMaxInfo, m_bHoriz) += GetMaxSize(&info, m_bHoriz);

			GetMinSize(pMinMaxInfo, !m_bHoriz) = max(GetMinSize(pMinMaxInfo, !m_bHoriz), GetMinSize(&info, !m_bHoriz));
			GetMaxSize(pMinMaxInfo, !m_bHoriz) = min(GetMaxSize(pMinMaxInfo, !m_bHoriz), GetMaxSize(&info, !m_bHoriz));
		}
	}

	if (nCount > 0)
	{
		GetMinSize(pMinMaxInfo, m_bHoriz) += GetPaintManager()->m_nSplitterSize * (nCount - 1);
		GetMaxSize(pMinMaxInfo, m_bHoriz) += GetPaintManager()->m_nSplitterSize * (nCount - 1);
	}
}
示例#24
0
INT_PTR CXTPTabManager::PerformToolHitTest(HWND hWnd, CPoint point, TOOLINFO* pTI) const
{
	if (IsMouseLocked())
		return -1;

	int nIndex = -1;
	CXTPTabManagerNavigateButton* pNavigateButton = HitTestNavigateButton(point, FALSE, &nIndex);
	if (pNavigateButton)
	{
		ASSERT(nIndex != -1);
		CString strTip = pNavigateButton->GetTooltip();
		if (strTip.IsEmpty())
			return -1;

		CXTPToolTipContext::FillInToolInfo(pTI, hWnd, pNavigateButton->GetRect(), nIndex, strTip);

		return nIndex;
	}

	CXTPTabManagerItem* pItem = HitTest(point);

	if (pItem)
	{
		if (GetPaintManager()->m_toolBehaviour == xtpTabToolTipNever)
			return -1;

		if (GetPaintManager()->m_toolBehaviour == xtpTabToolTipShrinkedOnly && !pItem->IsItemShrinked())
			return -1;

		CString strTip = GetItemTooltip(pItem);
		if (strTip.IsEmpty())
			return -1;

		CXTPToolTipContext::FillInToolInfo(pTI, hWnd, pItem->GetRect(), pItem->GetIndex(), strTip, pItem->GetCaption(), strTip);

		return pItem->GetIndex();
	}
	return -1;
}
BOOL CXTPRibbonControlTab::DrawIcon(CDC* pDC, CPoint pt, CXTPTabManagerItem* pItem, BOOL bDraw, CSize& szIcon) const
{
	if (!pItem)
		return GetPaintManager()->m_bShowIcons;

	if (pItem->GetImageIndex() == -1 || GetPaintManager()->m_bShowIcons == FALSE)
		return FALSE;

	CXTPImageManagerIcon* pImage = GetImageManager()->GetImage(pItem->GetImageIndex(), szIcon.cx);

	if (!pImage)
		return FALSE;

	if (!bDraw)
	{
		return TRUE;
	}

	pItem->DrawImage(pDC, CRect(pt, szIcon), pImage);

	return TRUE;
}
void CXTPDockingPaneSidePanel::MovePanel(LENGTH* pLength, CRect rect)
{
	m_bInRecalcLayout = TRUE;

	if (m_bCollapsed && m_bSlideOut)
	{
		m_bSlideOut = FALSE;
		m_bExpanded = FALSE;
		m_nSlideStep = 0;
		KillTimer(TID_SLIDEOUT);
		OnAction(xtpPaneActionCollapsed);
	}

	BOOL bHorizontal = IsHorizontal();
	CSize sz = bHorizontal ? CSize(pLength->nSize, pLength->nHeight) : CSize(pLength->nHeight, pLength->nSize);

	int nMinHeight = GetMinHeight();

	if (m_bCollapsed && !m_bExpanded)
	{
		if (bHorizontal) sz.cy = nMinHeight; else sz.cx = nMinHeight;
	}
	else
	{
		if (bHorizontal) sz.cy = max(sz.cy, nMinHeight); else sz.cx = max(sz.cx, nMinHeight);
	}

	CPoint pt;

	switch (m_direction)
	{
	case xtpPaneDockLeft: pt = CPoint(rect.left, pLength->nPos + rect.top); break;
	case xtpPaneDockTop: pt = CPoint(rect.left + pLength->nPos, rect.top); break;
	case xtpPaneDockRight: pt = CPoint(rect.right - sz.cx, rect.top + pLength->nPos); break;
	case xtpPaneDockBottom: pt = CPoint(rect.left + pLength->nPos, rect.bottom - sz.cy); break;
	}

	SetWindowPos(&CWnd::wndTop, pt.x, pt.y, sz.cx, sz.cy, SWP_NOOWNERZORDER | SWP_SHOWWINDOW);

	CRect rcClient;
	GetClientRect(rcClient);

	GetPaintManager()->AdjustClientRect(this, rcClient);

	CXTPDockingPaneTabbedContainer* pContainer = GetTopContainer();
	if (pContainer)
	{
		pContainer->OnSizeParent(this, rcClient, NULL);
	}
	m_bInRecalcLayout = FALSE;
}
CRect CXTPControlScrollBar::GetScrollBarRect()
{
	CRect rcItem(GetRect());
	rcItem.DeflateRect(2, 2, 2, 2);

	if (m_pParent->GetType() == xtpBarTypePopup && m_pParent->GetPosition() == xtpBarPopup)
	{
		CXTPPaintManager* pPaintManager = GetPaintManager();
		rcItem.left += pPaintManager->GetPopupBarGripperWidth(GetParent())
			+ pPaintManager->m_nPopupBarTextPadding - 2;
	}

	return rcItem;
}
BOOL CXTPPropertyPageTabNavigator::Create()
{
	if (!CXTPTabControl::Create(WS_VISIBLE | WS_CHILD | WS_CLIPSIBLINGS | WS_GROUP | WS_TABSTOP, CRect(0, 0, 0, 0), m_pSheet, 1000))
		return FALSE;

	OnPageChanged();

	CFont* pFont = m_pSheet->GetFont();
	LOGFONT lf;
	pFont->GetLogFont(&lf);
	GetPaintManager()->SetFontIndirect(&lf);

	return TRUE;
}
void CXTPCoreTreeControl::OnNcPaint()
{
	Default();

	if (GetPaintManager()->IsAppThemed() && GetExStyle() & WS_EX_CLIENTEDGE)
	{
		CWindowDC dc(this);

		CXTPWindowRect rc(this);
		rc.OffsetRect(-rc.TopLeft());

		dc.Draw3dRect(rc, GetSysColor(COLOR_BTNSHADOW), GetSysColor(COLOR_BTNSHADOW));
		rc.DeflateRect(1, 1);
		dc.Draw3dRect(rc, GetSysColor(COLOR_WINDOW), GetSysColor(COLOR_WINDOW));
	}
}
示例#30
0
CSize CXTPRibbonTabPopupToolBar::CalcDynamicLayout(int, DWORD /*nMode*/)
{
	CRect rcRibbonBar;
	m_pRibbonBar->GetWindowRect(rcRibbonBar);

	CRect rcRibbonTab = m_pRibbonTab->GetRect();
	m_pRibbonBar->ClientToScreen(rcRibbonTab);

	CRect rcWork = XTPMultiMonitor()->GetWorkArea(rcRibbonTab);

	int nHeight = m_pRibbonBar->CalcGroupsHeight();
	int nWidth = rcRibbonBar.Width();

	m_ptPopup.y = m_rcExclude.bottom;
	m_ptPopup.x = rcRibbonBar.left;

	if (m_ptPopup.x < rcWork.left)
	{
		nWidth -= rcWork.left - m_ptPopup.x;
		m_ptPopup.x = rcWork.left;
	}

	if (m_ptPopup.x + nWidth > rcWork.right)
	{
		nWidth = rcWork.right - m_ptPopup.x - 4;
	}

	if (m_ptPopup.y + nHeight > rcWork.bottom)
	{
		m_ptPopup.y = m_rcExclude.top - nHeight;
	}

	CClientDC dc(this);
	CXTPFontDC font(&dc, GetPaintManager()->GetCommandBarFont(this));

	UpdateShortcuts();

	m_rcGroups.SetRect(0, 0, nWidth, nHeight);
	m_pRibbonTab->GetGroups()->CalcDynamicSize(&dc, m_rcGroups.Width(), LM_COMMIT,
		CRect(m_rcGroups.left + 4, m_rcGroups.top + 3, 6, 3));

	m_rcTearOffGripper.SetRectEmpty();


	return CSize(nWidth, nHeight);
}