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))); }
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); }
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))); }
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))); }
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))); }