Ribbon Contextual Categories (Tabs)

Fully implemented BCGControlBar Pro (MFC)

Not available BCGSuite (MFC)

Fully implemented BCGControlBar for .NET

Some ribbon tabs may be used only if a specific document part such as image, table or embedded object is selected. These tabs are called "Contextual" and have a special, developer-defined color. In addition, the context name will be displayed on the caption bar, on the top of contextual tabs area.

Ribbon contextual tabs:

Ribbon contextual tabs:

Sample code:

void CMainFrame::AddPictureTab ()
{
	// Create Contextual Category (Tab):
	CBCGPRibbonCategory* pCategory = 
		m_wndRibbonBar.AddContextCategory(
			_T("Format"),
			_T("Picture tools"), 
			IDB_PICTURE, 
			BCGPCategoryColor_Red,
			IDB_PICTURE_FORMAT,
			IDB_PICTURE_FORMATLARGE);

	// Add panel:
	CBCGPRibbonPanel* pPanelTools = 
		pCategory->AddPanel(
			_T("Picture Tools"),
			m_PanelImages.ExtractIcon (20));

	// Add panel elements:
	pPanelTools->Add(
		new CBCGPRibbonButton(
			ID_PICTURE_FORMAT_TOOLS_BRIGHTNESS, 
			_T("Brightness"), 0, -1));
	pPanelTools->Add(
		new CBCGPRibbonButton(
			ID_PICTURE_FORMAT_TOOLS_CONTRAST, 
			_T("Contrast"), 1, -1));
	pPanelTools->Add(
		new CBCGPRibbonButton(
			ID_PICTURE_FORMAT_TOOLS_RECOLOR, 
			_T("Recolor"), 2, -1));
	pPanelTools->Add(
		new CBCGPRibbonButton(
			ID_PICTURE_FORMAT_TOOLS_COMPRESS, 
			_T("Compress Pictures"), 3, -1));
	pPanelTools->Add(
		new CBCGPRibbonButton(
			ID_PICTURE_FORMAT_TOOLS_CHANGE, 
			_T("Change Picture"), 4, -1));
	pPanelTools->Add(
		new CBCGPRibbonButton(
			ID_PICTURE_FORMAT_TOOLS_RESET, 
			_T("Reset Picture"), 5, -1));
}

void CMainFrame::OnChangeDocumentSelection(
	UINT uiSelID)
{
	m_wndRibbonBar.HideAllContextCategories();

	if (uiSelID != 0)
	{
		m_wndRibbonBar.ShowContextCategories
			(uiSelID);
	}

	m_wndRibbonBar.RecalcLayout();
}