Example #1
0
BOOL CMainFrame::InitRibbonTheme()
{
    std::wstring themeName(getUIOptions()->GetString(L"themeName", L"OFFICE2010SILVER.INI"));
    std::wstring themeDll(getUIOptions()->GetString(L"themeDll", L"Office2010.dll"));

    getUIOptions()->SetString(L"themeDll", themeDll.c_str());
    getUIOptions()->SetString(L"themeName", themeName.c_str());

    themeDll = getTranslationsPath((L"../" + themeDll).c_str());
    BOOL ret = XTPResourceImages()->SetHandle(themeDll.c_str(), themeName.c_str());

    if (!ret)
    {
        std::wstring dllfile(getTranslationsPath(L"../Office2007.dll"));
        ret = XTPResourceImages()->SetHandle(dllfile.c_str(), L"OFFICE2007BLUE.INI");
        if (ret)
        {
            getUIOptions()->SetString(L"themeDll", L"Office2007.dll");
            getUIOptions()->SetString(L"themeName", L"OFFICE2007BLUE.INI");
        }
    }

    if (ret)
    {
        XTPPaintManager()->SetTheme(xtpThemeRibbon);
        m_cmdbars->SetTheme(xtpThemeRibbon);
    }
    else
    {
        CString msg;
        msg.Format(L"Need Office2010.dll or Office2007.dll in the translations folder: %s.\n", getTranslationsPath(L"..").c_str());
        ASSERT_MESSAGE(0, w2a(msg).c_str());
    }

    return ret;
}
Example #2
0
void gkToolBarPaneBase::RefreshMetrics( BOOL bOffice2007 )
{
	m_brush.DeleteObject();

	if (bOffice2007)
	{
		COLORREF clr = XTPResourceImages()->GetImageColor(_T("DockingPane"), _T("WordPaneBackground"));
		m_brush.CreateSolidBrush(clr);
	}
	else
	{
		m_brush.CreateSolidBrush(GetSysColor(COLOR_3DFACE));
	}
	gkLogMessage(_T("Material Editor Refresh."));
}
void CXTPHeaderCtrlThemeResource::DrawSortArrow(CDC* pDC, LPPOINT ptsArrow, BOOL bAscending)
{
	CXTPResourceImages* pImages = XTPResourceImages();
	if (pImages)
	{
		CXTPPenDC   dcPen(pDC->m_hDC, m_cr3DShadow);
		CXTPBrushDC dcBrush(pDC->m_hDC, m_cr3DShadow);

		pDC->SetPolyFillMode(WINDING);
		pDC->Polygon(ptsArrow, 3);
	}
	else
	{
		CXTPHeaderCtrlThemeOfficeXP::DrawSortArrow(pDC, ptsArrow, bAscending);
	}
}
void CXTPPopupThemeResource::RefreshMetrics()
{
	CXTPPopupThemeOffice2003::RefreshMetrics();

	CXTPResourceImages* pImages = XTPResourceImages();

	m_clrBackground.SetStandardValue(
		pImages->GetImageColor(_T("PopupControl"), _T("BackgroundLight")),
		pImages->GetImageColor(_T("PopupControl"), _T("BackgroundDark")));
	m_clrGripper.SetStandardValue(
		pImages->GetImageColor(_T("PopupControl"), _T("CaptionLight")),
		pImages->GetImageColor(_T("PopupControl"), _T("CaptionDark")));
	m_clrFrame.SetStandardValue(
		pImages->GetImageColor(_T("PopupControl"), _T("FrameBorder")));

	m_clrText = pImages->GetImageColor(_T("PopupControl"), _T("NormalText"));
	m_clrButtonSelected = pImages->GetImageColor(_T("PopupControl"), _T("ButtonSelected"));
	m_clrButtonPressed = pImages->GetImageColor(_T("PopupControl"), _T("ButtonPressed"));
	m_clrButtonPressedBorder.SetStandardValue(pImages->GetImageColor(_T("PopupControl"), _T("ButtonBorder")));
	m_clrButtonSelectedBorder.SetStandardValue(pImages->GetImageColor(_T("PopupControl"), _T("ButtonBorder")));
}
void CXTPHeaderCtrlThemeResource::OnDrawItemBackground(LPDRAWITEMSTRUCT lpDIS)
{
	CXTPResourceImages* pImages = XTPResourceImages();
	if (pImages)
	{
		CDC* pDC = CDC::FromHandle(lpDIS->hDC);
		CRect rcItem = lpDIS->rcItem;
		rcItem.left++;

		if (lpDIS->itemState == ODS_SELECTED)
		{
			XTPDrawHelpers()->GradientFill(pDC, &rcItem, m_crgBackPressed, FALSE);

			// draw border.
			{
				CXTPPenDC dcPen(pDC->m_hDC, m_cr3DDkShadow);
				pDC->MoveTo(rcItem.left, rcItem.bottom-1);
				pDC->LineTo(rcItem.right, rcItem.bottom-1);
			}

			// draw separator.
			{
				CXTPPenDC dcPen(pDC->m_hDC, m_cr3DShadow);
				pDC->MoveTo(rcItem.right, 2);
				pDC->LineTo(rcItem.right, rcItem.bottom-3);
			}
		}
		else
		{
			// draw separator.
			CXTPPenDC dcPen(pDC->m_hDC, m_cr3DShadow);
			pDC->MoveTo(rcItem.right, 2);
			pDC->LineTo(rcItem.right, rcItem.bottom-3);
		}
	}
	else
	{
		CXTPHeaderCtrlThemeOfficeXP::OnDrawItemBackground(lpDIS);
	}
}
void CXTPHeaderCtrlThemeResource::OnDrawBackground(LPDRAWITEMSTRUCT lpDIS)
{
	CXTPResourceImages* pImages = XTPResourceImages();
	if (pImages)
	{
		CDC* pDC = CDC::FromHandle(lpDIS->hDC);
		CRect rcItem = lpDIS->rcItem;

		// fill background
		XTPDrawHelpers()->GradientFill(pDC, rcItem, m_crgBack, FALSE);
		rcItem.right += 2;

		// draw border.
		CXTPPenDC penDC(pDC->m_hDC, m_cr3DDkShadow);
		pDC->MoveTo(lpDIS->rcItem.left, lpDIS->rcItem.bottom-1);
		pDC->LineTo(lpDIS->rcItem.right, lpDIS->rcItem.bottom-1);
	}
	else
	{
		CXTPHeaderCtrlThemeOfficeXP::OnDrawBackground(lpDIS);
	}
}
void CXTPSplitterWndThemeResource::RefreshMetrics()
{
	CXTPResourceImages* pImages = XTPResourceImages();
	if (pImages)
	{
		// get colors from resource.
		COLORREF crBack = pImages->GetImageColor(_T("Window"), m_bTabColors ? _T("SplitterFaceTab") : _T("SplitterFace"), GetXtremeColor(COLOR_3DFACE));
		COLORREF crBorder = pImages->GetImageColor(_T("Window"), m_bTabColors ? _T("SplitterFrameTab") : _T("SplitterFrame"), GetXtremeColor(COLOR_3DSHADOW));

		// set splitter colors.
		m_crBack.SetStandardValue(crBack);
		m_crOuterBorder.SetStandardValue(crBack);
		m_crInnerBorder.SetStandardValue(crBorder);

		// set split box colors.
		m_crBoxBack = m_crBack;
		m_crOuterBoxBorder = m_crOuterBorder;
		m_crInnerBoxBorder = m_crInnerBorder;
	}
	else
	{
		CXTPSplitterWndThemeOfficeXP::RefreshMetrics();
	}
}
void CXTPHeaderCtrlThemeResource::RefreshMetrics(CXTPHeaderCtrl* pHeader)
{
	CXTPHeaderCtrlThemeOfficeXP::RefreshMetrics(pHeader);

	CXTPResourceImages* pImages = XTPResourceImages();
	if (pImages)
	{
		m_crText = pImages->GetImageColor(_T("ReportControl"), _T("HeaderText"), m_crText);
		m_cr3DShadow = pImages->GetImageColor(_T("ReportControl"), _T("ColumnSeparator"), m_crText);
		m_cr3DDkShadow = pImages->GetImageColor(_T("ReportControl"), _T("ColumnShadow"), m_crText);

		m_crgBack.SetStandardValue(
			pImages->GetImageColor(_T("ReportControl"), _T("NormalColumnLight"), m_cr3DFace),
			pImages->GetImageColor(_T("ReportControl"), _T("NormalColumnDark"),  m_cr3DFace));

		m_crgBackPressed.SetStandardValue(
			pImages->GetImageColor(_T("ReportControl"), _T("PressedColumnLight"), m_cr3DFace),
			pImages->GetImageColor(_T("ReportControl"), _T("PressedColumnDark"),  m_cr3DFace));
	}
	else
	{
		m_crgBack.SetStandardValue(m_cr3DFace, m_cr3DFace);
	}
}