コード例 #1
0
void CXTPRibbonTabPopupToolBar::DrawCommandBar(CDC* pDC, CRect rcClipBox)
{
	CXTPRibbonPaintManager* pPaintManager = GetPaintManager()->GetRibbonPaintManager();

	pPaintManager->FillTabPopupToolBar(pDC, this);
	pPaintManager->FillGroupRect(pDC, m_pRibbonTab, m_rcGroups);
	pDC->SetBkMode(TRANSPARENT);

	CXTPRibbonGroups* pGroups = m_pRibbonTab->GetGroups();
	for (int i = 0; i < pGroups->GetCount(); i++)
	{
		CXTPRibbonGroup* pGroup = pGroups->GetAt(i);

		if (pGroup->IsVisible() && CRect().IntersectRect(rcClipBox, pGroup->GetRect()))
		{
			pGroup->Draw(pDC, rcClipBox);
		}
	}

	if (m_pControlScrollGroupsLeft->IsVisible())
	{
		m_pControlScrollGroupsLeft->Draw(pDC);
	}

	if (m_pControlScrollGroupsRight->IsVisible())
	{
		m_pControlScrollGroupsRight->Draw(pDC);
	}
}
コード例 #2
0
void CXTPRibbonGroupPopupToolBar::CreateKeyboardTips()
{
	if (!m_pParentGroup)
		return;

	CXTPRibbonTab* pSelectedTab = m_pParentGroup->GetParentTab();

	for (int i = 0; i < pSelectedTab->GetGroups()->GetCount(); i++)
	{
		CXTPRibbonGroup* pGroup = pSelectedTab->GetGroups()->GetAt(i);
		BOOL bVisible = pGroup->IsVisible() && m_pParentGroup == pGroup;

		if (bVisible)
		{
			pGroup = m_pRibbonGroup;
		}

		for (int j = 0; j < pGroup->GetCount(); j++)
		{
			CXTPControl* pControl = pGroup->GetAt(j);
			CreateControlKeyboardTips(pControl, NULL, bVisible);
		}

		if ((pGroup->GetControlGroupOption()->GetHideFlags() & xtpHideGeneric) == 0)
		{
			CreateControlKeyboardTips(pGroup->GetControlGroupOption(), NULL, bVisible);
		}

		CreateControlKeyboardTips(pGroup->GetControlGroupPopup(), _T("Z"), bVisible);
	}
}
コード例 #3
0
BOOL CXTPRibbonBuilder::BuildGroups(CXTPPropExchange* pPX, CXTPRibbonTab* pRibbonTab)
{
	CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("PANEL")));

	POSITION pos = pEnumerator->GetPosition(0);
	while (pos)
	{
		CXTPPropExchangeSection pxGroup(pEnumerator->GetNext(pos));

		CString strElementName;
		PX_String(&pxGroup, _T("ELEMENT_NAME"), strElementName);

		CCmdTarget* pElement = CreateElement(strElementName);
		if (pElement == NULL)
			continue;

		CXTPRibbonGroup* pGroup = DYNAMIC_DOWNCAST(CXTPRibbonGroup, pElement);

		if (!pGroup)
		{
			delete pElement;
			continue;
		}

		CString strName;
		PX_String(&pxGroup, _T("NAME"), strName);

		CString strKey;
		PX_String(&pxGroup, _T("KEYS"), strKey);


		pGroup->SetCaption(strName);
		pGroup->GetControlGroupPopup()->SetKeyboardTip(strKey);

		pRibbonTab->GetGroups()->InsertAt(pRibbonTab->GetGroups()->GetCount(), pGroup);

		CXTPPropExchangeSection pxGroupElements(pxGroup->GetSection(_T("ELEMENTS")));
		BuildGroupControls(&pxGroupElements, pGroup);
	}

	return TRUE;
}
コード例 #4
0
void CXTPRibbonTabPopupToolBar::OnKeyboardTip(CXTPCommandBarKeyboardTip* pTip)
{
	CXTPControl* pControl = DYNAMIC_DOWNCAST(CXTPControl, pTip->m_pOwner);
	if (pControl)
	{

		if (pTip->m_bVisible == FALSE && pControl->GetHideFlags() == xtpHideWrap)
		{
			CXTPRibbonGroup* pGroup = pControl->GetRibbonGroup();
			if (pGroup && pGroup->GetControlGroupPopup())
			{
				EnsureVisible(pGroup->GetControlGroupPopup());
				pGroup->GetControlGroupPopup()->OnUnderlineActivate();

				int nIndex = pGroup->IndexOf(pControl);

				CXTPCommandBar* pPopupToolBar = pGroup->GetControlGroupPopup()->GetCommandBar();
				if (pPopupToolBar && pPopupToolBar->IsTrackingMode() && nIndex >= 0 &&
					nIndex < pPopupToolBar->GetControlCount())
				{
					pPopupToolBar->GetControl(nIndex)->OnUnderlineActivate();

				}
			}

			return;
		}

		if (pControl->IsVisible())
		{
			pControl->OnUnderlineActivate();
		}

		return;
	}
}
コード例 #5
0
ファイル: MainFrm.cpp プロジェクト: lai3d/ThisIsASoftRenderer
bool CMainFrame::_OnCreateRibbon()
{
	// Initialize the command bars
	if (!InitCommandBars())
		return false;

	// Get a pointer to the command bars object.
	CXTPCommandBars* pCommandBars = GetCommandBars();
	if(pCommandBars == NULL)
		return false;

	CXTPPaintManager::SetTheme(xtpThemeRibbon);

	//关闭默认菜单
	::SetMenu(m_hWnd, nullptr);
	m_hMenuDefault = nullptr;
	m_dwMenuBarState = AFX_MBS_HIDDEN;
	
	//初始化图标
	_LoadIcon();

	///Ribbon
	CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
	if (!pRibbonBar)
		return false;
	pRibbonBar->EnableDocking(0);
	//pRibbonBar->GetTabPaintManager()->m_bSelectOnButtonDown = FALSE;

	///创建系统按钮
	CXTPControlPopup* pControlFile = (CXTPControlPopup*)pRibbonBar->AddSystemButton();
	pControlFile->SetIconId(IDB_GEAR);

	CMenu sysMenu;
	sysMenu.LoadMenu(IDR_MAINFRAME);
	CXTPPopupBar* pCommandBar = new CXTPRibbonSystemPopupBar();
	pCommandBar->SetCommandBars(pCommandBars);
	pControlFile->SetCommandBar(pCommandBar);
	pCommandBar->InternalRelease();
	pCommandBar->LoadMenu(sysMenu.GetSubMenu(0));
	pCommandBar->SetIconSize(CSize(32, 32));

	///RibbonHome
	CXTPRibbonTab* pTab = pRibbonBar->AddTab(L"Home");

	//RibbonHome - GroupObject
	CXTPRibbonGroup* pGroup = pTab->AddGroup(L"Object");
	//RibbonHome - GroupObject - Select
	pGroup->Add(xtpControlButton, IDC_Object_Select);
	//RibbonHome - GroupObject - Move
	pGroup->Add(xtpControlButton, IDC_Object_Move);
	//RibbonHome - GroupObject - Rotate
	pGroup->Add(xtpControlButton, IDC_Object_Rotate);
	//RibbonHome - GroupObject - Scale
	pGroup->Add(xtpControlButton, IDC_Object_Scale);
	//RibbonHome - GroupObject - Rmove
	pGroup->Add(xtpControlButton, IDC_Object_Remove);

	///RibbonEffect
	pTab = pRibbonBar->AddTab(L"Effect");

	//RibbonEffect - GroupSwitch
	pGroup = pTab->AddGroup(L"Switch");
	//RibbonEffect - GroupSwitch - Shadow
	pGroup->Add(xtpControlButton, IDC_Effect_Shadow);
	//RibbonEffect - GroupSwitch - SSAO
	pGroup->Add(xtpControlButton, IDC_Effect_SSAO);
	//RibbonEffect - GroupSwitch - Sharpen
	pGroup->Add(xtpControlButton, IDC_Effect_Sharpen);
	//RibbonEffect - GroupSwitch - FXAA
	pGroup->Add(xtpControlButton, IDC_Effect_FXAA);
	
	return true;
}
コード例 #6
0
void DialogBehaviorTreeEditor::_CreateRibbon()
{
	CXTPPaintManager::SetTheme(xtpThemeRibbon);
	 
	///Ribbon
	CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)GetCommandBars()->Add(_T("Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
	pRibbonBar->ShowCaptionAlways(FALSE);
	pRibbonBar->ShowQuickAccess(FALSE);

	///RibbonHome
	CXTPRibbonTab* pTab = pRibbonBar->AddTab(L"Home");
	//RibbonHome - GroupHome
	CXTPRibbonGroup* pGroup = pTab->AddGroup(L"Home");
	//RibbonHome - GroupHome - NewBT
	pGroup->Add(xtpControlButton, IDC_BTEditor_NewBT);
	//RibbonHome - GroupHome - Refresh
	pGroup->Add(xtpControlButton, IDC_BTEditor_Refresh);
	//RibbonHome - GroupHome - Arrange
	pGroup->Add(xtpControlButton, IDC_BTEditor_Arrange);
	//RibbonHome - GroupHome - Validate
	pGroup->Add(xtpControlButton, IDC_BTEditor_Validate);
//  	//RibbonHome - GroupHome - Sync
//  	pGroup->Add(xtpControlButton, IDC_BTEditor_Sync);
	//RibbonHome - GroupHome - Save
	pGroup->Add(xtpControlButton, IDC_BTEditor_Save);

	//RibbonHome - GroupBlackboard
	pGroup = pTab->AddGroup(L"Blackboard");
	//RibbonHome - GroupBlackboard - AddOwn
	pGroup->Add(xtpControlButton, IDC_BTEditor_AddOwnParam);
	//RibbonHome - GroupBlackboard - AddGlobal
	pGroup->Add(xtpControlButton, IDC_BTEditor_AddRaceParam);

	//RibbonHome - GroupEdit
	pGroup = pTab->AddGroup(L"Edit");
	//RibbonHome - GroupEdit - Sequence
	pGroup->Add(xtpControlButton, IDC_BTEditor_AddSequenceNode);
	//RibbonHome - GroupEdit - Condition
	pGroup->Add(xtpControlButton, IDC_BTEditor_AddConditionNode);
	//RibbonHome - GroupEdit - Action
	pGroup->Add(xtpControlButton, IDC_BTEditor_AddActionNode);
	//RibbonHome - GroupEdit - Delete
	pGroup->Add(xtpControlButton, IDC_BTEditor_Delete);
	
}
コード例 #7
0
ファイル: MainFrm.cpp プロジェクト: mavaL/NeoEngine
bool CMainFrame::_OnCreateRibbon()
{
	// Initialize the command bars
	if (!InitCommandBars())
		return false;

	// Get a pointer to the command bars object.
	CXTPCommandBars* pCommandBars = GetCommandBars();
	if(pCommandBars == NULL)
		return false;

	CXTPPaintManager::SetTheme(xtpThemeRibbon);

	//关闭默认菜单
	::SetMenu(m_hWnd, nullptr);
	m_hMenuDefault = nullptr;
	m_dwMenuBarState = AFX_MBS_HIDDEN;
	
	//初始化图标
	_LoadIcon();

	///Ribbon
	CXTPRibbonBar* pRibbonBar = (CXTPRibbonBar*)pCommandBars->Add(_T("Ribbon"), xtpBarTop, RUNTIME_CLASS(CXTPRibbonBar));
	if (!pRibbonBar)
		return false;
	pRibbonBar->EnableDocking(0);
	//pRibbonBar->GetTabPaintManager()->m_bSelectOnButtonDown = FALSE;

	///创建系统按钮
	CXTPControlPopup* pControlFile = (CXTPControlPopup*)pRibbonBar->AddSystemButton();
	pControlFile->SetIconId(IDB_GEAR);

	CMenu sysMenu;
	sysMenu.LoadMenu(IDR_MAINFRAME);
	CXTPPopupBar* pCommandBar = new CXTPRibbonSystemPopupBar();
	pCommandBar->SetCommandBars(pCommandBars);
	pControlFile->SetCommandBar(pCommandBar);
	pCommandBar->InternalRelease();
	pCommandBar->LoadMenu(sysMenu.GetSubMenu(0));
	pCommandBar->SetIconSize(CSize(32, 32));

	///RibbonHome
	CXTPRibbonTab* pTab = pRibbonBar->AddTab(L"Home");

	//RibbonHome - GroupObject
	CXTPRibbonGroup* pGroup = pTab->AddGroup(L"Object");
	//RibbonHome - GroupObject - Select
	pGroup->Add(xtpControlButton, IDC_Object_Select);
	//RibbonHome - GroupObject - Move
	pGroup->Add(xtpControlButton, IDC_Object_Move);
	//RibbonHome - GroupObject - Rotate
	pGroup->Add(xtpControlButton, IDC_Object_Rotate);
	//RibbonHome - GroupObject - Scale
	pGroup->Add(xtpControlButton, IDC_Object_Scale);
	//RibbonHome - GroupObject - Rmove
	pGroup->Add(xtpControlButton, IDC_Object_Remove);

	///RibbonHome - GroupTerrainModify
	pGroup = pTab->AddGroup(L"Terrain Modify");

	//RibbonHome - GroupTerrainModify - Deform
	pGroup->Add(xtpControlButton, IDC_Terrain_Deform);

	//RibbonHome - GroupTerrainModify - Splat
	CXTPControlPopup* pBtn = dynamic_cast<CXTPControlPopup*>(pGroup->Add(xtpControlSplitButtonPopup, IDC_Terrain_Splat));
	pBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Terrain_Splat_Layer0);
	pBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Terrain_Splat_Layer1);
	pBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Terrain_Splat_Layer2);
	pBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Terrain_Splat_Layer3);
	pBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Terrain_Splat_Layer4);
	
	//RibbonHome - GroupTerrainBrush
	pGroup = pTab->AddGroup(L"Terrain Brush");

	//RibbonHome - GroupTerrainBrush - EditBrushSize
	CXTPControlEdit* pControl = (CXTPControlEdit*)pGroup->Add(xtpControlEdit, ID_Terrain_BrushSize1);
	pControl->ShowSpinButtons(TRUE);

	pControl = (CXTPControlEdit*)pGroup->Add(xtpControlEdit, ID_Terrain_BrushSize2);
	pControl->ShowSpinButtons(TRUE);

	//RibbonHome - GroupTerrainTexture
	pGroup = pTab->AddGroup(L"Layer Texture");
	pGroup->SetControlsCentering(TRUE);

	m_terrainTexGallery = CXTPControlGalleryItems::CreateItems(pCommandBars, IDC_Terrain_LayerTexture);

	CXTPControlGallery* pControlGallery = (CXTPControlGallery*)pGroup->Add(new CXTPControlGallery(), IDC_Terrain_LayerTexture);	
	pControlGallery->SetControlSize(CSize(250, 60));
	//pControlGallery->SetResizable();
	pControlGallery->SetItemsMargin(0, 1, 0, 1);
	pControlGallery->ShowLabels(FALSE);
	pControlGallery->ShowBorders(TRUE);
	pControlGallery->SetItems(m_terrainTexGallery);
	
	_CreateLayerTexIcon();

	//RibbonHome - GroupVegetation
	pGroup = pTab->AddGroup(L"Vegetation");

	//RibbonHome - GroupVegetation - Grass
	pGroup->Add(xtpControlButton, IDC_Vegetation_Grass);

	///RibbonEffect
	pTab = pRibbonBar->AddTab(L"Effect");

	//RibbonEffect - GroupSwitch
	pGroup = pTab->AddGroup(L"Switch");
	//RibbonEffect - GroupSwitch - Shadow
	pGroup->Add(xtpControlButton, IDC_Effect_Shadow);
	//RibbonEffect - GroupSwitch - SSAO
	pGroup->Add(xtpControlButton, IDC_Effect_SSAO);
	//RibbonEffect - GroupSwitch - Sharpen
	pGroup->Add(xtpControlButton, IDC_Effect_Sharpen);
	//RibbonEffect - GroupSwitch - FXAA
	pGroup->Add(xtpControlButton, IDC_Effect_FXAA);

	///RibbonAnimation
	m_animTab = pRibbonBar->InsertTab(-1, L"Animation");
	m_animTab->SetContextTab(xtpRibbonTabContextColorRed, L"Animation");
	//选中了带动画物体才显示
	m_animTab->SetVisible(FALSE);

	//RibbonAnimation - GroupAnim
	pGroup = m_animTab->AddGroup(L"Anim");

	//RibbonAnimation - GroupAnim - AnimList
	m_animList = dynamic_cast<CXTPControlComboBox*>(pGroup->Add(xtpControlComboBox, IDC_Animation_Names));
	m_animList->SetDropDownListStyle();
	m_animList->SetWidth(150);

	//RibbonAnimation - GroupAnim - Play
	pGroup->Add(xtpControlButton, IDC_Animation_Play);

	//RibbonAnimation - GroupAnim - Stop
	pGroup->Add(xtpControlButton, IDC_Animation_Stop);

	//RibbonAnimation - GroupEffect
	pGroup = m_animTab->AddGroup(L"Effect");

	//RibbonAnimation - GroupEffect - EffectList
	m_effectList = dynamic_cast<CXTPControlComboBox*>(pGroup->Add(xtpControlComboBox, IDC_Animation_EffectList));
	m_effectList->SetDropDownListStyle();
	m_effectList->SetWidth(150);

	//RibbonAnimation - GroupEffect - AddEffect
	CXTPControlPopup* pAddBtn = dynamic_cast<CXTPControlPopup*>(pGroup->Add(xtpControlSplitButtonPopup, IDC_Effect_Add));
	pAddBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Effect_AddParticle);
	pAddBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Effect_AddEntityEffect);
	pAddBtn->GetCommandBar()->GetControls()->Add(xtpControlButton, IDC_Effect_AddDLight);

	//RibbonAnimation - GroupEffect - EffectRemove
	pGroup->Add(xtpControlButton, IDC_Animation_EffectRemove);
	
	return true;
}