public DomElement GetPresentationDomNode(DomElement hostNode) { if (pnode != null) return pnode; //----------------------------------- var doc = hostNode.OwnerDocument; this.pnode = doc.CreateElement("div"); pnode.AddChild("img", item_icon => { menuIcon = item_icon; menuIcon.AttachMouseDownEvent(e => { //**** this.MaintenanceParentOpenState(); if (this.IsOpened) { this.Close(); } else { this.Open(); } e.StopPropagation(); }); menuIcon.AttachMouseUpEvent(e => { this.UnmaintenanceParentOpenState(); e.StopPropagation(); }); menuIcon.AttachEventOnMouseLostFocus(e => { if (!this.MaintenaceOpenState) { this.CloseRecursiveUp(); } }); }); pnode.AddChild("span", content => { if (menuItemText != null) { pnode.AddTextContent(this.menuItemText); } }); //-------------------------------------------------------- //create simple menu item box if (childItems != null) { floatPart = new MenuBox(400, 200); int j = childItems.Count; for (int i = 0; i < j; ++i) { floatPart.AddChildBox(childItems[i]); } } return pnode; }
public DomElement GetPresentationDomNode(DomElement hostNode) { if (pnode != null) { return(pnode); } //----------------------------------- var doc = hostNode.OwnerDocument; this.pnode = doc.CreateElement("div"); pnode.AddChild("img", item_icon => { menuIcon = item_icon; menuIcon.AttachMouseDownEvent(e => { //**** this.MaintenanceParentOpenState(); if (this.IsOpened) { this.Close(); } else { this.Open(); } e.StopPropagation(); }); menuIcon.AttachMouseUpEvent(e => { this.UnmaintenanceParentOpenState(); e.StopPropagation(); }); menuIcon.AttachEventOnMouseLostFocus(e => { if (!this.MaintenaceOpenState) { this.CloseRecursiveUp(); } }); }); pnode.AddChild("span", content => { if (menuItemText != null) { pnode.AddTextContent(this.menuItemText); } }); //-------------------------------------------------------- //create simple menu item box if (childItems != null) { floatPart = new MenuBox(400, 200); int j = childItems.Count; for (int i = 0; i < j; ++i) { floatPart.AddChildBox(childItems[i]); } } return(pnode); }
// public DomElement GetPresentationDomNode(DomElement hostNode) { if (_pnode != null) { return(_pnode); } //----------------------------------- var doc = (HtmlDocument)hostNode.OwnerDocument; _pnode = doc.CreateHtmlDiv(); _pnode.AddHtmlImageElement(item_icon => { _menuIcon = item_icon; _menuIcon.AttachMouseDownEvent(e => { //**** this.MaintainParentOpenState(); if (this.IsOpened) { this.Close(); } else { this.Open(); } e.StopPropagation(); }); _menuIcon.AttachMouseUpEvent(e => { this.UnmaintenanceParentOpenState(); e.StopPropagation(); }); _menuIcon.AttachEvent(UI.UIEventName.MouseLostFocus, e => { if (!this.MaintainOpenState) { this.CloseRecursiveUp(); } }); }); _pnode.AddHtmlSpanElement(content => { if (MenuItemText != null) { _pnode.AddTextContent(this.MenuItemText); } }); //-------------------------------------------------------- //create simple menu item box if (_childItems != null) { _floatPart = new MenuBox(200, 200); int j = _childItems.Count; for (int i = 0; i < j; ++i) { _floatPart.AddChildBox(_childItems[i]); } } return(_pnode); }