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); } }
CXTPRibbonTab* CXTPRibbonControlTab::FindTab(int nID) const { for (int i = 0; i < GetItemCount(); i++) { CXTPRibbonTab* pTab = (CXTPRibbonTab*)GetItem(i); if (pTab->GetID() == nID) return pTab; } return NULL; }
BOOL CXTPRibbonBuilder::BuildCategories(CXTPPropExchange* pPX, CXTPRibbonBar* pRibbonBar) { CXTPPropExchangeEnumeratorPtr pEnumerator(pPX->GetEnumerator(_T("CATEGORY"))); POSITION pos = pEnumerator->GetPosition(0); while (pos) { CXTPPropExchangeSection pxTab(pEnumerator->GetNext(pos)); CString strElementName; PX_String(&pxTab, _T("ELEMENT_NAME"), strElementName); CCmdTarget* pElement = CreateElement(strElementName); if (pElement == NULL) continue; CXTPRibbonTab* pTab = DYNAMIC_DOWNCAST(CXTPRibbonTab, pElement); if (!pTab) { delete pElement; continue; } CString strName; PX_String(&pxTab, _T("NAME"), strName); pTab->SetCaption(strName); CString strKeys; PX_String(&pxTab, _T("KEYS"), strKeys); pTab->SetKeyboardTip(strKeys); pRibbonBar->InsertTab(pRibbonBar->GetTabCount(), pTab); m_arrImageLarge.RemoveAll(); m_arrImageSmall.RemoveAll(); CXTPPropExchangeSection pxPanels(pxTab->GetSection(_T("PANELS"))); BuildGroups(&pxPanels, pTab); LoadIcons(&pxTab); } return TRUE; }
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); }
void CXTPRibbonControlTab::Copy(CXTPControl* pControl, BOOL /*bRecursive = FALSE*/) { DeleteAllItems(); CXTPRibbonControlTab* pControlTab = (CXTPRibbonControlTab*)pControl; for (int i = 0; i < pControlTab->GetItemCount(); i++) { CXTPRibbonTab* pTab = pControlTab->GetTab(i); CXTPRibbonTab* pTabClone = (CXTPRibbonTab*)pTab->GetRuntimeClass()->CreateObject(); pTabClone->m_pRibbonBar = (CXTPRibbonBar*)GetParent(); pTabClone->m_pParent = (CXTPRibbonBar*)GetParent(); AddItem(i, pTabClone); pTabClone->Copy(pTab); } }
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; }
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; }