public override void Dispose() { base.Dispose(); _elmItems = null; _elmTitle = null; _elmWrapper = null; }
internal override void RefreshInternal() { EnsureDOMElementAndEmpty(); _elmWrapper = new Div(); _elmWrapper.ClassName = "ms-cui-menusection"; ElementInternal.AppendChild(_elmWrapper); if (!string.IsNullOrEmpty(Title)) { _elmTitle = new Div(); UIUtility.SetInnerText(_elmTitle, Title); _elmTitle.ClassName = "ms-cui-menusection-title"; _elmWrapper.AppendChild(_elmTitle); } _elmItems = new UnorderedList(); _elmItems.ClassName = "ms-cui-menusection-items"; string cssclassname; if (_displayMode == "Menu32") { if (Root.TextDirection == Direction.LTR) { cssclassname = "ms-cui-menusection-items32"; } else { cssclassname = "ms-cui-menusection-items32rtl"; } Component parent = Parent; if (parent is Menu) { // For IE7, we can't put a max width on the menu section since hasLayout // will become enabled and force the menu items to not be full-width // We can, however, set a max-width on the menu itself if there are any menu32 // sections within it. (O14:448689) Utility.EnsureCSSClassOnElement(parent.ElementInternal, "ms-cui-menu32"); } } else if (_displayMode == "Menu16") { if (Root.TextDirection == Direction.LTR) { cssclassname = "ms-cui-menusection-items16"; } else { cssclassname = "ms-cui-menusection-items16rtl"; } } else { cssclassname = ""; } if (cssclassname != "") { Utility.EnsureCSSClassOnElement(_elmItems, cssclassname); } if (_scrollable) { _elmItems.Style.OverflowY = "auto"; _elmItems.Style.Position = "relative"; } if (!string.IsNullOrEmpty(_maxHeight)) _elmItems.Style.MaxHeight = _maxHeight; _elmWrapper.AppendChild(_elmItems); AppendChildrenToElement(_elmItems); }
public void Dispose() { _elmMain = null; _elmTitle = null; _elmTabTitleContainer = null; _tabCount = 0; }
/// <summary> /// Named "Attempt" because it is a valid case if the DOM element is not present in the DOM. /// This is unlike all the components whose DOM elements are expected to be there and /// it is a bug if they are not when Attach() is called. /// </summary> internal void AttemptAttachDOMElements() { ListItem elm = (ListItem)Browser.Document.GetById(Id); if (!CUIUtility.IsNullOrUndefined(elm)) { _elmMain = elm; _elmTitle = (Div)_elmMain.ChildNodes[0].ChildNodes[0]; _elmTabTitleContainer = (UnorderedList)_elmMain.ChildNodes[1]; } }
internal override void AttachDOMElements() { // Attach the outer Ribbon Element base.AttachDOMElements(); DomNodeCollection childElms = ElementInternal.ChildNodes; _elmScrollCurtain = Browser.Document.GetById("cui-" + Id + "-scrollCurtain"); _elmNavigationInstructions = (Span)childElms[0]; _elmRibbonTopBars = (Div)childElms[1]; _elmTopBar1 = (Div)_elmRibbonTopBars.ChildNodes[0]; _elmTopBar2 = (Div)_elmRibbonTopBars.ChildNodes[1]; _elmJewelPlaceholder = (Div)_elmTopBar2.ChildNodes[0]; if (childElms.Length > 2) _elmTabContainer = (Div)childElms[2]; _elmQATPlaceholder = (Span)Utility.GetFirstChildElementByClassName(_elmTopBar1, "ms-cui-qat-container"); _elmTabTitles = (UnorderedList)Utility.GetFirstChildElementByClassName(_elmTopBar2, "ms-cui-tts"); if (CUIUtility.IsNullOrUndefined(_elmTabTitles)) _elmTabTitles = (UnorderedList)Utility.GetFirstChildElementByClassName(_elmTopBar2, "ms-cui-tts-scale-1"); if (CUIUtility.IsNullOrUndefined(_elmTabTitles)) _elmTabTitles = (UnorderedList)Utility.GetFirstChildElementByClassName(_elmTopBar2, "ms-cui-tts-scale-2"); }
public override void Dispose() { Disposed = true; Root root = this.Root; if (!CUIUtility.IsNullOrUndefined(root)) { int timer = root.TooltipLauncherTimer; if (!CUIUtility.IsNullOrUndefined(timer)) { Browser.Window.ClearTimeout(timer); } root.CloseOpenTootips(); } // This property set will remove the event handler WindowResizedHandlerEnabled = false; ElementInternal.KeyDown -= OnRibbonEscKeyPressed; if (_eventHandlerAttached) { ElementInternal.KeyDown -= OnKeydownGroupShortcuts; Browser.Document.KeyDown -= OnKeydownRibbonShortcuts; } base.Dispose(); _previousTab = null; _selectedTab = null; _elmRibbonTopBars = null; _elmTabTitles = null; _elmJewelPlaceholder = null; _elmTabContainer = null; _elmTabRowLeft = null; _elmTabRowRight = null; _elmQATPlaceholder = null; _elmQATRowCenter = null; _elmQATRowRight = null; _elmTopBar1 = null; _elmTopBar2 = null; foreach (ContextualGroup cg in _contextualGroups.Values) { cg.Dispose(); } _contextualGroups.Clear(); _contextualGroups = null; }
private void HandlePeripheralsAndTabTitles() { if (!_peripheralContentsLoaded && !CUIUtility.IsNullOrUndefined(_elmQATRowCenter) && _elmQATRowCenter.ParentNode != _elmTopBar1) { if (_elmQATRowCenter.ParentNode != null) _elmQATRowCenter.ParentNode.RemoveChild(_elmQATRowCenter); _elmTopBar1.AppendChild(_elmQATRowCenter); _elmQATRowCenter.Style.Display = "inline-block"; _elmTopBar1.Style.Display = "block"; Utility.SetUnselectable(_elmQATRowCenter, true, false); } if (!_peripheralContentsLoaded && !CUIUtility.IsNullOrUndefined(_elmQATRowRight) && _elmQATRowRight.ParentNode != _elmTopBar1) { if (_elmQATRowRight.ParentNode != null) _elmQATRowRight.ParentNode.RemoveChild(_elmQATRowRight); _elmTopBar1.AppendChild(_elmQATRowRight); _elmQATRowRight.Style.Display = "inline-block"; _elmTopBar1.Style.Display = "block"; Utility.SetUnselectable(_elmQATRowRight, true, false); } if (!_peripheralContentsLoaded && !CUIUtility.IsNullOrUndefined(_elmTabRowLeft) && _elmTabRowLeft.ParentNode != _elmTopBar2) { if (_elmTabRowLeft.ParentNode != null) _elmTabRowLeft.ParentNode.RemoveChild(_elmTabRowLeft); _elmTopBar2.AppendChild(_elmTabRowLeft); _elmTabRowLeft.Style.Display = "block"; Utility.SetUnselectable(_elmTabRowLeft, true, false); } if (CUIUtility.IsNullOrUndefined(_elmTabTitles)) { _elmTabTitles = new UnorderedList(); _elmTabTitles.SetAttribute("role", "tablist"); // We purposely don't match the server rendering here by setting "ms-cui-disabled" // because we don't wait it to flash disabled/enabled when the first tab is expanded. _elmTabTitles.ClassName = "ms-cui-tts"; _elmTopBar2.AppendChild(_elmTabTitles); } if (!_peripheralContentsLoaded && !CUIUtility.IsNullOrUndefined(_elmTabRowRight) && _elmTabRowRight.ParentNode != _elmTopBar2) { if (_elmTabRowRight.ParentNode != null) _elmTabRowRight.ParentNode.RemoveChild(_elmTabRowRight); _elmTopBar2.AppendChild(_elmTabRowRight); _elmTabRowRight.Style.Display = "block"; Utility.SetUnselectable(_elmTabRowRight, true, false); } // All peripheral contents should be loaded by now if they are set _peripheralContentsLoaded = true; }