Esempio n. 1
0
void Cv11View::OnShape()
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arr;
	((CMainFrame*)AfxGetMainWnd())->m_wndRibbonBar.GetElementsByID(ID_SHAPE, arr);
	CMFCRibbonGallery* pGallery = (CMFCRibbonGallery*)arr.GetAt(0);
	shape = pGallery->GetSelectedItem();
	shape1 = shape;
	Invalidate();
}
Esempio n. 2
0
int CMainFrame::GetWeightFromLineWeight(int nButtonID)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;

	m_wndRibbonBar.GetElementsByID(nButtonID, arButtons);

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

	int weight = -1;
	CMFCRibbonGallery* pBtn = DYNAMIC_DOWNCAST(CMFCRibbonGallery, arButtons.GetAt(0));
	if (pBtn != NULL && pBtn->GetSelectedItem() != -1)
	{
		weight = pBtn->GetSelectedItem() + 1;
	}

	return weight;
}
Esempio n. 3
0
BOOL CMainFrame::GetStyleFromStyles(XStyle& style)
{
	CArray<CMFCRibbonBaseElement*, CMFCRibbonBaseElement*> arButtons;

	m_wndRibbonBar.GetElementsByID(ID_OBJECT_STYLES, arButtons);

	if (arButtons.GetSize() == 0)
	{
		return FALSE;
	}

	BOOL bRes = FALSE;

	CMFCRibbonGallery* pBtn = DYNAMIC_DOWNCAST(CMFCRibbonGallery, arButtons.GetAt(0));
	if (pBtn != NULL && pBtn->GetSelectedItem() != -1)
	{
		style = c_Styles[pBtn->GetSelectedItem()];
		bRes = TRUE;
	}

	return bRes;
}
Esempio n. 4
0
IUIGallery*
CUIPanel::addGallery(const std::string& sLabel, int iInsertAt)
{
  std::map<std::string, CUIGallery*>::iterator it = m_mapGalleries.find(sLabel);

  if (it != m_mapGalleries.end())
    return (*it).second;

  CMFCRibbonGallery* pGallery = new CMFCRibbonGallery(CUIManager::getInstance()->getNextUIID(),
    sLabel.c_str(), 0, 0);
  
  if (!pGallery)
    return NULL;
  
  pGallery->SetButtonMode(false);
  m_pPanel->Insert(pGallery, iInsertAt);

  CUIGallery* pUIGallery = new CUIGallery(pGallery);

  //pUIGallery->eventDestroy += FastDelegate1<CUIGallery*>(this, &CUIPanel::onGalleryDestroyed);
  m_mapGalleries[sLabel] = pUIGallery;

  return pUIGallery;
}
Esempio n. 5
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));
}