/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">uiElement for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified element</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is BarManager) { return(new BarsUIAdapter(((BarManager)uiElement).Bars)); } if (uiElement is Bar) { return(new BarLinksCollectionUIAdapter(((Bar)uiElement).ItemLinks, ((Bar)uiElement).Manager.Items)); } if (uiElement is BarSubItem) { return(new BarLinksCollectionUIAdapter(((BarSubItem)uiElement).ItemLinks, ((BarSubItem)uiElement).Manager.Items)); } if (uiElement is BarItemWrapper) { return(new BarLinksOwnerCollectionUIAdapter(((BarItemWrapper)uiElement).Item, ((BarItemWrapper)uiElement).ItemLinks)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">uiElement for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified element</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is RibbonControl) { return(new RibbonPageCollectionUIAdapter(((RibbonControl)uiElement).Pages)); } if (uiElement is RibbonPage) { return(new RibbonPageGroupCollectionUIAdapter(((RibbonPage)uiElement).Groups)); } if (uiElement is RibbonPageGroup) { return(new BarLinksCollectionUIAdapter(((RibbonPageGroup)uiElement).ItemLinks, ((RibbonPageGroup)uiElement).Ribbon.Items)); } if (uiElement is RibbonPageCollection) { return(new RibbonPageCollectionUIAdapter(((RibbonPageCollection)uiElement))); } if (uiElement is RibbonPageCategoryCollection) { return(new RibbonPageCategoryCollectionUIAdapter((RibbonPageCategoryCollection)uiElement)); } if (uiElement is RibbonPageCategory) { return(new RibbonPageCollectionUIAdapter(((RibbonPageCategory)uiElement).Pages)); } if (uiElement is BarItemWrapper) { return(new BarLinksOwnerCollectionUIAdapter(((BarItemWrapper)uiElement).Item, ((BarItemWrapper)uiElement).ItemLinks)); } if (uiElement is RibbonQuickAccessToolbar) { return(new RibbonQuickAccessToolbarUIAdapter((RibbonQuickAccessToolbar)uiElement)); } if (uiElement is RibbonStatusBar) { return(new RibbonStatusBarUIAdapter((RibbonStatusBar)uiElement)); } // added lines below for issue 10296 if (uiElement is PopupMenu) { return(new BarLinksCollectionUIAdapter(((PopupMenu)uiElement).ItemLinks, ((PopupMenu)uiElement).Ribbon.Items)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">uiElement for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified element</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is NavigatorCustomButtons) { return(new NavigatorCustomButtonUIAdapter((NavigatorCustomButtons)uiElement)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">uiElement for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified element</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is EditorButtonCollection) { return(new EditorButtonCollectionUIAdapter((EditorButtonCollection)uiElement)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">uiElement for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified element</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is NavBarControl) { return(new NavBarGroupCollectionUIAdapter(((NavBarControl)uiElement).Groups)); } if (uiElement is NavBarGroup) { return(new NavBarItemCollectionUIAdapter(((NavBarGroup)uiElement).ItemLinks, ((NavBarGroup)uiElement).NavBar.Items)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">uiElement for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified element</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is AccordionControl) { return(new AccordionControlGroupCollectionUIAdapter(((AccordionControl)uiElement).Elements)); } //if (uiElement is AccordionControlElement && ((AccordionControlElement)uiElement).Style == ElementStyle.Group) if (uiElement is AccordionControlElement) { return(new AccordionControlElementCollectionUIAdapter(((AccordionControlElement)uiElement).Elements)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">UltraStatusBar for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified <see cref="UltraStatusBar"/></returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is UltraStatusBar) { return(new StatusPanelsCollectionUIAdapter(((UltraStatusBar)uiElement).Panels)); } else if (uiElement is UltraStatusPanelsCollection) { return(new StatusPanelsCollectionUIAdapter((UltraStatusPanelsCollection)uiElement)); } else if (uiElement is UltraStatusPanel) { return(new StatusPanelOwnerUIAdapter((UltraStatusPanel)uiElement)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), this.GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">UltraToolbar or PopupMenuTool for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified <see cref="UltraToolbar"/> or <see cref="PopupMenuTool"/></returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is TreeNodesCollection) { return(new TreeNodesCollectionUIAdapter((TreeNodesCollection)uiElement)); } if (uiElement is UltraTree) { return(new TreeNodesCollectionUIAdapter(((UltraTree)uiElement).Nodes)); } else if (uiElement is UltraTreeNode) { return(new TreeNodeOwnerUIAdapter((UltraTreeNode)uiElement)); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), this.GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <param name="uiElement">UltraExplorerBarGroup for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified <see cref="UltraExplorerBarGroup"/></returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is UltraExplorerBarItemsCollection) { return(new ExplorerBarItemsCollectionUIAdapter((UltraExplorerBarItemsCollection)uiElement)); } if (uiElement is UltraExplorerBarItem) { return(new ExplorerBarItemOwnerUIAdapter(((UltraExplorerBarItem)uiElement))); } if (uiElement is UltraExplorerBar) { return(new ExplorerBarGroupsCollectionUIAdapter(((UltraExplorerBar)uiElement).Groups)); } if (uiElement is UltraExplorerBarGroup) { return(new ExplorerBarGroupOwnerUIAdapter(((UltraExplorerBarGroup)uiElement))); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), this.GetType()); }
/// <summary> /// Returns a <see cref="IUIElementAdapter"/> for the specified uielement. /// </summary> /// <remarks> /// <p class="body">The GetAdapter method can be used with any of the following items:</p> /// <list type="bullet"> /// <item> /// <term>UltraToolbar</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) that adds ToolBase instances to the end of the toolbar's Tools collection.</description> /// </item> /// <item> /// <term>ApplicationMenuArea</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) that adds ToolBase instances to the end of the ApplicationMenuArea's Tools collection.</description> /// </item> /// <item> /// <term>ApplicationMenuFooterToolbar</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) that adds ToolBase instances to the end of the ApplicationMenuFooterToolbar's Tools collection.</description> /// </item> /// <item> /// <term>ToolsCollection</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) for the Tools collection of a UltraToolbarBase derived class, RibbonGroup, ApplicationMenuArea or PopupMenuTool that will add ToolBase instance to the end of the collection.</description> /// </item> /// <item> /// <term>ToolBase</term> /// <description>Creates an adapter (<see cref="ToolBaseOwnerUIAdapter"/>) that adds ToolBase instances in the owning Tools collection after the position at which the specified tool exists.</description> /// </item> /// <item> /// <term>Ribbon</term> /// <description>Create an adapter (<see cref="RibbonTabsCollectionUIAdapter"/>) that can be used to add RibbonTab instances to the Tabs collection of the specified Ribbon.</description> /// </item> /// <item> /// <term>RibbonTabCollection</term> /// <description>Creates an adapter (<see cref="RibbonTabsCollectionUIAdapter"/>) that can be used to add RibbonTab instances to the Ribbon.</description> /// </item> /// <item> /// <term>RibbonTab</term> /// <description>Creates an adapter (<see cref="RibbonTabOwnerUIAdapter"/>) that can be used to add RibbonTab instances to the ribbon at the position after the specified tab. If the tab belongs to a contextual tab group then the added tabs will be added to the same contextual tab group.</description> /// </item> /// <item> /// <term>RibbonGroupCollection</term> /// <description>Creates an adapter (<see cref="RibbonGroupsCollectionUIAdapter"/>) that can be used to add RibbonGroup instances to the specified groups collection.</description> /// </item> /// <item> /// <term>RibbonGroup</term> /// <description>Creates an adapter (<see cref="RibbonGroupOwnerUIAdapter"/>) that can be used to add RibbonGroup instances in the owning tab's Groups collection at the position directly after the specified group.</description> /// </item> /// <item> /// <term>ContextualTabGroup</term> /// <description>Creates an adapter (<see cref="ContextualTabGroupUIAdapter"/>) that can be used to add RibbonTab instances to the Ribbon's Tabs collection and also makes the RibbonTab part of the ContextualTab's Tabs collection.</description> /// </item> /// <item> /// <term>ContextualTabGroupCollection</term> /// <description>Creates an adapter (<see cref="ContextualTabGroupCollectionUIAdapter"/>) that can be used to add ContextualTabGroup instances to the Ribbon's contextual tab groups collection.</description> /// </item> /// <item> /// <term>MiniToolbar</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) that adds ToolBase instances to the end of the MiniToolbar's Tools collection.</description> /// </item> /// <item> /// <term>RibbonTabItemToolbar</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) that adds ToolBase instances to the end of the RibbonTabItemToolbar's Tools collection.</description> /// </item> /// <item> /// <term>QuickAccessToolbar</term> /// <description>Creates an adapter (<see cref="ToolsCollectionUIAdapter"/>) that adds ToolBase instances to the end of the QuickAccessToolbar's Tools collection.</description> /// </item> /// </list> /// </ul> /// </remarks> /// <param name="uiElement">ToolbarsManager related object for which to return a <see cref="IUIElementAdapter"/></param> /// <returns>A <see cref="IUIElementAdapter"/> that represents the specified object</returns> public IUIElementAdapter GetAdapter(object uiElement) { Guard.ArgumentNotNull(uiElement, "uiElement"); if (uiElement is UltraTaskPaneToolbar) { throw ExceptionFactory.CreateInvalidElementHost(uiElement.GetType()); } else if (uiElement is UltraToolbarBase) { Debug.Assert(uiElement is UltraToolbar || uiElement is ApplicationMenuFooterToolbar || uiElement is RibbonTabItemToolbar || uiElement is MiniToolbar || uiElement is QuickAccessToolbar, "Unexpected toolbar type"); return(new ToolsCollectionUIAdapter(((UltraToolbar)uiElement).Tools)); } else if (uiElement is ApplicationMenuArea) { return(new ToolsCollectionUIAdapter(((ApplicationMenuArea)uiElement).Tools)); } else if (uiElement is ToolsCollection) { return(new ToolsCollectionUIAdapter((ToolsCollection)uiElement)); } else if (uiElement is ToolBase) { return(new ToolBaseOwnerUIAdapter((ToolBase)uiElement)); } else if (uiElement is Ribbon) { return(new RibbonTabsCollectionUIAdapter(((Ribbon)uiElement).Tabs)); } else if (uiElement is RibbonTabCollection) { return(new RibbonTabsCollectionUIAdapter(((RibbonTabCollection)uiElement))); } else if (uiElement is RibbonTab) { return(new RibbonTabOwnerUIAdapter(((RibbonTab)uiElement))); } else if (uiElement is RibbonGroupCollection) { return(new RibbonGroupsCollectionUIAdapter(((RibbonGroupCollection)uiElement))); } else if (uiElement is RibbonGroup) { return(new RibbonGroupOwnerUIAdapter(((RibbonGroup)uiElement))); } else if (uiElement is ContextualTabGroup) { return(new ContextualTabGroupUIAdapter(((ContextualTabGroup)uiElement))); } else if (uiElement is ContextualTabGroupCollection) { return(new ContextualTabGroupCollectionUIAdapter(((ContextualTabGroupCollection)uiElement))); } throw ExceptionFactory.CreateInvalidAdapterElementType(uiElement.GetType(), this.GetType()); }