AddChildBox() public method

public AddChildBox ( MenuItem mnuItem ) : void
mnuItem MenuItem
return void
Esempio n. 1
0
        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;
        }
Esempio n. 2
0
 public void AddSubMenuItem(MenuItem childItem)
 {
     if (childItems == null)
     {
         childItems = new List <MenuItem>();
     }
     this.childItems.Add(childItem);
     childItem.ParentMenuItem = this;
     if (floatPart != null)
     {
         floatPart.AddChildBox(childItem);
     }
 }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        //
        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);
        }