예제 #1
0
파일: mainfrm.cpp 프로젝트: Ireneph/samples
void CMainFrame::InitTabButtons()
{
	// Add "Style" button to the right of tabs:
	CMFCRibbonButton* pStyleButton = new CMFCRibbonButton((UINT) -1, _T("Style\ns"));
	pStyleButton->SetMenu(IDR_THEME_MENU, TRUE /* Right align */);

	m_wndRibbonBar.AddToTabs(pStyleButton);

	// Add "About" button to the right of tabs:
	m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon(6)));

}
예제 #2
0
파일: mainfrm.cpp 프로젝트: Ireneph/samples
void CMainFrame::InitViewCategory()
{
	CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddCategory(_T("&View"), IDB_RIBBON_VIEWSMALL, IDB_RIBBON_VIEWLARGE);

	// Create "Show/Hide" panel:
	CMFCRibbonPanel* pPanelShow = pCategory->AddPanel(_T("Show/Hide\nzs"), m_PanelImages.ExtractIcon(4));

	pPanelShow->Add(new CMFCRibbonCheckBox(ID_VIEW_GRID, _T("Grid Lines\ng")));
	pPanelShow->Add(new CMFCRibbonCheckBox(ID_VIEW_SHOWOBJECTS, _T("Show Objects\ns")));

	// Create "Window" panel:
	CMFCRibbonPanel* pPanelWindow = pCategory->AddPanel(_T("Window\nzw"), m_PanelImages.ExtractIcon(5));

	pPanelWindow->Add(new CMFCRibbonButton(ID_WINDOW_NEW, _T("New Window\nn"), 0, 0));

	CMFCRibbonButton* pBtnWindows = new CMFCRibbonButton(ID_WINDOWS_MENU, _T("Switch Windows\ns"), 1, 1);
	pBtnWindows->SetMenu(IDR_WINDOWS_MENU, TRUE);
	pBtnWindows->SetDefaultCommand(FALSE);
	pPanelWindow->Add(pBtnWindows);
}
예제 #3
0
void CMainFrame::InitializeRibbon()
{
    CString strTemp;
    strTemp.LoadString(IDS_RIBBON_FILE);

    // Load panel images:
    m_PanelImages.SetImageSize(CSize(16, 16));
    m_PanelImages.Load(IDB_BUTTONS);

    // Init main button:
    m_MainButton.SetImage(IDB_MAIN_AMT);
    m_MainButton.SetText(_T("\nf"));
    m_MainButton.SetToolTipText(strTemp);

    m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
    CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_AMT_FILESMALL, IDB_AMT_FILELARGE);

    strTemp.LoadString(IDS_RIBBON_NEW);
    pMainPanel->Add(new CMFCRibbonButton(ID_EDIT_REFRESH, _T("Refresh\nr"), 25, 14));
    pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

    strTemp.LoadString(IDS_RIBBON_PRINT);
    CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6);
    pBtnPrint->SetKeys(_T("p"), _T("w"));
    strTemp.LoadString(IDS_RIBBON_PRINT_LABEL);
    pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp));
    strTemp.LoadString(IDS_RIBBON_PRINT);
    pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 7, 7, TRUE));
    strTemp.LoadString(IDS_RIBBON_PRINT_SETUP);
    pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE));
    pMainPanel->Add(pBtnPrint);

    pMainPanel->Add(new CMFCRibbonSeparator(TRUE));
    pMainPanel->Add(new CMFCRibbonButton(ID_FILE_LOGOUT, _T("&Logout"), 0, 0, TRUE));
    //pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

    //strTemp.LoadString(IDS_RIBBON_CLOSE);
    //pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9));

    strTemp.LoadString(IDS_RIBBON_RECENT_DOCS);
    pMainPanel->AddRecentFilesList(strTemp);

    strTemp.LoadString(IDS_RIBBON_EXIT);
    pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15));

    // Add "Home" category with "Clipboard" panel:
    strTemp.LoadString(IDS_RIBBON_HOME);
    CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_AMT_WRITESMALL, IDB_AMT_WRITELARGE);

    // Create "Clipboard" panel:
    strTemp.LoadString(IDS_RIBBON_CLIPBOARD);
    CMFCRibbonPanel* pPanelClipboard = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27));

    strTemp.LoadString(IDS_RIBBON_PASTE);
    CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, strTemp, 0, 0);
    pPanelClipboard->Add(pBtnPaste);

    strTemp.LoadString(IDS_RIBBON_CUT);
    pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1));
    strTemp.LoadString(IDS_RIBBON_COPY);
    pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_COPY, strTemp, 2));

    // Create "Filter" panel:
    CMFCRibbonPanel* pPanelFilter = pCategoryHome->AddPanel(_T("Filter"));
    pPanelFilter->Add(new CMFCRibbonButton(ID_EDIT_SHOW_ALL, _T("Show All\ns"), 16));
    pPanelFilter->AddSeparator();
    pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_ORPHANS, _T("Show Orphans\no")));
    pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_NOT_MATCHING, _T("Show Differences\nd")));
    pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_MATCHING, _T("Show Matching\nm")));

    CMFCRibbonPanel* pPanelSelection = pCategoryHome->AddPanel(_T("Selection"));
    strTemp.LoadString(IDS_RIBBON_SELECTALL);
    pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, 21));
    pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_CLEARALL, _T("Clear All\na"), 22));
    pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_EXPANDALL, _T("Expand All"), 23));
    pPanelSelection->AddSeparator();
    pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_ADDTOREP, _T("Migrate\nm"), 14));

    CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(_T("View"));
    pPanelView->Add(new CMFCRibbonCheckBox(ID_VIEW_CRLF, _T("CR/LF")));
    pPanelView->Add(new CMFCRibbonCheckBox(ID_VIEW_WHITESPACE, _T("Whitespace")));

    CMFCRibbonPanel* pPanelDiferences = pCategoryHome->AddPanel(_T("Differences"));
    pPanelDiferences->Add(new CMFCRibbonButton(ID_DIFFERENCES_PREVIOUS, _T("Previous\nn")));
    pPanelDiferences->Add(new CMFCRibbonButton(ID_DIFFERENCES_NEXT, _T("Next\np")));

    CMFCRibbonPanel* pPanelDependees = pCategoryHome->AddPanel(_T("Dependees"));
    pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_FINDSERVICES, _T("Find Services")));
    pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_CALCULATEDEPENDENCIES, _T("Recalculate Cache")));
    pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_CALCULATECROSSREFERENCE, _T("Calculate Crossreference")));
    pPanelDependees->AddSeparator();
    pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_SYNCFROMSELECTION, _T("Sync From Selection")));
    pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_SYNCTOSELECTION, _T("Sync To Selection")));
    pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_COPYCROSSREFERENCE, _T("Copy Crossreference")));

    CMFCRibbonPanel* pPanelAdvanced = pCategoryHome->AddPanel(_T("Advanced"));
    pPanelAdvanced->Add(new CMFCRibbonCheckBox(ID_EDIT_MODULE_CHECKSUM, _T("Module Checksums\nu")));

    // Add elements to the right side of tabs:
    strTemp.LoadString(IDS_RIBBON_STYLE);
    CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1);

    pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* No default command */, TRUE /* Right align */);

    strTemp.LoadString(IDS_RIBBON_STYLE_TIP);
    pVisualStyleButton->SetToolTipText(strTemp);
    strTemp.LoadString(IDS_RIBBON_STYLE_DESC);
    pVisualStyleButton->SetDescription(strTemp);
    m_wndRibbonBar.AddToTabs(pVisualStyleButton);

    // Add quick access toolbar commands:
    CList<UINT, UINT> lstQATCmds;

    lstQATCmds.AddTail(ID_EDIT_REFRESH);
    lstQATCmds.AddTail(ID_FILE_LOGOUT);
    lstQATCmds.AddTail(ID_FILE_PRINT);

    m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);
    m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon(0)));
}
예제 #4
0
void CTinyCADMainFrame::InitializeRibbon()
{
	BOOL bNameValid;

	CString strTemp;
	bNameValid = strTemp.LoadString(IDS_RIBBON_FILE);
	ASSERT(bNameValid);

	// 加载面板图像:
	m_PanelImages.SetImageSize(CSize(16, 16));
	m_PanelImages.Load(IDB_BUTTONS);

	// 初始主按钮:
	m_MainButton.SetImage(IDB_MAIN);
	m_MainButton.SetText(_T("\nf"));
	m_MainButton.SetToolTipText(strTemp);

	m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_FILESMALL, IDB_FILELARGE);

	bNameValid = strTemp.LoadString(IDS_RIBBON_NEW);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_NEW, strTemp, 0, 0));
	bNameValid = strTemp.LoadString(IDS_RIBBON_OPEN);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_OPEN, strTemp, 1, 1));
	bNameValid = strTemp.LoadString(IDS_RIBBON_SAVE);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SAVE, strTemp, 2, 2));
	bNameValid = strTemp.LoadString(IDS_RIBBON_SAVEAS);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SAVE_AS, strTemp, 3, 3));

	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6);
	pBtnPrint->SetKeys(_T("p"), _T("w"));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_LABEL);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_QUICK);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_DIRECT, strTemp, 7, 7, TRUE));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_PREVIEW);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, strTemp, 8, 8, TRUE));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_SETUP);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE));
	pMainPanel->Add(pBtnPrint);
	pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

	bNameValid = strTemp.LoadString(IDS_RIBBON_CLOSE);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9));

	bNameValid = strTemp.LoadString(IDS_RIBBON_RECENT_DOCS);
	ASSERT(bNameValid);
	pMainPanel->AddRecentFilesList(strTemp);

	bNameValid = strTemp.LoadString(IDS_RIBBON_EXIT);
	ASSERT(bNameValid);
	pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15));

	// 为“剪贴板”面板添加“主”类别:
	bNameValid = strTemp.LoadString(IDS_RIBBON_HOME);
	ASSERT(bNameValid);
	CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_WRITESMALL, IDB_WRITELARGE);

	// 创建“剪贴板”面板:
	bNameValid = strTemp.LoadString(IDS_RIBBON_CLIPBOARD);
	ASSERT(bNameValid);
	CMFCRibbonPanel* pPanelClipboard = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27));

	bNameValid = strTemp.LoadString(IDS_RIBBON_PASTE);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, strTemp, 0, 0);
	pPanelClipboard->Add(pBtnPaste);

	bNameValid = strTemp.LoadString(IDS_RIBBON_CUT);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1));
	bNameValid = strTemp.LoadString(IDS_RIBBON_COPY);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_COPY, strTemp, 2));
	bNameValid = strTemp.LoadString(IDS_RIBBON_SELECTALL);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, -1));

	bNameValid = strTemp.LoadString(IDS_RIBBON_INSERT_OBJECT);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_OLE_INSERT_NEW, strTemp, -1));

	// 创建和添加“视图”面板:
	bNameValid = strTemp.LoadString(IDS_RIBBON_VIEW);
	ASSERT(bNameValid);
	CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon (7));

	bNameValid = strTemp.LoadString(IDS_RIBBON_STATUSBAR);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnStatusBar = new CMFCRibbonCheckBox(ID_VIEW_STATUS_BAR, strTemp);
	pPanelView->Add(pBtnStatusBar);

	// 创建和添加“窗口”面板:
	bNameValid = strTemp.LoadString(IDS_RIBBON_WINDOW);
	ASSERT(bNameValid);
	CMFCRibbonPanel* pPanelWindow = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon (7));

	bNameValid = strTemp.LoadString(IDS_RIBBON_WINDOWS);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnWindows = new CMFCRibbonButton(ID_WINDOW_MANAGER, strTemp, -1, 1);
	pBtnWindows->SetMenu(IDR_WINDOWS_MENU, TRUE);
	pPanelWindow->Add(pBtnWindows);

	// 将元素添加到选项卡右侧:
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE);
	ASSERT(bNameValid);
	CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1);

	pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* 无默认命令*/, TRUE /* 右对齐*/);

	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_TIP);
	ASSERT(bNameValid);
	pVisualStyleButton->SetToolTipText(strTemp);
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_DESC);
	ASSERT(bNameValid);
	pVisualStyleButton->SetDescription(strTemp);
	m_wndRibbonBar.AddToTabs(pVisualStyleButton);

	// 添加快速访问工具栏命令:
	CList<UINT, UINT> lstQATCmds;

	lstQATCmds.AddTail(ID_FILE_NEW);
	lstQATCmds.AddTail(ID_FILE_OPEN);
	lstQATCmds.AddTail(ID_FILE_SAVE);
	lstQATCmds.AddTail(ID_FILE_PRINT_DIRECT);

	m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);

	CMFCRibbonButton* pHelpButton = new CMFCRibbonButton(ID_HELP_FINDER, _T("\na"), m_PanelImages.ExtractIcon (0));
	pHelpButton->SetMenu(IDR_HELP_MENU, ID_HELP_FINDER, TRUE /* 右对齐*/);
	m_wndRibbonBar.AddToTabs(pHelpButton);
}
예제 #5
0
void CMainFrame::InitializeRibbon()
{
	BOOL bNameValid;

	CString strTemp;

	// 加载面板图像:
	m_PanelImages.SetImageSize(CSize(16, 16));
	m_PanelImages.Load(IDB_BUTTONS);

	// 初始主按钮:
	strTemp="系统";
	m_MainButton.SetImage(IDB_MAIN);
	m_MainButton.SetText(_T("\nf"));
	m_MainButton.SetToolTipText(strTemp);

	m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_SYSTEMSMALL, IDB_SYSTEMLARGE);

	//bNameValid = strTemp.LoadString(IDS_RIBBON_FIND_CAMERA);
	//ASSERT(bNameValid);
	//pMainPanel->Add(new CMFCRibbonButton(ID_FIND_CAMERA, strTemp, 0, 0));
	//pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

	bNameValid = strTemp.LoadString(IDS_RIBBON_EXIT);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_APP_EXIT, strTemp, 0, 0)); //CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp,1,1));


	strTemp = "系统";//Page1
	CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_MONITOR_SMALL, IDB_MONITOR_LARGE);

	strTemp = "监控窗口"; //page1->pan1
	CMFCRibbonPanel* pPanelVV = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27));
	pPanelVV->SetJustifyColumns();

	strTemp = "单窗";	 //page1-Pan1-btn
	CMFCRibbonButton* pBtnVV1 = new CMFCRibbonButton(ID_VV1, strTemp, 0, 0);
	pPanelVV->Add(pBtnVV1);

	strTemp = "4窗";//page1-Pan1-btn
	CMFCRibbonButton* pBtnVV4 = new CMFCRibbonButton(ID_VV4, strTemp, 1);
	pPanelVV->Add(pBtnVV4);
	strTemp = "6窗";//page1-Pan1-btn
	CMFCRibbonButton* pBtnVV6 = new CMFCRibbonButton(ID_VV6, strTemp, 2);
	pPanelVV->Add(pBtnVV6);
	strTemp = "8窗";
	CMFCRibbonButton* pBtnVV8 = new CMFCRibbonButton(ID_VV8, strTemp, 3);
	pPanelVV->Add(pBtnVV8);
	strTemp = "9窗";
	CMFCRibbonButton* pBtnVV9 = new CMFCRibbonButton(ID_VV9, strTemp, 4);
	pPanelVV->Add(pBtnVV9);

	strTemp = "16窗";
	CMFCRibbonButton* pBtnVV16 = new CMFCRibbonButton(ID_VV16, strTemp, 5);
	pPanelVV->Add(pBtnVV16);
	strTemp = "25窗";
	CMFCRibbonButton* pBtnVV25 = new CMFCRibbonButton(ID_VV25, strTemp, 6);
	pPanelVV->Add(pBtnVV25);

	//bNameValid = strTemp.LoadString(IDS_RIBBON_SELECTALL);
	//ASSERT(bNameValid);
	//pPanelVV->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, -1));

	// 创建和添加“视图”面板: ////page1-Pan2-btn
	bNameValid = strTemp.LoadString(IDS_RIBBON_VIEW);
	ASSERT(bNameValid);
	CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon (7));

	bNameValid = strTemp.LoadString(IDS_RIBBON_STATUSBAR);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnStatusBar = new CMFCRibbonCheckBox(ID_VIEW_STATUS_BAR, strTemp);
	pPanelView->Add(pBtnStatusBar);


	// 创建和添加“系统配置”面板: ////page1-Pan3-btn
	strTemp = "配置与管理";
	CMFCRibbonPanel* pPanelCfgAndMgr = pCategoryHome->AddPanel(strTemp);
	
	strTemp = "配置";
	CMFCRibbonButton* pBtnSysCfg = new CMFCRibbonButton(ID_SYSTEM_CONFIG, strTemp,-1,1);
	pPanelCfgAndMgr->Add(pBtnSysCfg);

	// 创建和添加“任务管理”面板: ////page1-Pan4-btn
	strTemp = "任务";
	//CMFCRibbonPanel* pPanelTaskMgr = pCategoryHome->AddPanel(strTemp);
	//strTemp = "";
	CMFCRibbonButton* pBtnTaskMgr = new CMFCRibbonButton(ID_TASK_MGR, strTemp,-1,2);
	pPanelCfgAndMgr->Add(pBtnTaskMgr);


	// 创建和添加“告警管理”面板: ////page1-Pan5-btn
	strTemp = "告警";
	//CMFCRibbonPanel* pPanelAlertMgr = pCategoryHome->AddPanel(strTemp);
	//strTemp = "";
	CMFCRibbonButton* pBtnAlertCfg = new CMFCRibbonButton(ID_WARNING_MGR, strTemp,-1,3);
	pPanelCfgAndMgr->Add(pBtnAlertCfg);

	// 创建和添加“用户管理”面板: ////page1-Pan5-btn
	strTemp = "用户";
	//CMFCRibbonPanel* pPanelUserMgr = pCategoryHome->AddPanel(strTemp);
	//strTemp = "";
	CMFCRibbonButton* pBtnUser = new CMFCRibbonButton(ID_USER_MGR, strTemp,-1,4);
	pPanelCfgAndMgr->Add(pBtnUser);


	// 将元素添加到选项卡右侧:
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE);
	ASSERT(bNameValid);
	CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1);

	pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* 无默认命令*/, TRUE /* 右对齐*/);

	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_TIP);
	ASSERT(bNameValid);
	pVisualStyleButton->SetToolTipText(strTemp);
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_DESC);
	ASSERT(bNameValid);
	pVisualStyleButton->SetDescription(strTemp);
	m_wndRibbonBar.AddToTabs(pVisualStyleButton);

	// 添加快速访问工具栏命令:
	CList<UINT, UINT> lstQATCmds;

	//lstQATCmds.AddTail(ID_FIND_CAMERA);

	m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);

	m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (0)));
}
예제 #6
0
void CMyRibbonBar::InitializeRibbon()
{
	BOOL bNameValid;

	CString strTemp;
	bNameValid = strTemp.LoadString(IDS_RIBBON_FILE);
	ASSERT(bNameValid);

	// Load panel images:
	m_PanelImages.SetImageSize(CSize(16, 16));
	m_PanelImages.Load(IDB_BUTTONS);

	// Init main button:
	m_MainButton.SetImage(IDB_MAIN);
	m_MainButton.SetText(_T("\nf"));
	m_MainButton.SetToolTipText(strTemp);

	SetApplicationButton(&m_MainButton, CSize (45, 45));
	CMFCRibbonMainPanel* pMainPanel = AddMainCategory(strTemp, IDB_FILESMALL, IDB_FILELARGE);

	bNameValid = strTemp.LoadString(IDS_RIBBON_NEW);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(WM_OPEN_TEST_FILE, _T("Open.."), 1, 1));
	pMainPanel->Add(new CMFCRibbonButton(WM_OPEN_TEST_SUITE, _T("Open Suite.."), 1, 1));


	bNameValid = strTemp.LoadString(IDS_RIBBON_SAVEAS);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(WM_EXPORT_IMAGE, strTemp, 3, 3));

	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6);
	pBtnPrint->SetKeys(_T("p"), _T("w"));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_LABEL);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_QUICK);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_DIRECT, strTemp, 7, 7, TRUE));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_PREVIEW);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, strTemp, 8, 8, TRUE));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_SETUP);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonSeparator(TRUE));
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE));
	pMainPanel->Add(pBtnPrint);
	pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

	/*
	bNameValid = strTemp.LoadString(IDS_RIBBON_CLOSE);
		ASSERT(bNameValid);
		pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9));*/
	

	bNameValid = strTemp.LoadString(IDS_RIBBON_RECENT_DOCS);
	ASSERT(bNameValid);
	pMainPanel->AddRecentFilesList(strTemp);

	bNameValid = strTemp.LoadString(IDS_RIBBON_EXIT);
	ASSERT(bNameValid);
	pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15));

	
	addTabHome();
	addTabAnalyze();
	addTabCompare();
//	addTabExport();
	addTabAddins();
	addChartTools();
	ShowContextCategories(IDB_CHART);
	ActivateContextCategory(IDB_CHART);

	addTabSupport();


	// Add elements to the right side of tabs:
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE);
	ASSERT(bNameValid);
	CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1);

	pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* No default command */, TRUE /* Right align */);

	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_TIP);
	ASSERT(bNameValid);
	pVisualStyleButton->SetToolTipText(strTemp);
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_DESC);
	ASSERT(bNameValid);
	pVisualStyleButton->SetDescription(strTemp);
	AddToTabs(pVisualStyleButton);

	// Add quick access toolbar commands:
	CList<UINT, UINT> lstQATCmds;

	lstQATCmds.AddTail(ID_FILE_NEW);
	lstQATCmds.AddTail(ID_FILE_OPEN);
	lstQATCmds.AddTail(ID_FILE_SAVE);
	lstQATCmds.AddTail(ID_FILE_PRINT_DIRECT);

	SetQuickAccessCommands(lstQATCmds);
	AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (0)));
}
예제 #7
0
void CMyRibbonBar::addTabAnalyze()
{
	CMFCRibbonCategory* pCategory = AddCategory(_T("Analyze"), IDB_ANALYZE16, IDB_ANALYZE);

	CMFCRibbonPanel* pPanel = pCategory->AddPanel(_T("Selection"), m_PanelImages.ExtractIcon(13));

	pPanel->Add(new CMFCRibbonLabel(_T("Set Focus :")));
	CMFCRibbonComboBox* pSelectionCB = new CMFCRibbonComboBox(WM_ANALYSIS_TEST_SELECT, TRUE, -1,_T("Select Test"),0);
	/*
	pSelectionCB->AddItem(_T("Test1"),0);
		pSelectionCB->AddItem(_T("Test2"));
		pSelectionCB->SelectItem(0);*/
	
	pPanel->Add(pSelectionCB);

	pSelectionCB = new CMFCRibbonComboBox(WM_ANALYSIS_ITEM_SELECT, TRUE, -1,_T("Select Item"),7);
	/*
	pSelectionCB->AddItem(_T("ActivityA"),0);
		pSelectionCB->AddItem(_T("Task T1"));
		pSelectionCB->SelectItem(0);*/
	
	pPanel->Add(pSelectionCB);

	pPanel->SetJustifyColumns();

	//
	pPanel = pCategory->AddPanel(_T("Single Activity"), m_PanelImages.ExtractIcon(18));

	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEACTIVITY_TIMELINE, _T("TimeLines"), -1, 0));
	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEACTIVITY_STAGES, _T("Clustered stages"), -1, 2));
	//pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEACTIVITY_TOTALTIME, _T("Total Times"), -1, 0));
		//send to compare.
	
	pPanel->AddSeparator();
	pPanel->Add(new CMFCRibbonLabel(_T("Select Task :")));
	pSelectionCB = new CMFCRibbonComboBox(WM_ANALYSIS_SINGLEACTIVITY_CB_TASKSEL, TRUE, -1,_T("Task :"),3);
	pPanel->Add(pSelectionCB);

	CMFCRibbonButton* pBtn = new CMFCRibbonButton(WM_ANALYSIS_SINGLEACTIVITY_WITHTASK_STACKED, _T("Stacked"), 0, 1);
	pBtn->SetMenu(IDR_MENU_RIBBON_ACTIVITY1, TRUE);
	pPanel->Add(pBtn);

	pBtn = new CMFCRibbonButton(WM_ANALYSIS_SINGLEACTIVITY_WITHTASK_TOTAL, _T("Total Times"), 0, 4);
	pBtn->SetMenu(IDR_MENU_RIBBON_ACTIVITY2, TRUE);
	pPanel->Add(pBtn);

	//
	pPanel->AddSeparator();
	pPanel->Add(new CMFCRibbonLabel(_T("Select Worker :")));
	pSelectionCB = new CMFCRibbonComboBox(WM_ANALYSIS_SINGLEACTIVITY_CB_WORKERSEL, TRUE, -1,_T("Thread :"),1);
/*
	pSelectionCB->AddItem(_T("Worker T0"),0);
	pSelectionCB->AddItem(_T("Thread T1"));
	pSelectionCB->SelectItem(0);*/

	pPanel->Add(pSelectionCB);
	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEACTIVITY_WITHWORKER_TOTALTIME, _T("Time Total"), 0, 5));

	pPanel = pCategory->AddPanel(_T("All Activities"), m_PanelImages.ExtractIcon(18));

	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_ALLACTIVITIES_TOTAL, _T("Total time"), 0, 3));


	pPanel = pCategory->AddPanel(_T("Single Task"), m_PanelImages.ExtractIcon(27));

	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLETASK_RUNSHISTORY, _T("Runs History"), 0, 6));
	//pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLETASK_TOTAL, _T("Total Time"), 0, 0));
		//send to compare.

	pPanel = pCategory->AddPanel(_T("All Tasks"), m_PanelImages.ExtractIcon(19));

	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_ALLTASKS_TOTAL, _T("Total Time"), 0, 10));
			//add average time ?



	pPanel = pCategory->AddPanel(_T("Worker"), m_PanelImages.ExtractIcon(17));

	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEWORKER_RUNPAUSE, _T("Run|Pause Time"), 0, 12));
	pPanel->AddSeparator();

	pPanel->Add(new CMFCRibbonLabel(_T("Select Task :")));
	pSelectionCB = new CMFCRibbonComboBox(WM_ANALYSIS_SINGLEWORKER_CB_SELTASK, TRUE, -1,_T("Task :"),3);
	/*
	pSelectionCB->AddItem(_T("Task T0"),0);
		pSelectionCB->AddItem(_T("Task T1"));
		pSelectionCB->SelectItem(0);*/
	
	pPanel->Add(pSelectionCB);
	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEWORKER_WITHTASK_MULTIPLESTACKED, _T("Multiple Stacked"), 0, 13));
	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_SINGLEWORKER_WITHTASK_TIMETOTAL, _T("Time Total"), 0, 14));

	pPanel = pCategory->AddPanel(_T("All Workers"), m_PanelImages.ExtractIcon(27));
	pPanel->Add(new CMFCRibbonButton(WM_ANALYSIS_ALLWORKERS_TOTAL, _T("Total Times"), 0, 11));


	/*
pPanel = pCategory->AddPanel(_T("Tasks and activity"), m_PanelImages.ExtractIcon(27));

	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Task Stacked"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Task Pie"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Tasks Stacked"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Tasks Pie"), 0, 0));

	pPanel = pCategory->AddPanel(_T("Tasks and thread"), m_PanelImages.ExtractIcon(27));

	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Task Stacked"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Task Pie"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Tasks Stacked"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("Tasks Pie"), 0, 0));

	pPanel = pCategory->AddPanel(_T("Threads and activity"), m_PanelImages.ExtractIcon(27));

	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("All Threads Column"), 0, 0));
	pPanel->Add(new CMFCRibbonButton(ID_EDIT_PASTE, _T("all Threads Vs Activity Time two columns"), 0, 0));
*/


}
예제 #8
0
BOOL CMainFrame::CreateRibbonBar ()
{
	if (!m_wndRibbonBar.Create(this))
	{
		return FALSE;
	}

	// Load panel images:
	m_PanelImages.SetImageSize (CSize (16, 16));
	m_PanelImages.Load (IDB_RIBBON_ICONS);

	if (!m_wndRibbonBar.LoadFromResource(IDR_RIBBON))
	{
		// Add main panel:
		Add_MainPanel ();

		Add_Category1 ();
		Add_Category2 ();
		Add_Category3 ();
		Add_Category4 ();
		Add_Category5 ();
		Add_Category6 ();

		// Add quick access toolbar commands:
		Add_QAT ();

		// Add "Style" button to the right of tabs:
		CMFCRibbonButton* pStyleButton = new CMFCRibbonButton ((UINT)-1, _T("Style\ns"), -1, -1);
		pStyleButton->SetMenu (IDR_THEME_MENU, TRUE /* Right align */);
		m_wndRibbonBar.AddToTabs (pStyleButton);

		// Add "About" button to the right of tabs:
		m_wndRibbonBar.AddToTabs (new CMFCRibbonButton (ID_APP_ABOUT, _T("About\na"), m_PanelImages.ExtractIcon (0)));
	}
	else
	{
		// Attach related source code to the panels
		for (int nCategory = 0; nCategory < m_wndRibbonBar.GetCategoryCount(); nCategory++)
		{
			CMFCRibbonCategory* pCategory = m_wndRibbonBar.GetCategory(nCategory);
			CString strCategory = pCategory->GetName();
			if (strCategory == _T("Buttons"))
			{
				for (int nPanel = 0; nPanel < pCategory->GetPanelCount(); nPanel++)
				{
					CMFCRibbonPanel* pPanel = pCategory->GetPanel(nPanel);
					pPanel->SetData(ID_RIBBON_SOURCE_CODE_1_1 + nPanel);
				}
			}
			else if (strCategory == _T("Palette Buttons"))
			{
				for (int nPanel = 0; nPanel < pCategory->GetPanelCount(); nPanel++)
				{
					CMFCRibbonPanel* pPanel = pCategory->GetPanel(nPanel);
					pPanel->SetData(ID_RIBBON_SOURCE_CODE_2_1 + nPanel);
				}
			}
			else if (strCategory == _T("Color Buttons"))
			{
				for (int nPanel = 0; nPanel < pCategory->GetPanelCount(); nPanel++)
				{
					CMFCRibbonPanel* pPanel = pCategory->GetPanel(nPanel);
					pPanel->SetData(ID_RIBBON_SOURCE_CODE_3_1 + nPanel);
				}
			}
			else if (strCategory == _T("Groups"))
			{
				for (int nPanel = 0; nPanel < pCategory->GetPanelCount(); nPanel++)
				{
					CMFCRibbonPanel* pPanel = pCategory->GetPanel(nPanel);
					pPanel->SetData(ID_RIBBON_SOURCE_CODE_4_1 + nPanel);
				}
			}
			else if (strCategory == _T("Edit and Combo"))
			{
				for (int nPanel = 0; nPanel < pCategory->GetPanelCount(); nPanel++)
				{
					CMFCRibbonPanel* pPanel = pCategory->GetPanel(nPanel);
					pPanel->SetData(ID_RIBBON_SOURCE_CODE_5_1 + nPanel);
				}
			}
			else if (strCategory == _T("Other"))
			{
				for (int nPanel = 0; nPanel < pCategory->GetPanelCount(); nPanel++)
				{
					CMFCRibbonPanel* pPanel = pCategory->GetPanel(nPanel);
					pPanel->SetData(ID_RIBBON_SOURCE_CODE_6_1 + nPanel);
				}
			}
		}
	}

	return TRUE;
}
예제 #9
0
void CMainFrame::InitializeRibbon()
{
	BOOL bNameValid;

	CString strTemp;
	bNameValid = strTemp.LoadString(IDS_RIBBON_FILE);
	ASSERT(bNameValid);

	// 창 이미지를 로드합니다.
	m_PanelImages.SetImageSize(CSize(16, 16));
	m_PanelImages.Load(IDB_BUTTONS);

	// 초기화 주 단추입니다.
	m_MainButton.SetImage(IDB_MAIN);
	m_MainButton.SetText(_T("\nf"));
	m_MainButton.SetToolTipText(strTemp);

	m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_FILESMALL, IDB_FILELARGE);

	bNameValid = strTemp.LoadString(IDS_RIBBON_NEW);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_NEW, strTemp, 0, 0));
	bNameValid = strTemp.LoadString(IDS_RIBBON_OPEN);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_OPEN, strTemp, 1, 1));
	bNameValid = strTemp.LoadString(IDS_RIBBON_SAVE);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SAVE, strTemp, 2, 2));
	bNameValid = strTemp.LoadString(IDS_RIBBON_SAVEAS);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SAVE_AS, strTemp, 3, 3));

	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6);
	pBtnPrint->SetKeys(_T("p"), _T("w"));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_LABEL);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_QUICK);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_DIRECT, strTemp, 7, 7, TRUE));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_PREVIEW);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, strTemp, 8, 8, TRUE));
	bNameValid = strTemp.LoadString(IDS_RIBBON_PRINT_SETUP);
	ASSERT(bNameValid);
	pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE));
	pMainPanel->Add(pBtnPrint);
	pMainPanel->Add(new CMFCRibbonSeparator(TRUE));

	bNameValid = strTemp.LoadString(IDS_RIBBON_CLOSE);
	ASSERT(bNameValid);
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9));

	bNameValid = strTemp.LoadString(IDS_RIBBON_RECENT_DOCS);
	ASSERT(bNameValid);
	pMainPanel->AddRecentFilesList(strTemp);

	bNameValid = strTemp.LoadString(IDS_RIBBON_EXIT);
	ASSERT(bNameValid);
	pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15));

	// "클립보드" 패널을 사용하여 "홈" 범주를 추가합니다.
	bNameValid = strTemp.LoadString(IDS_RIBBON_HOME);
	ASSERT(bNameValid);
	CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_WRITESMALL, IDB_WRITELARGE);

	// "클립보드" 패널을 만듭니다.
	bNameValid = strTemp.LoadString(IDS_RIBBON_CLIPBOARD);
	ASSERT(bNameValid);
	CMFCRibbonPanel* pPanelClipboard = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27));

	bNameValid = strTemp.LoadString(IDS_RIBBON_PASTE);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, strTemp, 0, 0);
	pPanelClipboard->Add(pBtnPaste);

	bNameValid = strTemp.LoadString(IDS_RIBBON_CUT);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1));
	bNameValid = strTemp.LoadString(IDS_RIBBON_COPY);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_COPY, strTemp, 2));
	bNameValid = strTemp.LoadString(IDS_RIBBON_SELECTALL);
	ASSERT(bNameValid);
	pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, -1));

	// "보기" 패널을 만들고 추가합니다.
	bNameValid = strTemp.LoadString(IDS_RIBBON_VIEW);
	ASSERT(bNameValid);
	CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon (7));

	bNameValid = strTemp.LoadString(IDS_RIBBON_STATUSBAR);
	ASSERT(bNameValid);
	CMFCRibbonButton* pBtnStatusBar = new CMFCRibbonCheckBox(ID_VIEW_STATUS_BAR, strTemp);
	pPanelView->Add(pBtnStatusBar);

	// 탭의 오른쪽에 요소를 추가합니다.
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE);
	ASSERT(bNameValid);
	CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1);

	pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* 기본값 없음 명령입니다. */, TRUE /* 오른쪽 맞춤입니다. */);

	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_TIP);
	ASSERT(bNameValid);
	pVisualStyleButton->SetToolTipText(strTemp);
	bNameValid = strTemp.LoadString(IDS_RIBBON_STYLE_DESC);
	ASSERT(bNameValid);
	pVisualStyleButton->SetDescription(strTemp);
	m_wndRibbonBar.AddToTabs(pVisualStyleButton);

	// 빠른 실행 도구 모음 명령을 추가합니다.
	CList<UINT, UINT> lstQATCmds;

	lstQATCmds.AddTail(ID_FILE_NEW);
	lstQATCmds.AddTail(ID_FILE_OPEN);
	lstQATCmds.AddTail(ID_FILE_SAVE);
	lstQATCmds.AddTail(ID_FILE_PRINT_DIRECT);

	m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);

	m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (0)));
}
예제 #10
0
void CMainFrame::InitRibbon ()
{
	//-------------------
	// Load panel images:
	//-------------------
	m_PanelImages.SetImageSize (CSize (16, 16));
	m_PanelImages.Load (IDB_BUTTONS);

	//------------------
	// Init main button:
	//------------------
	m_MainButton.SetImage (IDB_MAIN);
	m_MainButton.SetText (_T("\nf"));
	m_MainButton.SetToolTipText (_T("File"));

	m_wndRibbonBar.SetApplicationButton (&m_MainButton, CSize (45, 45));

	m_wndRibbonBar.SetApplicationButton (&m_MainButton, CSize (45, 45));

	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory (
		_T("File"), IDB_FILESMALL, IDB_FILELARGE);

	pMainPanel->Add (new CMFCRibbonButton (ID_FILE_NEW, _T("&New"), 0, 0));
	pMainPanel->Add (new CMFCRibbonButton (ID_FILE_OPEN, _T("&Open..."), 1, 1));

	pMainPanel->Add (new CMFCRibbonButton (ID_FILE_SAVE, _T("&Save"), 2, 2));

	pMainPanel->Add (new CMFCRibbonButton (ID_FILE_SAVE_AS, _T("Save &As..."), 3, 3));

	std::auto_ptr<CMFCRibbonButton> apBtnPrint(new CMFCRibbonButton (ID_FILE_PRINT, _T("Print"), 6, 6));
	apBtnPrint->SetKeys (_T("p"), _T("w"));

	apBtnPrint->AddSubItem (new CMFCRibbonLabel (_T("Preview and print the document")));
	apBtnPrint->AddSubItem (new CMFCRibbonButton (ID_FILE_PRINT_DIRECT, _T("&Quick Print"), 7, 7, TRUE));
	apBtnPrint->AddSubItem (new CMFCRibbonButton (ID_FILE_PRINT_PREVIEW, _T("Print Pre&view"), 8, 8, TRUE));

	pMainPanel->Add (apBtnPrint.release());

	pMainPanel->Add (new CMFCRibbonSeparator (TRUE));
	pMainPanel->Add (new CMFCRibbonButton (ID_FILE_CLOSE, _T("&Close"), 9, 9));

	pMainPanel->AddRecentFilesList (_T("Recent Documents"));

	pMainPanel->AddToBottom (new CMFCRibbonMainPanelButton (ID_APP_EXIT, _T("E&xit"), 15));

	//--------------------------------------------
	// Add "Home" category with "Clipboard" panel:
	//--------------------------------------------
	CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddCategory (
		_T("&Home"),
		IDB_WRITE,
		IDB_WRITELARGE);

	//--------------------------
	// Create "Clipboard" panel:
	//--------------------------
	CMFCRibbonPanel* pPanelClipboard = pCategory->AddPanel (
		_T("Clipboard\nd"), 
		m_PanelImages.ExtractIcon (27));

	CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton (ID_EDIT_PASTE, _T("Paste\nv"), 0, 0);
	pBtnPaste->SetMenu (IDR_PASTE_MENU, TRUE);
	pPanelClipboard->Add (pBtnPaste);

	pPanelClipboard->Add (new CMFCRibbonButton (ID_EDIT_CUT, _T("Cut\nx"), 1));
	pPanelClipboard->Add (new CMFCRibbonButton (ID_EDIT_COPY, _T("Copy\nc"), 2));
	pPanelClipboard->Add (new CMFCRibbonButton (0, _T("Paint\np"), 3));

	//-----------------------
	// Create "Window" panel:
	//-----------------------
	CMFCRibbonPanel* pPanelWindow = pCategory->AddPanel (
		_T("Window\nw"), 
		m_PanelImages.ExtractIcon (7));

	pPanelWindow->Add (new CMFCRibbonCheckBox (ID_VIEW_WORKSPACE, _T("View 1\n1")));
	pPanelWindow->Add (new CMFCRibbonCheckBox (ID_VIEW_WORKSPACE2, _T("View 2\n2")));
	pPanelWindow->Add (new CMFCRibbonCheckBox (ID_VIEW_OUTPUT, _T("Output\no")));
	pPanelWindow->Add (new CMFCRibbonSeparator);

	CMFCRibbonButton* pBtnWindows = new CMFCRibbonButton (0, _T("Windows\ni"), -1, 1);
	pBtnWindows->SetMenu (IDR_WINDOWS_MENU, TRUE);
	pPanelWindow->Add (pBtnWindows);

	//-----------------------------------
	// Add quick access toolbar commands:
	//-----------------------------------
	CList<UINT, UINT> lstQATCmds;

	lstQATCmds.AddTail (ID_FILE_SAVE);
	lstQATCmds.AddTail (ID_FILE_PRINT_DIRECT);

	m_wndRibbonBar.SetQuickAccessCommands (lstQATCmds);

	m_wndRibbonBar.AddToTabs (new CMFCRibbonButton (ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (0)));
}