internal void Show(Vector2d position) { DivElement menu = Document.GetElementById <DivElement>("contextmenu"); while (menu.FirstChild != null) { menu.RemoveChild(menu.FirstChild); } menu.ClassName = "contextmenu"; menu.Style.Display = "block"; menu.Style.Left = position.X.ToString() + "px"; menu.Style.Top = position.Y.ToString() + "px"; Window.AddEventListener("click", NonMenuClick, true); foreach (ToolStripMenuItem item in Items) { if (item.Visible) { DivElement md = (DivElement)Document.CreateElement("div"); if (item.DropDownItems.Count > 0) { md.ClassName = "contextmenuitem submenu"; } else { if (item.Checked) { md.ClassName = "contextmenuitem checkedmenu"; } else { md.ClassName = "contextmenuitem"; } } md.InnerText = item.Name; TagMe it = (TagMe)(Object)md; it.ItemTag = item; md.AddEventListener("mouseover", OpenSubMenu, false); if (item.Click != null) { md.AddEventListener("click", MenuItemClicked, false); } menu.AppendChild(md); } } }
public void Show(Vector2d position) { tile = (SkyImageTile)TileCache.GetTile(0, 0, 0, layer.ImageSet, null); DivElement picker = Document.GetElementById <DivElement>("histogram"); DivElement closeBtn = Document.GetElementById <DivElement>("histogramClose"); /////////////picker.ClassName = "histogram"; picker.Style.Display = "block"; picker.Style.Left = position.X.ToString() + "px"; picker.Style.Top = position.Y.ToString() + "px"; SelectedCurveStyle = (int)image.lastScale; dropDown = Document.GetElementById <SelectElement>("ScaleTypePicker"); dropDown.AddEventListener("change", CurveStyleSelected, false); dropDown.AddEventListener("click", IgnoreMe, true); CanvasElement canvas = Document.GetElementById <CanvasElement>("graph"); canvas.AddEventListener("mousedown", MouseDown, false); canvas.AddEventListener("mousemove", mousemove, false); canvas.AddEventListener("mouseup", mouseup, false); closeBtn.AddEventListener("click", Close, true); Draw(); }
internal void OpenSubMenu(ElementEvent e) { TagMe me = (TagMe)(Object)e.CurrentTarget; ToolStripMenuItem child = me.ItemTag; DivElement menu = Document.GetElementById <DivElement>("popoutmenu"); while (menu.FirstChild != null) { menu.RemoveChild(menu.FirstChild); } menu.Style.Display = "none"; if (child.DropDownItems.Count == 0) { return; } Vector2d position = new Vector2d(); position.X = e.CurrentTarget.ParentNode.OffsetLeft + e.CurrentTarget.ParentNode.ClientWidth; position.Y = e.CurrentTarget.ParentNode.OffsetTop + e.CurrentTarget.OffsetTop; menu.ClassName = "contextmenu"; menu.Style.Display = "block"; menu.Style.Left = position.X.ToString() + "px"; menu.Style.Top = position.Y.ToString() + "px"; Window.AddEventListener("click", NonMenuClick, true); foreach (ToolStripMenuItem item in child.DropDownItems) { if (item.Visible) { DivElement md = (DivElement)Document.CreateElement("div"); md.ClassName = item.Checked ? "contextmenuitem checkedmenu" : "contextmenuitem"; md.InnerText = item.Name; TagMe it = (TagMe)(Object)md; it.ItemTag = item; md.AddEventListener("click", MenuItemClicked, false); menu.AppendChild(md); } } }