void CMyRibbonBar::addChartTools() { CMFCRibbonButton* pBtn=NULL; // CMFCRibbonCategory* pCategory = AddContextCategory(_T("Design"), _T("Chart tools"), IDB_CHART, AFX_CategoryColor_Green, IDB_CHART_DESIGN16, IDB_CHART_MENU); pCategory->SetKeys(_T("jc")); CMFCRibbonPanel* pPanel = pCategory->AddPanel(_T("Chart type"), m_PanelImages.ExtractIcon(20)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_COLUMN, _T("Column\nc"), -1, 0)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_LINE, _T("Line\nc"), -1, 1)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_PIE, _T("Pie\nc"), -1, 2)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_HCOLUMN, _T("Horizontal\nc"), -1, 3)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_AREA, _T("Area\nc"), -1, 4)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_SNOW, _T("Snow\nc"), -1, 5)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TYPE_DOUGHNUT, _T("Doughnut\nc"), -1, 6)); pPanel = pCategory->AddPanel(_T("Design"), m_PanelImages.ExtractIcon(20)); pBtn=new CMFCRibbonButton(WM_CHART_DESIGN_PALETTE, _T("Palette\nc"), -1, 7); pBtn->SetMenu(IDR_CHART_PALETTE,FALSE); pPanel->Add (pBtn); pPanel = pCategory->AddPanel(_T("3D"), m_PanelImages.ExtractIcon(20)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_ENABLE3D , _T("3D Chart\nc"), -1, 8)); pPanel->AddSeparator(); CMFCRibbonEdit* pEditBtn = new CMFCRibbonEdit(WM_CHART_DESIGN_WALL_WIDTH , 50, _T("Wall width:"), 7); pEditBtn->EnableSpinButtons(0, 99); pEditBtn->SetEditText(_T("0")); pPanel->Add(pEditBtn); pEditBtn = new CMFCRibbonEdit(WM_CHART_DESIGN_POINT_DEPTH , 50, _T("Point depth:"), 6); pEditBtn->EnableSpinButtons(0, 99); pEditBtn->SetEditText(_T("0")); pPanel->Add(pEditBtn); pEditBtn = new CMFCRibbonEdit(WM_CHART_DESIGN_GAP_DEPTH , 50, _T("Gap depth:"), 5); pEditBtn->EnableSpinButtons(0, 99); pEditBtn->SetEditText(_T("0")); pPanel->Add(pEditBtn); pPanel->AddSeparator(); pEditBtn = new CMFCRibbonEdit(WM_CHART_DESIGN_PERSPECTIVE, 50, _T("Perspective:"), 4); pEditBtn->EnableSpinButtons(0, 99); pEditBtn->SetEditText(_T("0")); pPanel->Add(pEditBtn); pEditBtn = new CMFCRibbonEdit(WM_CHART_DESIGN_ROTATEX, 50, _T("Rotate X:"), 0); pEditBtn->EnableSpinButtons(0, 99); pEditBtn->SetEditText(_T("0")); pPanel->Add(pEditBtn); pEditBtn = new CMFCRibbonEdit(WM_CHART_DESIGN_ROTATEY, 50, _T("Rotate Y:"), 1); pEditBtn->EnableSpinButtons(0, 99); pEditBtn->SetEditText(_T("0")); pPanel->Add(pEditBtn); pPanel->SetJustifyColumns(); // pPanel = pCategory->AddPanel(_T("Antiliasing"), m_PanelImages.ExtractIcon(20)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_GRAPHICS_ANTILIASING, _T("Graphic antiliasing\nc"), -1, 0)); pPanel->Add(new CMFCRibbonButton(WM_CHART_DESIGN_TEXT_ANTILIASING, _T("Text antiliasing\nc"), -1, 9)); CMFCRibbonCategory* pCategory2 = AddContextCategory(_T("Layout"), _T("Chart tools"), IDB_CHART, AFX_CategoryColor_Green, IDB_CHART_LAYOUT, IDB_CHART_LAYOUTLARGE); pCategory2->SetKeys(_T("ja")); CMFCRibbonPanel* pPanelLayout_Labels = pCategory2->AddPanel(_T("Labels"), m_PanelImages.ExtractIcon(20)); pBtn=new CMFCRibbonButton (WM_CHART_LAYOUT_TITLE, _T("Chart Title\nt"),-1, 3); pBtn->SetMenu(IDR_CHARTTITLE,FALSE); pPanelLayout_Labels->Add (pBtn); /* pBtn=new CMFCRibbonButton(WM_CHART_LAYOUT_AXIS_TITLES, _T("Axis Titles\ni"), -1, 4); pBtn->SetMenu(IDR_AXISTITLES,FALSE); pPanelLayout_Labels->Add (pBtn);*/ pPanelLayout_Labels->Add(new CMFCRibbonButton(WM_CHART_LAYOUT_LEGEND, _T("Legend\nl"), 3, 5)); pPanelLayout_Labels->Add(new CMFCRibbonButton(WM_CHART_LAYOUT_POINTS_LABELS, _T("Data Labels\nb"), 4, 6)); CMFCRibbonPanel* pPanelLayout_Axes = pCategory2->AddPanel(_T("Axes"), m_PanelImages.ExtractIcon(20)); pBtn=new CMFCRibbonButton(WM_CHART_LAYOUT_AXIS, _T("Axes\na"), -1, 8); pBtn->SetMenu(IDR_AXIS,FALSE); pPanelLayout_Axes->Add (pBtn); pPanelLayout_Axes->Add(new CMFCRibbonButton(WM_CHART_LAYOUT_GRID, _T("Gridlines\ng"), -1, 9)); CMFCRibbonCategory* pCategory3 = AddContextCategory(_T("Format"), _T("Chart tools"), IDB_CHART, AFX_CategoryColor_Green, IDB_CHART_FORMAT, IDB_CHART_MENU); pCategory3->SetKeys(_T("jo")); CMFCRibbonPanel* pPanelFormat_Sel = pCategory3->AddPanel(_T("Current Selection"), m_PanelImages.ExtractIcon(13)); CMFCRibbonComboBox* pFormatSelCombo = new CMFCRibbonComboBox(WM_CHART_FORMAT_SEL_COMBO, TRUE, -1,_T("Select Item"),0); pFormatSelCombo->AddItem(_T("Chart Title"),0); pFormatSelCombo->AddItem(_T("Chart Area")); pFormatSelCombo->AddItem(_T("Legend")); pFormatSelCombo->AddItem(_T("x Axis Title")); pFormatSelCombo->AddItem(_T("y Axis Title")); // pFormatSelCombo->AddItem(_T("Series \"Series1\""),1); pFormatSelCombo->SelectItem(0); pPanelFormat_Sel->Add(pFormatSelCombo); pPanelFormat_Sel->Add(new CMFCRibbonLabel(_T("Change text :"))); CMFCRibbonEdit* pBtn1 = new CMFCRibbonEdit(WM_CHART_FORMAT_TEXT , 200); pBtn1->SetEditText(_T("Edit")); pPanelFormat_Sel->Add(pBtn1); pPanel = pCategory3->AddPanel(_T("Shape Fill"), m_PanelImages.ExtractIcon(5)); CMFCRibbonColorButton* pColorBtn = new CMFCRibbonColorButton(WM_CHART_FORMAT_FILL_COLOR1 , _T("Primary color"), 2); pColorBtn->SetDefaultCommand(FALSE); pColorBtn->EnableAutomaticButton(_T("&Automatic"), RGB(0, 0, 0)); pColorBtn->EnableOtherButton(_T("&More Colors..."), _T("More Colors")); pColorBtn->SetColumns(10); pColorBtn->SetColorBoxSize(CSize(17, 17)); pColorBtn->AddColorsGroup(_T("Theme Colors"), m_lstMainColors); pColorBtn->AddColorsGroup(_T(""), m_lstAdditionalColors, TRUE); pColorBtn->AddColorsGroup(_T("Standard Colors"), m_lstStandardColors); pPanel->Add(pColorBtn); pColorBtn = new CMFCRibbonColorButton(WM_CHART_FORMAT_FILL_COLOR2 , _T("Secondary color"), 2); pColorBtn->SetDefaultCommand(FALSE); pColorBtn->EnableAutomaticButton(_T("&Automatic"), RGB(0, 0, 0)); pColorBtn->EnableOtherButton(_T("&More Colors..."), _T("More Colors")); pColorBtn->SetColumns(10); pColorBtn->SetColorBoxSize(CSize(17, 17)); pColorBtn->AddColorsGroup(_T("Theme Colors"), m_lstMainColors); pColorBtn->AddColorsGroup(_T(""), m_lstAdditionalColors, TRUE); pColorBtn->AddColorsGroup(_T("Standard Colors"), m_lstStandardColors); pPanel->Add(pColorBtn); pBtn=new CMFCRibbonButton (WM_CHART_FORMAT_FILL_GRADIENT, _T("Gradient\nt"),2, -1); pBtn->SetMenu(IDR_CHART_GRADIENT,FALSE); pPanel->Add (pBtn); pBtn=new CMFCRibbonButton (WM_CHART_FORMAT_FILL_HATCH, _T("Hatch style"),-1, 10); pBtn->SetMenu(IDR_CHART_FILLHATCHING,FALSE); pPanel->Add (pBtn); pPanel = pCategory3->AddPanel(_T("Outline"), m_PanelImages.ExtractIcon(4)); pColorBtn = new CMFCRibbonColorButton(WM_CHART_FORMAT_OUTLINE_COLOR ,_T("Color\nso"), 3, -1); pColorBtn->SetDefaultCommand(FALSE); pColorBtn->EnableAutomaticButton(_T("&Automatic"), RGB(0, 0, 0)); pColorBtn->EnableOtherButton(_T("&More Colors..."), _T("More Colors")); pColorBtn->SetColumns(10); pColorBtn->SetColorBoxSize(CSize(17, 17)); pColorBtn->AddColorsGroup(_T("Theme Colors"), m_lstMainColors); pColorBtn->AddColorsGroup(_T(""), m_lstAdditionalColors, TRUE); pColorBtn->AddColorsGroup(_T("Standard Colors"), m_lstStandardColors); pPanel->Add(pColorBtn); pBtn=new CMFCRibbonButton (WM_CHART_FORMAT_FILL_GRADIENT, _T("Style\nt"),3, -1); pBtn->SetMenu(IDR_CHART_OUTLINESTYLE,FALSE); pPanel->Add (pBtn); pBtn=new CMFCRibbonButton (WM_CHART_FORMAT_OUTLINE_SIZE, _T("Size\ns"),3, -1); pBtn->SetMenu(IDR_OUTLINE_WIDTH,FALSE); pPanel->Add (pBtn); pPanel = pCategory3->AddPanel(_T("Size"), m_PanelImages.ExtractIcon(20)); CMFCRibbonEdit* pBtn5 = new CMFCRibbonEdit(WM_CHART_FORMAT_SIZEX, 45, NULL, 11); pBtn5->EnableSpinButtons(0, 99); pBtn5->SetEditText(_T("0")); pPanel->Add(pBtn5); pBtn5 = new CMFCRibbonEdit(WM_CHART_FORMAT_SIZEY, 45, NULL, 12); pBtn5->EnableSpinButtons(0, 99); pBtn5->SetEditText(_T("0")); pPanel->Add(pBtn5); pPanel->SetCenterColumnVert (TRUE); pPanel = pCategory3->AddPanel(_T("Orientation"), m_PanelImages.ExtractIcon(20)); pBtn=new CMFCRibbonButton (WM_CHART_FORMAT_ORIENTATION_ALIGN, _T("Alignment"),6, -1); pBtn->SetMenu(IDR_CHART_ALIGNMENT,FALSE); pPanel->Add (pBtn); pBtn=new CMFCRibbonButton (WM_CHART_FORMAT_ORIENTATION_DOCKING, _T("Docking"),8, -1); pBtn->SetMenu(IDR_CHART_DOCKING,FALSE); pPanel->Add (pBtn); pPanel->Add(new CMFCRibbonButton(WM_CHART_FORMAT_ORIENTATION_REVERSE, _T("Reverse\nso"), 10, -1)); //pPanel->Add(new CMFCRibbonButton(ID_CHART_FORMAT_SHAPES_EFFECTS, _T("Shape Effects\nse"), 4, -1)); // Create "Font" panel: CMFCRibbonPanel* pPanelFont = pCategory3->AddPanel(_T("Font"), m_PanelImages.ExtractIcon(2)); pPanelFont->SetKeys(_T("zf")); // Create a new group with 2 elements: font name and font size: CMFCRibbonButtonsGroup* pFontGroup = new CMFCRibbonButtonsGroup; CMFCRibbonFontComboBox::m_bDrawUsingFont = TRUE; CMFCRibbonFontComboBox* pFontCombo = new CMFCRibbonFontComboBox(WM_CHART_FORMAT_FONT_NAME); pFontCombo->SetWidth(55, TRUE); // Width in "floaty" mode pFontCombo->SelectItem(10); pFontGroup->AddButton(pFontCombo); CMFCRibbonComboBox* pFontSizeCombo = new CMFCRibbonComboBox(WM_CHART_FORMAT_FONT_SIZE, TRUE, 39); pFontSizeCombo->AddItem(_T("8")); pFontSizeCombo->AddItem(_T("9")); pFontSizeCombo->AddItem(_T("10")); pFontSizeCombo->AddItem(_T("11")); pFontSizeCombo->AddItem(_T("12")); pFontSizeCombo->AddItem(_T("14")); pFontSizeCombo->AddItem(_T("16")); pFontSizeCombo->AddItem(_T("18")); pFontSizeCombo->AddItem(_T("20")); pFontSizeCombo->AddItem(_T("22")); pFontSizeCombo->AddItem(_T("24")); pFontSizeCombo->AddItem(_T("26")); pFontSizeCombo->AddItem(_T("28")); pFontSizeCombo->AddItem(_T("36")); pFontSizeCombo->AddItem(_T("48")); pFontSizeCombo->AddItem(_T("72")); pFontSizeCombo->SetWidth(20, TRUE); // Width in "floaty" mode pFontSizeCombo->SelectItem(3); pFontGroup->AddButton(pFontSizeCombo); pPanelFont->Add(pFontGroup); // Add toolbar(all toolbar buttons will be automatically // converted to ribbon elements: pPanelFont->AddToolBar(IDR_FONT); }
void CMainFrame::AddContextTab_Format() { CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddContextCategory(_T("Format"), _T("Drawing tools"), ID_FORMAT_CONTEXT_TAB, AFX_CategoryColor_Orange, IDB_RIBBON_FORMATSMALL, IDB_RIBBON_FORMATLARGE); pCategory->SetKeys(_T("jd")); // Create "Styles" panel CMFCRibbonPanel* pPanelStyles = pCategory->AddPanel(_T("Styles\nzs"), m_PanelImages.ExtractIcon(8)); // <snippet6> CMFCRibbonGallery* pBtnStyles = new CMFCRibbonGallery(ID_OBJECT_STYLES, _T("Styles\nk"), 0, 0, IDB_STYLES, 40); pBtnStyles->SetIconsInRow(7); pBtnStyles->EnableMenuResize(TRUE, TRUE); pBtnStyles->EnableMenuSideBar(); pBtnStyles->SetButtonMode(false); pBtnStyles->RedrawIcons(); // </snippet6> pPanelStyles->Add(pBtnStyles); CMFCRibbonColorButton* pBtnFillColor = new CMFCRibbonColorButton(ID_OBJECT_FILLCOLOR, _T("Fill Color\nsf"), FALSE, 1, -1); pBtnFillColor->SetDefaultCommand(FALSE); pBtnFillColor->EnableAutomaticButton(_T("&Automatic"), RGB(128, 128, 128)); pBtnFillColor->EnableOtherButton(_T("&More Fill Colors..."), _T("More Fill Colors")); pBtnFillColor->SetColumns(10); pBtnFillColor->SetColorBoxSize(CSize(17, 17)); pBtnFillColor->AddColorsGroup(_T("Theme Colors"), m_lstMainColors); pBtnFillColor->AddColorsGroup(_T(""), m_lstAdditionalColors, TRUE); pBtnFillColor->AddColorsGroup(_T("Standard Colors"), m_lstStandardColors); pBtnFillColor->AddSubItem(new CMFCRibbonButton(ID_OBJECT_NOFILL, _T("&No Fill\nn"), 2)); pBtnFillColor->SetColor((COLORREF)-1); pPanelStyles->Add(pBtnFillColor); CMFCRibbonColorButton* pBtnLineColor = new CMFCRibbonColorButton(ID_OBJECT_LINECOLOR, _T("Line Color\nso"), FALSE, 3, -1); pBtnLineColor->SetDefaultCommand(FALSE); pBtnLineColor->EnableAutomaticButton(_T("&Automatic"), RGB(0, 0, 0)); pBtnLineColor->EnableOtherButton(_T("&More Line Colors..."), _T("More Line Colors")); pBtnLineColor->SetColumns(10); pBtnLineColor->SetColorBoxSize(CSize(17, 17)); pBtnLineColor->AddColorsGroup(_T("Theme Colors"), m_lstMainColors); pBtnLineColor->AddColorsGroup(_T(""), m_lstAdditionalColors, TRUE); pBtnLineColor->AddColorsGroup(_T("Standard Colors"), m_lstStandardColors); pBtnLineColor->AddSubItem(new CMFCRibbonButton(ID_OBJECT_NOLINE, _T("&No Line\nn"), 2)); pBtnLineColor->SetColor((COLORREF)-1); pPanelStyles->Add(pBtnLineColor); CStringArray sa; sa.Add(_T("1 pt")); sa.Add(_T("2 pt")); sa.Add(_T("3 pt")); sa.Add(_T("4 pt")); sa.Add(_T("5 pt")); sa.Add(_T("6 pt")); sa.Add(_T("7 pt")); CRibbonListButton* pBtnLineWeight = new CRibbonListButton(ID_OBJECT_LINEWEIGHT, _T("Line Weight\nsw"), 4, -1, IDB_LINEWEIGHT, 96, sa); pBtnLineWeight->AddSubItem(new CMFCRibbonButton(ID_OBJECT_LINEWEIGHT_MORE, _T("More &Lines..."), 5, -1)); pBtnLineWeight->EnableMenuResize(TRUE, TRUE); // Vertical only pPanelStyles->Add(pBtnLineWeight); // Create "Arrange" panel CMFCRibbonPanel* pPanelArrange = pCategory->AddPanel(_T("Arrange\nzj"), m_PanelImages.ExtractIcon(3)); pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVETOFRONT, _T("Move to Front\nmf"), 7, 1)); pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVEFORWARD, _T("Move Forward\nmw"), 9, 3)); pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVEBACK, _T("Move Backward\nmd"), 10, 4)); pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVETOBACK, _T("Move to Back\nmb"), 8, 2)); }