Exemple #1
0
LRESULT Cv11View::OnHighlightRibbonListItem(WPARAM wp, LPARAM lp)
{
	int index = (int)wp;
	CMFCRibbonBaseElement* pElem = (CMFCRibbonBaseElement*)lp;
	UINT id = pElem->GetID(); // button id (ID_SHAPE, ID_COLOR)
	if (index == -1) {
		shape = saveshape;
		color = savecolor;

	}
	else {
	if (ID_SHAPE == id) {
		shape = index;

	}
	if (ID_COLOR == id) {
		CMFCRibbonColorButton * button = (CMFCRibbonColorButton*)pElem;
		color = button->GetHighlightedColor();
	}
}
	
	Invalidate();
	
	return 0;
}
Exemple #2
0
void Cv11View::OnColor()
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr;
	((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_COLOR, arr);
	CMFCRibbonColorButton* pGallery = (CMFCRibbonColorButton*)arr.GetAt(0);
	color = pGallery->GetColor();
	color1 = color;
	Invalidate();
}
Exemple #3
0
void Cv11View::OnColor()
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr;
	((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_COLOR, arr);
	CMFCRibbonColorButton* pGalery = (CMFCRibbonColorButton*)arr.GetAt(0);
	color = pGalery->GetColor();
	color_t = color;
	Invalidate();
	// TODO: Add your command handler code here
}
Exemple #4
0
COLORREF CRibbonAppDoc::GetColor(void)
{
    CMFCRibbonBar* pRibbon = ((CMDIFrameWndEx*) AfxGetMainWnd())->GetRibbonBar();
    ASSERT_VALID(pRibbon);

    CMFCRibbonColorButton* pColor = DYNAMIC_DOWNCAST(
       CMFCRibbonColorButton, pRibbon->FindByID(ID_FONT_COLOR));
    // Get the selected color
    return pColor->GetColor();
}
void CMSOffice2007DemoView::OnFontColor()
{
	CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();
	ASSERT_VALID(pRibbon);

	CMFCRibbonColorButton* pFontColorBtn = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, pRibbon->FindByID(ID_FONT_COLOR));

	if (pFontColorBtn != NULL)
	{
		COLORREF color = pFontColorBtn->GetColor();
		CRichEditView::OnColorPick(color == -1 ? ::GetSysColor(COLOR_WINDOWTEXT) : color);
	}
}
void CMainFrame::setOutlineColor()
{
	CMFCRibbonComboBox* pFormatSelCombo = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_SEL_COMBO));
	if (pFormatSelCombo == NULL)
		return;
	int iFormatElement=pFormatSelCombo->GetCurSel();

	CMFCRibbonColorButton* pOutlineColorBtn = DYNAMIC_DOWNCAST(CMFCRibbonColorButton, m_wndRibbonBar.FindByID(WM_CHART_FORMAT_OUTLINE_COLOR));
	if (pOutlineColorBtn == NULL)
		return;

	CString str;
	str.Format(_T("%.3d%.3d%.3d"),GetRValue(pOutlineColorBtn->GetColor()),
		GetGValue(pOutlineColorBtn->GetColor()),
		GetBValue(pOutlineColorBtn->GetColor()));
	AfxMessageBox(str);



	chartControl.setFormat(iFormatElement,CChartControl::Format_OutlineColor,str);
}
Exemple #7
0
COLORREF CMainFrame::GetColorFromColorButton(int nButtonID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;

	m_wndRibbonBar.GetElementsByID(nButtonID, arButtons);

	if (arButtons.GetSize() == 0)
	{
		return(COLORREF) -1;
	}

	CMFCRibbonColorButton* pColorButton = (CMFCRibbonColorButton*)arButtons.GetAt(0);

	COLORREF clr = pColorButton->GetColor();
	if (clr == (COLORREF)-1)
	{
		clr = pColorButton->GetAutomaticColor();
	}

	return clr;
}
Exemple #8
0
afx_msg LRESULT Cv11View::OnAfxWmOnHighlightRibbonListItem(WPARAM wParam, LPARAM lParam)
{
	int index = int(wParam);
	CMFCRibbonBaseElement* pElem = (CMFCRibbonBaseElement*)lParam;
	UINT id = pElem->GetID();
	switch (id){
		case ID_SHAPE:
			shape = index;
			Invalidate();
			break;
		case ID_COLOR:
			CMFCRibbonColorButton *button = (CMFCRibbonColorButton*)pElem;
			color = button->GetHighlightedColor();
			Invalidate();
			break;
	}
	if (index == -1) {
		shape = shape_t;
		color = color_t;
		Invalidate();
	}
	return 0;
}
Exemple #9
0
LRESULT Cv11View::OnHighlightRibbonListItem(WPARAM wp, LPARAM lp)
{
	int index = (int)wp;
	CMFCRibbonBaseElement* pElem = (CMFCRibbonBaseElement*)lp;
	UINT id = pElem->GetID(); // button id (ID_SHAPE, ID_COLOR)
	if (index >= 0){
		if (id == ID_SHAPE){
			shape = index;
			Invalidate();
		}
		if (id == ID_COLOR){
			CMFCRibbonColorButton* pColor = (CMFCRibbonColorButton*)pElem;
			color = pColor->GetHighlightedColor();
			Invalidate();
		}
	}
	else {
		shape = shape1;
		color = color1;
		Invalidate();
	}
	return 0;
}
Exemple #10
0
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1)
		return -1;

	// set the visual manager and style based on persisted value
	OnApplicationLook(theApp.m_nAppLook);

	CMDITabInfo mdiTabParams;
	mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D; // other styles available...
	mdiTabParams.m_bActiveTabCloseButton = TRUE;      // set to FALSE to place close button at right of tab area
	mdiTabParams.m_bTabIcons = FALSE;    // set to TRUE to enable document icons on MDI taba
	mdiTabParams.m_bAutoColor = FALSE;    // set to FALSE to disable auto-coloring of MDI tabs
	mdiTabParams.m_bDocumentMenu = TRUE; // enable the document menu at the right edge of the tab area
	EnableMDITabbedGroups(TRUE, mdiTabParams);

	m_wndRibbonBar.Create(this);
	m_wndRibbonBar.LoadFromResource(IDR_RIBBON);

	// enable Visual Studio 2005 style docking window behavior
	CDockingManager::SetDockingMode(DT_IMMEDIATE);
	// enable Visual Studio 2005 style docking window auto-hide behavior
	EnableAutoHidePanes(CBRS_ALIGN_ANY);

	// create docking windows
	if (!CreateDockingWindows())
	{
		TRACE0("Failed to create docking windows\n");
		return -1;
	}

	// Enable enhanced windows management dialog
	EnableWindowsDialog(ID_WINDOW_MANAGER, ID_WINDOW_MANAGER, TRUE);

	// Switch the order of document name and application name on the window title bar. This
	// improves the usability of the taskbar because the document name is visible with the thumbnail.
	ModifyStyle(0, FWS_PREFIXTITLE);

	//Update Colors
	CMFCRibbonColorButton* pColor;
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CBACKGROUND); pColor->SetColor(crBackground);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CSELECT); pColor->SetColor(crSelect);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CHIDDEN); pColor->SetColor(crHidden);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_COFFSET); pColor->SetColor(crOffset);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CADDRESS); pColor->SetColor(crAddress);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CTYPE); pColor->SetColor(crType);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CNAME); pColor->SetColor(crName);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CINDEX); pColor->SetColor(crIndex);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CVALUE); pColor->SetColor(crValue);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CCOMMENT); pColor->SetColor(crComment);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CVTABLE); pColor->SetColor(crVTable);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CFUNCTION); pColor->SetColor(crFunction);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CTEXT); pColor->SetColor(crChar);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CCUSTOM); pColor->SetColor(crCustom);
	pColor = (CMFCRibbonColorButton*)m_wndRibbonBar.FindByID(ID_BUTTON_CHEX); pColor->SetColor(crHex);

	//CreateConsole( );

	// Why?
	SetTimer( 69, 5000, NULL );

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

}
Exemple #12
0
void CMainFrame::UpdateContextTabFromObject(CDrawObjList& list)
{
	int count = (int) list.GetCount();
	if (count == 0)
	{
		return;
	}

	COLORREF clrFill = (COLORREF)-1;
	COLORREF clrLine = (COLORREF)-1;
	int nLineWeight  = -1;
	if (count == 1)
	{
		CDrawObj* pObj = list.GetHead();
		if (pObj->CanChangeFillColor() && pObj->IsEnableFill())
		{
			clrFill = pObj->GetFillColor();
		}
		if (pObj->CanChangeLineColor() && pObj->IsEnableLine())
		{
			clrLine = pObj->GetLineColor();
		}
		if (pObj->CanChangeLineWeight() && pObj->IsEnableLine())
		{
			nLineWeight = pObj->GetLineWeight() - 1;
		}
	}

	{
		CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;
		m_wndRibbonBar.GetElementsByID(ID_OBJECT_FILLCOLOR, arButtons);

		if (arButtons.GetSize() > 0)
		{
			for (int i = 0; i < arButtons.GetSize(); i++)
			{
				CMFCRibbonColorButton* pButton = DYNAMIC_DOWNCAST
					(CMFCRibbonColorButton, arButtons[i]
				);
				pButton->SetColor(clrFill);
			}
		}
	}

	{
		CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;
		m_wndRibbonBar.GetElementsByID(ID_OBJECT_LINECOLOR, arButtons);

		if (arButtons.GetSize() > 0)
		{
			for (int i = 0; i < arButtons.GetSize(); i++)
			{
				CMFCRibbonColorButton* pButton = DYNAMIC_DOWNCAST
					(CMFCRibbonColorButton, arButtons[i]
				);
				pButton->SetColor(clrLine);
			}
		}
	}

	{
		CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;
		m_wndRibbonBar.GetElementsByID(ID_OBJECT_LINEWEIGHT, arButtons);

		if (arButtons.GetSize() > 0)
		{
			for (int i = 0; i < arButtons.GetSize(); i++)
			{
				CRibbonListButton* pButton = DYNAMIC_DOWNCAST
					(CRibbonListButton, arButtons[i]
				);
				pButton->SelectItem(nLineWeight);
			}
		}
	}

	m_wndRibbonBar.RedrawWindow();
}
Exemple #13
0
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));
}
Exemple #14
0
void CMainFrame::InitHomeCategory()
{
	CreateDocumentColors();

	CMFCRibbonCategory* pCategory = m_wndRibbonBar.AddCategory(_T("&Home"), IDB_RIBBON_HOMESMALL, IDB_RIBBON_HOMELARGE);

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

	CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, _T("Paste\nv"), 0, 0);
	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(ID_EDIT_CLEAR, _T("Delete\nt"), 3));

	// Create "Operations" panel
	CMFCRibbonPanel* pPanelOperations = pCategory->AddPanel(_T("Operations\nzo"), m_PanelImages.ExtractIcon(1));

	// <Snippet3>
	// Create the "Paper Color" button
	CMFCRibbonColorButton* pBtnPaperColor = new CMFCRibbonColorButton(ID_VIEW_PAPERCOLOR, _T("Paper Color\ng"), TRUE, 13, 1);
	pBtnPaperColor->SetAlwaysLargeImage();
	pBtnPaperColor->EnableAutomaticButton(_T("&Automatic"), RGB(255, 255, 255));
	pBtnPaperColor->EnableOtherButton(_T("&More Colors..."), _T("More Colors"));
	pBtnPaperColor->SetColumns(10);
	pBtnPaperColor->SetColorBoxSize(CSize(17, 17));
	// CList<COLORREF,COLORREF> m_lstMainColors
	pBtnPaperColor->AddColorsGroup(_T("Theme Colors"), m_lstMainColors, TRUE);
	// CList<COLORREF,COLORREF> m_lstAdditionalColors
	pBtnPaperColor->AddColorsGroup(_T(""), m_lstAdditionalColors, FALSE);
	// CList<COLORREF,COLORREF> m_lstStandardColors
	pBtnPaperColor->AddColorsGroup(_T("Standard Colors"), m_lstStandardColors, TRUE);
	CList<COLORREF,COLORREF> lstColors;
	lstColors.AddTail(RGB(255,0,0));
	lstColors.AddTail(RGB(0,255,0));
	lstColors.AddTail(RGB(0,0,255));
	pBtnPaperColor->SetDocumentColors( _T("Document Colors"), lstColors );
    // </Snippet3>

	pPanelOperations->Add(pBtnPaperColor);

	pPanelOperations->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, _T("Select All\na"), 4));
	pPanelOperations->Add(new CMFCRibbonButton(ID_OLE_INSERT_NEW, _T("New Object...\no"), 5));
	pPanelOperations->Add(new CMFCRibbonButton(ID_OLE_EDIT_LINKS, _T("Links...\ni"), 6));

	// Create "Draw" panel
	CMFCRibbonPanel* pPanelDraw = pCategory->AddPanel(_T("Draw\nzd"), m_PanelImages.ExtractIcon(2));

	pPanelDraw->Add(new CMFCRibbonButton(ID_DRAW_SELECT, _T("Select\ns"), 7));
	pPanelDraw->Add(new CMFCRibbonButton(ID_DRAW_LINE, _T("Line\nl"), 8));
	pPanelDraw->Add(new CMFCRibbonButton(ID_DRAW_RECT, _T("Rectangle\nr"), 9));
	pPanelDraw->Add(new CMFCRibbonButton(ID_DRAW_ROUNDRECT, _T("Round Rectangle\nn"), 10));
	pPanelDraw->Add(new CMFCRibbonButton(ID_DRAW_ELLIPSE, _T("Ellipse\ne"), 11));
	pPanelDraw->Add(new CMFCRibbonButton(ID_DRAW_POLYGON, _T("Polygon\ny"), 12));

	// 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"), 15, 3));
	pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVEFORWARD, _T("Move Forward\nmw"), 17, 5));
	pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVEBACK, _T("Move Backward\nmd"), 18, 6));
	pPanelArrange->Add(new CMFCRibbonButton(ID_OBJECT_MOVETOBACK, _T("Move to Back\nmb"), 16, 4));

	// Add not-in-ribbon commands
	CMFCRibbonButton* pUndo = new CMFCRibbonButton(ID_EDIT_UNDO, _T("Undo"), 20);
	pCategory->AddHidden(pUndo);
}