예제 #1
0
int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
	if (lpCreateControl->nID == ID_VIEW_OFFICE_THEME)
	{
		CXTPControlComboBox* pComboTheme = (CXTPControlComboBox*)CXTPControlComboBox::CreateObject();

		pComboTheme->SetCaption(_T("Theme:"));
		pComboTheme->AssignDocTemplate(IDR_MAINFRAME);

		pComboTheme->SetStyle(xtpComboLabel);
		
		pComboTheme->SetWidth(200);
		//pComboTheme->SetDropDownWidth(pComboTheme->GetWidth());
		pComboTheme->SetFlags(xtpFlagManualUpdate);

		int nIndex = pComboTheme->AddString(_T("Office 2000"));
		pComboTheme->SetItemData(nIndex, xtpCalendarThemeOffice2000);
				
		nIndex = pComboTheme->AddString(_T("Office XP"));
		pComboTheme->SetItemData(nIndex, xtpCalendarThemeOfficeXP);
		
		nIndex = pComboTheme->AddString(_T("Office 2003"));
		pComboTheme->SetItemData(nIndex, xtpCalendarThemeOffice2003);
				
		int nIndexBlue = pComboTheme->AddString(_T("Office 2007 (Blue)"));
		pComboTheme->SetItemData(nIndexBlue, xtpCalendarThemeOffice2007);

		// 0 - Blue, 1 - Silver, 2 - Black
		if (FILEEXISTS_S(_GetTheme2007Style_file(1)))
		{
			nIndex = pComboTheme->AddString(_T("Office 2007 (Silver)"));
			pComboTheme->SetItemData(nIndex, xtpCalendarThemeOffice2007 + 100 + 1);
		}

		if (FILEEXISTS_S(_GetTheme2007Style_file(2)))
		{
			nIndex = pComboTheme->AddString(_T("Office 2007 (Black)"));
			pComboTheme->SetItemData(nIndex, xtpCalendarThemeOffice2007 + 100 + 2);
		}
			
		lpCreateControl->pControl = pComboTheme;

		pComboTheme->SetCurSel(nIndexBlue);
		return TRUE;
	}

	return FALSE;
}
예제 #2
0
void CMainFrame::OnOfficeThemeChanged(NMHDR* pNMHDR, LRESULT* pResult)
{
	NMXTPCONTROL* tagNMCONTROL = (NMXTPCONTROL*)pNMHDR;

	CXTPControlComboBox* pControl = (CXTPControlComboBox*)tagNMCONTROL->pControl;
	ASSERT(pControl->GetType() == xtpControlComboBox);
	if (pControl->GetType() != xtpControlComboBox)
	{
		ASSERT(FALSE);
		return;
	}
	int nCurSel = pControl->GetCurSel();
	if (nCurSel < 0 || nCurSel >= pControl->GetCount())
	{
		ASSERT(FALSE);
		return;
	}
	int nTheme = (int)pControl->GetItemData(nCurSel);

#ifdef _DEBUG	
	if ((GetKeyState(VK_SHIFT) & 0x8000) && (GetKeyState(VK_CONTROL) & 0x8000))
	{
		if (FILEEXISTS_S(_GetTheme2007Style_file(3)))
		{
			int nIndex = pControl->AddString(_T("Office 2007 (Aqua)"));
			pControl->SetItemData(nIndex, xtpCalendarThemeOffice2007 + 100 + 3);
			pControl->SetCurSel(nIndex);

			nTheme = xtpCalendarThemeOffice2007 + 100 + 3;
		}
	}
#endif

	SetOfficeTheme(nTheme);


	*pResult = 1;
}