コード例 #1
0
ファイル: mainfrm.cpp プロジェクト: Ireneph/samples
BOOL CMainFrame::CreateStatusBar()
{
	if (!m_wndStatusBar.Create(this))
	{
		return FALSE;
	}

	m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE_OBJECTCOUNT, _T("Object Count: None"), TRUE), _T("Object Count: None"));

	m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE_SELECTEDOBJECTCOUNT, _T("Selected Count: None"), TRUE), _T("Selected Count: None"));

	{
		// <Snippet2>
		CMFCRibbonButtonsGroup* pSBGroup = new CMFCRibbonButtonsGroup;

		CMFCToolBarImages images;
		images.SetImageSize(CSize(14, 14));
	
		CMFCToolBarImages hotimages;
		hotimages.SetImageSize(CSize(14, 14));
	
		if (images.Load(IDB_STATUSBAR_1) && hotimages.Load(IDB_STATUSBAR_2))
		{
			pSBGroup->SetImages(&images, &hotimages, NULL);
		}

		pSBGroup->AddButton(new CMFCRibbonButton(ID_FILE_PRINT_PREVIEW, _T(""), 0));
		pSBGroup->AddButton(new CMFCRibbonButton(ID_FILE_SUMMARYINFO, _T(""), 1));
		
		// CMFCRibbonStatusBar m_wndStatusBar
		m_wndStatusBar.AddExtendedElement(pSBGroup, _T("View Shortcuts"));
		// </Snippet2>
	}

	{
		CMFCRibbonButtonsGroup* pSBGroup = new CMFCRibbonButtonsGroup;

		CMFCToolBarImages images;
		images.SetImageSize(CSize(14, 14));
		if (images.Load(IDB_STATUSBAR_2))
		{
			pSBGroup->SetImages(&images, NULL, NULL);
		}

		pSBGroup->AddButton(new CMFCRibbonButton(ID_VIEW_GRID, _T(""), 0));
		pSBGroup->AddButton(new CMFCRibbonButton(ID_VIEW_SHOWOBJECTS, _T(""), 1));

		m_wndStatusBar.AddExtendedElement(pSBGroup, _T("View Shortcuts"));
	}

	return TRUE;
}
コード例 #2
0
ファイル: UIMainMenu.cpp プロジェクト: alexis-/iwe
void
CUIGallery::addItem(const std::string&      sLabel,
                    const s_IWEImageData&   imgData,
                    char*                   pGroupName)
{
  if (vecItemExists(m_vecItems, sLabel))
    return;

  std::map<std::string, CMFCToolBarImages*>::const_iterator it;
  CMFCToolBarImages* pTB = NULL;

  if ((it = m_mapTB.find(pGroupName)) != m_mapTB.end())
    pTB = (*it).second;

  else
  {
    pTB = new CMFCToolBarImages();
    pTB->SetImageSize(CSize(50, 50), FALSE);

    //m_pGallery->AddGroup(pGroupName, *pTB);
    m_mapTB[pGroupName] = pTB;

    int iPos = 0;

    if (m_vecGroups.size() > 0)
      iPos = m_vecGroups.back().second;

    m_vecGroups.push_back(std::pair<std::string, int>(pGroupName, iPos));
  }

  CBitmap bmp;

  CBitmapFromData(bmp, imgData, 50, 50);
  pTB->AddImage(bmp);

  int iPos = -1;
  for (int i = 0; i < m_vecGroups.size(); i++)
  {
    std::pair<std::string, int>& grp = m_vecGroups[i];

    if (grp.first == pGroupName)
    {
      iPos = grp.second;
      grp.second = grp.second++;
    }
    else if (iPos >= 0)
      grp.second = grp.second++;
  }

  std::vector<std::string>::iterator itemIt = m_vecItems.begin();
  for (; itemIt != m_vecItems.end() && iPos-- > 0; itemIt++)
    ;

  m_vecItems.insert(itemIt, sLabel);

  m_pGallery->Clear();
  for (it = m_mapTB.begin(); it != m_mapTB.end(); it++)
    m_pGallery->AddGroup((*it).first.c_str(), *(*it).second);

  //CUIMainMenu* pMM = dynamic_cast<CUIMainMenu*>(CUIManager::getInstance()->getMainMenu());
  //pMM->refreshLayout();
}
コード例 #3
0
ファイル: MainFrm.cpp プロジェクト: jetlive/skiaming
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)
		return -1;

	CMFCVisualManager::SetDefaultManager (RUNTIME_CLASS (CMFCVisualManagerOffice2007));

	CMDITabInfo mdiTabParams;
	mdiTabParams.m_bTabIcons = TRUE;
	mdiTabParams.m_style = CMFCTabCtrl::STYLE_3D_ONENOTE;
	mdiTabParams.m_bAutoColor = TRUE;

	EnableMDITabbedGroups (TRUE, mdiTabParams);

	CDockingManager::SetDockingMode (DT_SMART);

	m_wndRibbonBar.Create (this);

	InitRibbon ();

	if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}

	// Load control bar icons:
	CMFCToolBarImages imagesWorkspace;
	imagesWorkspace.SetImageSize (CSize (16, 16));
	imagesWorkspace.SetTransparentColor (RGB (255, 0, 255));
	imagesWorkspace.Load (IDB_WORKSPACE);

	if (!m_wndWorkSpace.Create (_T("View  1"), this, CRect (0, 0, 200, 200),
		TRUE, ID_VIEW_WORKSPACE,
		WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
	{
		TRACE0("Failed to create Workspace bar\n");
		return FALSE;      // fail to create
	}

	m_wndWorkSpace.SetIcon (imagesWorkspace.ExtractIcon (0), FALSE);

	if (!m_wndWorkSpace2.Create (_T("View 2"), this, CRect (0, 0, 200, 200),
		TRUE, ID_VIEW_WORKSPACE2,
		WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | CBRS_LEFT | CBRS_FLOAT_MULTI))
	{
		TRACE0("Failed to create Workspace bar 2\n");
		return FALSE;      // fail to create
	}

	m_wndWorkSpace2.SetIcon (imagesWorkspace.ExtractIcon (1), FALSE);

	if (!m_wndOutput.Create (_T("Output"), this, CRect (0, 0, 150, 150),
		TRUE /* Has gripper */, ID_VIEW_OUTPUT,
		WS_CHILD | WS_VISIBLE | CBRS_BOTTOM | CBRS_FLOAT_MULTI))
	{
		TRACE0("Failed to create output bar\n");
		return -1;      // fail to create
	}

	m_wndOutput.SetIcon (imagesWorkspace.ExtractIcon (2), FALSE);

	m_wndWorkSpace.EnableDocking(CBRS_ALIGN_ANY);
	m_wndWorkSpace2.EnableDocking(CBRS_ALIGN_ANY);
	m_wndOutput.EnableDocking(CBRS_ALIGN_ANY);
	EnableDocking(CBRS_ALIGN_ANY);
	EnableAutoHidePanes(CBRS_ALIGN_ANY);
	DockPane (&m_wndWorkSpace);
	m_wndWorkSpace2.AttachToTabWnd (&m_wndWorkSpace, DM_STANDARD, FALSE, NULL);
	DockPane(&m_wndOutput);

	// Enable windows manager:
	EnableWindowsDialog (ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE);

	return 0;
}