Exemplo n.º 1
0
 void SetupNodeIconBehaviour(DomElement uiNodeIcon)
 {
     uiNodeIcon.AttachMouseDownEvent(e =>
     {
         if (this.IsOpen)
         {
             //then close
             this.Collapse();
         }
         else
         {
             this.Expand();
         }
     });
 }
Exemplo n.º 2
0
        public void AddItem(DomElement item)
        {
            if (_items == null)
            {
                _items = new List <DomElement>();
            }
            item.AttachMouseDownEvent(ItemSelected);

            _items.Add(item);
            //
            //
            if (_div_floatingPart != null)
            {
                _div_floatingPart.AddChild(item);
            }
        }
Exemplo n.º 3
0
 DomElement CreateFloatPartDom(WebDom.Impl.HtmlDocument htmldoc)
 {
     //create land part
     _div_floatingPart = htmldoc.CreateElement("div");
     _div_floatingPart.SetAttribute("style", "background-color:white;position:absolute;left:0px;top:0px;width:300px;height:500px;");
     if (_items != null)
     {
         int j = _items.Count;
         for (int i = 0; i < j; ++i)
         {
             _div_floatingPart.AddChild(_items[i]);
         }
     }
     //---------------------------------------
     _div_glassCover = htmldoc.CreateElement("div");
     _div_glassCover.SetAttribute("style", "position:absolute;width:100%;height:100%;");
     _div_glassCover.AddChild(_div_floatingPart);
     _div_glassCover.AttachMouseDownEvent(e =>
     {
         //when click on cover glass
         CloseHinge();
     });
     return(_div_floatingPart);
 }
Exemplo n.º 4
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);
        }