Пример #1
0
void CMainFrame::Add_MainPanel ()
{
	m_MainButton.SetImage (IDB_RIBBON_MAIN);
	m_MainButton.SetToolTipText (_T("File"));
	m_MainButton.SetText (_T("\nf"));

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

	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory (_T("File"), IDB_RIBBON_FILE_SMALL, IDB_RIBBON_FILE_LARGE);

	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"), 4, 4));

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

	apBtnPrint->SetKeys (_T("p"), _T("w"));

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

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

	pMainPanel->AddToBottom (new CMFCRibbonMainPanelButton (ID_TOOLS_OPTIONS, _T("Opt&ions"), 8));
	pMainPanel->AddToBottom (new CMFCRibbonMainPanelButton (ID_APP_EXIT, _T("E&xit"), 9));
}
Пример #2
0
void CMainFrame::InitMainButton()
{
	// <snippet5>
	m_MainButton.SetImage(IDB_RIBBON_MAIN);
	m_MainButton.SetToolTipText(_T("File"));
	// Set the short cut keyboard text.
	m_MainButton.SetText(_T("f"));
	// </snippet5>

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

	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(_T("File"), IDB_RIBBON_FILESMALL, IDB_RIBBON_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));

	CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, _T("&Print"), 4, 4);

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

	pBtnPrint->SetKeys(_T("p"), _T("w"));
	pMainPanel->Add(pBtnPrint);

	pMainPanel->AddSeparator();
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SEND_MAIL, _T("Sen&d..."), 8, 8));
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_SUMMARYINFO, _T("Summary &Info..."), 9, 9));

	pMainPanel->AddSeparator();
	pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, _T("&Close"), 5, 5));

	pMainPanel->AddRecentFilesList(_T("Recent Documents"));
	pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_TOOLS_OPTIONS, _T("Opt&ions"), 10));
	pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, _T("E&xit"), 11));
}
Пример #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()
{

	// 设置标题栏
	SetWindowText(_T("密码学盒子 - CryptCube"));

	// 初始主按钮:
	m_MainButton.SetImage(IDP_MAIN);
	m_MainButton.SetText(_T("\nf"));
	m_MainButton.SetToolTipText(_T("主菜单"));

	//主按钮对应的菜单
	m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));

	CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(_T(""), IDP_MENU, IDP_MENU,CSize (32, 32),CSize (32, 32));

	pMainPanel->Add(new CMFCRibbonButton(ID_WELCOME, _T("显示欢迎页"), -1, 0));
	pMainPanel->Add(new CMFCRibbonButton(ID_APP_ABOUT, _T("关于密码学盒子"), -1, 1));
	

	pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT,_T("退出盒子(&X)"), 5));


	// 加载右上方的帮助小按钮:
	m_PanelImages.SetImageSize(CSize(16, 16));
	m_PanelImages.Load(IDP_HELPSMALL);
	//m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_HELP, _T("\na"), m_PanelImages.ExtractIcon (0)));
	m_wndRibbonBar.AddToTabs(new CMFCRibbonButton(ID_APP_ABOUT, _T("\na"), m_PanelImages.ExtractIcon (0)));


	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//添加“算法原理”主类别:
	CMFCRibbonCategory* pCategoryPri= m_wndRibbonBar.AddCategory(_T("算法原理"),IDP_TOOLBAR3,IDP_TOOLBAR3,CSize (16, 16),CSize (48, 48));
	
	//添加“古典密码”小面板
	CMFCRibbonPanel* pPriClssic = pCategoryPri->AddPanel(_T("古典密码"));
	pPriClssic->Add(new CKofMFCRibbonButton(ID_CASA, _T("Casar"), -1, 0));
	pPriClssic->Add(new CKofMFCRibbonButton(ID_FSBH, _T("单表置换"), -1, 1));

	
	// 创建“分组密码”小面板:
	CMFCRibbonPanel* pPriBlock = pCategoryPri->AddPanel(_T("分组密码"));
	pPriBlock->Add(new CKofMFCRibbonButton(ID_DES, _T("DES"),-1,2));
	pPriBlock->Add(new CKofMFCRibbonButton(ID_AES, _T("AES"),-1,3));
	pPriBlock->Add(new CKofMFCRibbonButton(ID_IDEA, _T("IDEA"),-1,4));

	// 创建“流密码”小面板:
	CMFCRibbonPanel* pPriStream = pCategoryPri->AddPanel(_T("流密码"));
	pPriStream->Add(new CKofMFCRibbonButton(ID_RC4,_T("RC4"),-1,5));

	// 创建“公钥密码”小面板:
	CMFCRibbonPanel* pPriPublicKey = pCategoryPri->AddPanel(_T("公钥密码"));
	pPriPublicKey->Add(new CKofMFCRibbonButton(ID_RSA, _T("RSA"), -1, 6));
	pPriPublicKey->Add(new CKofMFCRibbonButton(ID_DIFFIE, _T("Diffie-Hellman") ,-1,7));
	pPriPublicKey->Add(new CKofMFCRibbonButton(ID_ELG, _T("ElGmal") ,-1,8));
	pPriPublicKey->Add(new CKofMFCRibbonButton(ID_ECC, _T("ECC") ,-1,9));
	

	// 创建“散列函数”小面板:
	CMFCRibbonPanel* pPriHash = pCategoryPri->AddPanel(_T("散列函数"));
	pPriHash->Add(new CKofMFCRibbonButton(ID_MD5, _T("MD5"),-1,10));
	pPriHash->Add(new CKofMFCRibbonButton(ID_SHA, _T("SHA"),-1,11));

	// 创建“数字签名”小面板:
	CMFCRibbonPanel* pPriSignature = pCategoryPri->AddPanel(_T("数字签名"));
	pPriSignature->Add(new CKofMFCRibbonButton(ID_DSA, _T("DSA"),-1,12));

	///////////////////////////////////////////////////////////////////////////////////////


	// 添加“动态演示”主类别:
	CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(_T("动态演示"),IDP_TOOLBAR,IDP_TOOLBAR,CSize (16, 16),CSize (48, 48));
	//CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(_T("动态演示"),IDP_BACKGROUND,IDP_TOOLBAR,CSize (16, 16),CSize (48, 48));
	

	// 创建“古典密码”小面板:
	CMFCRibbonPanel* pPanelClassic = pCategoryHome->AddPanel(_T("古典密码"));
	pPanelClassic->Add(new CKofMFCRibbonButton(ID_CLASSIC_KAISA, _T("凯撒密码"), -1, 0));
	pPanelClassic->Add(new CKofMFCRibbonButton(ID_CLASSIC_DAIHUAN, _T("单表置换"), -1, 1));

	// 创建“分组密码”小面板:
	CMFCRibbonPanel* pPanelBlock = pCategoryHome->AddPanel(_T("分组密码"));
	pPanelBlock->Add(new CKofMFCRibbonButton(ID_BLOCK_DES, _T("DES"),-1,2));
	pPanelBlock->Add(new CKofMFCRibbonButton(ID_BLOCK_AES, _T("AES"),-1,3));
	pPanelBlock->Add(new CKofMFCRibbonButton(ID_BLOCK_IDEA, _T("IDEA"),-1,4));

	// 创建“流密码”小面板:
	CMFCRibbonPanel* pPanelStream = pCategoryHome->AddPanel(_T("流密码"));
	pPanelStream->Add(new CKofMFCRibbonButton(ID_STREAM_RC4,_T("RC4"),-1,5));

	// 创建“公钥密码”小面板:
	CMFCRibbonPanel* pPanelPublicKey = pCategoryHome->AddPanel(_T("公钥密码"));
	pPanelPublicKey->Add(new CKofMFCRibbonButton(ID_PUBLICKEY_RSA, _T("RSA"), -1, 6));
	pPanelPublicKey->Add(new CKofMFCRibbonButton(ID_PUBLICKEY_DH, _T("Diffie-Hellman") ,-1,8));
	pPanelPublicKey->Add(new CKofMFCRibbonButton(ID_PUBLICKEY_ELGAMAL,_T("ElGamal") ,-1,7));
	pPanelPublicKey->Add(new CKofMFCRibbonButton(ID_PUBLICKEY_ECC, _T("ECC") ,0,9));

	// 创建“散列函数”小面板:
	CMFCRibbonPanel* pPanelHash = pCategoryHome->AddPanel(_T("散列函数"));
	pPanelHash->Add(new CKofMFCRibbonButton(ID_HASH_MD5, _T("MD5"),-1,10));
	pPanelHash->Add(new CKofMFCRibbonButton(ID_HASH_SHA, _T("SHA"),-1,11));

	// 创建“数字签名”小面板:
	CMFCRibbonPanel* pPanelSignature = pCategoryHome->AddPanel(_T("数字签名"));
	pPanelSignature->Add(new CKofMFCRibbonButton(ID_SIGNATURE_DSA, _T("DSA"),-1,12));



	////////////////////////////////////////////////////////////////////////////////////////////
	
	// 添加“习题测试”主类别:
	CMFCRibbonCategory* pCategoryTest = m_wndRibbonBar.AddCategory(_T("习题测试"),IDP_TOOLBARTEST,IDP_TOOLBARTEST,CSize (16, 16),CSize (48, 48));
	//pCategoryTest->Add(new CMFCRibbonButton(ID_WELCOME, _T("显示欢迎页"), -1, 0));
	CMFCRibbonPanel* pTestBlock = pCategoryTest->AddPanel(_T("分组密码"));
	pTestBlock->Add(new CKofMFCRibbonButton(ID_TEST_DES_AES, _T("DES-AES"),-1,0));

	CMFCRibbonPanel* pTestPublicKey =pCategoryTest->AddPanel(_T("公钥密码"));
	pTestPublicKey->Add(new CKofMFCRibbonButton(ID_TEST_DIFF, _T("Diffie-Hellman"),-1,1));

	CMFCRibbonPanel* pTestHash =pCategoryTest->AddPanel(_T("散列函数"));
	pTestHash->Add(new CKofMFCRibbonButton(ID_TEST_MD5, _T("MD5-SHA"),-1,2));
	pTestHash->Add(new CKofMFCRibbonButton(ID_TEST_HMAC, _T("HMAC"),-1,3));

	CMFCRibbonPanel* pTestSignature =pCategoryTest->AddPanel(_T("数字签名"));
	pTestSignature->Add(new CKofMFCRibbonButton(ID_TEST_RSA, _T("RSA-DSA"),-1,4));
	
	CMFCRibbonPanel* pTestSecure =pCategoryTest->AddPanel(_T("安全套接层协议"));
	pTestSecure->Add(new CKofMFCRibbonButton(ID_TEST_SSL, _T("SSL"),-1,5));



	///////////////////////////////////////////////////////////////////////////////////
	// 添加“密码学小工具”主类别:
	CMFCRibbonCategory* pCategoryTools = m_wndRibbonBar.AddCategory(_T("密码工具"), IDP_TOOLBAR2,  IDP_TOOLBAR2,CSize (48, 48),CSize (48, 48));
	//pCategoryTools->Add(new CMFCRibbonButton(ID_WELCOME, _T("显示欢迎页"), -1, 0));

	// 创建“密码学小工具”小面板:
	CMFCRibbonPanel* pPanelCalc = pCategoryTools->AddPanel(_T("辅助计算工具"));
	pPanelCalc->Add(new CKofMFCRibbonButton(ID_CODE_CALC, _T("数学知识计算"), -1, 1));
	pPanelCalc->Add(new CKofMFCRibbonButton(ID_CODE_RANDOM, _T("随机生成"), -1, 0));

	CMFCRibbonPanel* pPanelCrypt = pCategoryTools->AddPanel(_T("加密解密相关"));
	//pPanelCrypt->Add(new CKofMFCRibbonButton(ID_ENCRYPT_STRING, _T("文字加解密"), -1, 2));
	//pPanelCrypt->Add(new CKofMFCRibbonButton(ID_ENCRYPT_FILE, _T("文件加解密"), -1, 3));
	pPanelCrypt->Add(new CKofMFCRibbonButton(ID_CODE_HASH, _T("Hash校验"), -1, 2));

	CMFCRibbonPanel* pPanelCode = pCategoryTools->AddPanel(_T("编码转换相关"));
	pPanelCode->Add(new CKofMFCRibbonButton(ID_CODE_STRING, _T("字符编码"), -1, 3));
	//pPanelCode->Add(new CKofMFCRibbonButton(ID_CODE_BASE64, _T("Base64编码"), -1, 4));
	//pPanelCode->Add(new CKofMFCRibbonButton(ID_CODE_URL, _T("URL加解密"), -1, 4));
	//pPanelCode->Add(new CKofMFCRibbonButton(ID_CODE_COLOR, _T("颜色与按键代码"), -1, 5));
	pPanelCode->Add(new CKofMFCRibbonButton(ID_CODE_QR, _T("QRCode二维码"), -1, 4));

	


	/////////////////////////////////////////////////////////////////////////////////////////////
// 添加“密码术语”主类别:

	CMFCRibbonCategory* pCategoryTerm = m_wndRibbonBar.AddCategory(_T("密码术语"),IDP_TOOLBARTERM,IDP_TOOLBARTERM,CSize (48, 48),CSize (48, 48));
	// 创建“古典密码”小面板:
	CMFCRibbonPanel* pPanelTerm = pCategoryTerm->AddPanel(_T("密码术语"));
	pPanelTerm->Add(new CKofMFCRibbonButton(ID_TERM, _T(""), -1, 0));
	
/////////////////////////////////////////////////////////////////////////////////////

//添加“参考资料”类别
	CMFCRibbonCategory* pCategoryAccord = m_wndRibbonBar.AddCategory(_T("参考资料"),IDP_ACCORD,IDP_ACCORD,CSize (48, 48),CSize (48, 48));
	CMFCRibbonPanel* pPanelBook = pCategoryAccord->AddPanel(_T("参考分类"));
	pPanelBook->Add(new CKofMFCRibbonButton(ID_BOOK, _T("课程教材"), -1, 0));
	pPanelBook->Add(new CKofMFCRibbonButton(ID_EXCISE, _T("实践参考"), -1, 1));
	pPanelBook->Add(new CKofMFCRibbonButton(ID_THEORY, _T("理论参考"), -1, 2));
	pPanelBook->Add(new CKofMFCRibbonButton(ID_CLASS, _T("微课参考"), -1, 3));

//高级应用
	CMFCRibbonCategory* pCategoryHigh = m_wndRibbonBar.AddCategory(_T("高级应用"),IDP_HIGH1,IDP_HIGH1,CSize (48, 48),CSize (48, 48));
	CMFCRibbonPanel* pPanelGroup = pCategoryHigh->AddPanel(_T("分组密码典型应用"));
	pPanelGroup->Add(new CKofMFCRibbonButton(ID_HIGH_KER, _T("Kerberos"), -1, 0));

	CMFCRibbonPanel* pPanelPublic = pCategoryHigh->AddPanel(_T("公钥密码典型应用"));
	pPanelPublic->Add(new CKofMFCRibbonButton(ID_HIGH_PKI, _T("PKI"), -1, 1));
	pPanelPublic->Add(new CKofMFCRibbonButton(ID_HIGH_EFS, _T("EFS"), -1, 2));

	CMFCRibbonPanel* pPanelCom = pCategoryHigh->AddPanel(_T("综合应用"));
	pPanelCom->Add(new CKofMFCRibbonButton(ID_HIGH_SSL, _T("SSL"), -1, 3));
	pPanelCom->Add(new CKofMFCRibbonButton(ID_HIGH_OPEN, _T("Openssl"), -1, 4));
	pPanelCom->Add(new CKofMFCRibbonButton(ID_HIGH_PGP, _T("PGP"), -1, 5));
	
	CMFCRibbonPanel* pPanelFile = pCategoryHigh->AddPanel(_T("文件应用"));
	pPanelFile->Add(new CKofMFCRibbonButton(ID_HIGH_FILE, _T("文件安全传输"), -1, 6));

	//可汗学院
	
	CMFCRibbonCategory* pCategoryKhan = m_wndRibbonBar.AddCategory(_T("可汗学院"),IDP_KEHAN,IDP_KEHAN,CSize (48, 48),CSize (48, 48));
	CMFCRibbonPanel* pPanelKhan= pCategoryKhan->AddPanel(_T("KHAN"));
	pPanelKhan->Add(new CKofMFCRibbonButton(ID_KHAN, _T("可汗学院"), -1, 0));
	//pPanelKhan->Add(new CKofMFCRibbonButton(ID_STU, _T("学生作品参考"), -1, 1));
	
	//学生作品
	CMFCRibbonCategory* pCategoryStuwork = m_wndRibbonBar.AddCategory(_T("优秀作品"),IDP_STU,IDP_STU,CSize (48, 48),CSize (48, 48));
	CMFCRibbonPanel* pPanelStuwork= pCategoryStuwork->AddPanel(_T("优秀作品"));
	pPanelStuwork->Add(new CKofMFCRibbonButton(ID_STU, _T(""), -1, 0));
	// 添加快速访问工具栏命令:
	//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);
	//OnMenuitemOpen();
	//m_wndRibbonBar.SetQuickAccessCommands(lstQATCmds);

}
Пример #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 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)));
}
Пример #8
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)));
}