示例#1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            SingleWindow singleWindow = new SingleWindow();

            singleWindow.TopLevel  = false;
            singleWindow.Location  = new Point(10, 50);
            singleWindow.MdiParent = this;
            singleWindow.Text     += " 1";
            singleWindow.Show();
            singleWindow.WindowState = FormWindowState.Maximized;
            menuStrip.BringToFront();
            toolStrip.BringToFront();

            ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem();

            toolStripMenuItem.Text   = singleWindow.Text;
            toolStripMenuItem.Click += delegate
            {
                singleWindow.Focus();
                foreach (var item in окноToolStripMenuItem.DropDownItems)
                {
                    if (item is ToolStripMenuItem)
                    {
                        (item as ToolStripMenuItem).Checked = false;
                    }
                }
                toolStripMenuItem.Checked = true;
            };
            окноToolStripMenuItem.DropDownItems.Add(toolStripMenuItem);
            _childWindows.Add(singleWindow);
        }
        public static TexturesCache texturesCache = new TexturesCache();         //to store icons


        public static void DrawRightClickItems(UI ui, Vector2 mousePos, Graph graph)
        {
            Item item = RightClickItems(ui, mousePos, graph);

            //#if MM_EXP || UNITY_2020_1_OR_NEWER || UNITY_EDITOR_LINUX
            SingleWindow menu = new SingleWindow(item);

            //#else
            //PopupMenu menu = new PopupMenu() {items=item.subItems, minWidth=150};
            //#endif

            menu.Show(Event.current.mousePosition);
        }
示例#3
0
        private void новоеToolStripMenuItem_Click(object sender, EventArgs e)
        {
            SingleWindow singleWindow = new SingleWindow();

            singleWindow.TopLevel  = false;
            singleWindow.Location  = new Point(10, 50);
            singleWindow.MdiParent = this;
            int max = 0;

            try
            {
                max = _childWindows.Where(w => w.Text != "").Max(c => Convert.ToInt32(c.Text.Split(' ')[2]));
            }
            catch
            {
                max = 0;
            }
            singleWindow.Text += " " + (max + 1);
            singleWindow.Show();
            singleWindow.WindowState = FormWindowState.Maximized;
            menuStrip.BringToFront();
            toolStrip.BringToFront();

            ToolStripMenuItem toolStripMenuItem = new ToolStripMenuItem();

            toolStripMenuItem.Text   = singleWindow.Text;
            toolStripMenuItem.Click += delegate
            {
                singleWindow.Focus();
                foreach (var item in окноToolStripMenuItem.DropDownItems)
                {
                    if (item is ToolStripMenuItem)
                    {
                        (item as ToolStripMenuItem).Checked = false;
                    }
                }
                toolStripMenuItem.Checked = true;
            };
            окноToolStripMenuItem.DropDownItems.Add(toolStripMenuItem);
            _childWindows.Add(singleWindow);
            foreach (var item in окноToolStripMenuItem.DropDownItems)
            {
                if (item is ToolStripMenuItem)
                {
                    (item as ToolStripMenuItem).Checked = false;
                }
            }
            toolStripMenuItem.Checked = true;
        }
        private static void DrawItem(Item item)
        {
                        #if !MM_EXP
            PopupMenu menu = new PopupMenu()
            {
                items = item.subItems, minWidth = 150
            };
                        #else
            SingleWindow menu = new SingleWindow()
            {
                rootItem = item
            };
                        #endif

            menu.Show(Event.current.mousePosition);
        }
        public static TexturesCache texturesCache = new TexturesCache();         //to store icons


        public static void DrawRightClickItems(UI ui, Vector2 mousePos, Graph graph)
        {
            Item item = RightClickItems(ui, mousePos, graph);

                        #if !MM_EXP
            PopupMenu menu = new PopupMenu()
            {
                items = item.subItems, minWidth = 150
            };
                        #else
            SingleWindow menu = new SingleWindow()
            {
                rootItem = item
            };
                        #endif

            menu.Show(Event.current.mousePosition);
        }
        public void OnGUI()
        {
            if (Event.current.type == EventType.MouseDown && Event.current.button == 1)
            {
                Item menu = new Item("Menu");
                menu.subItems = new List <Item>()
                {
                    new Item("Create", new Item("Map"), new Item("Objects"), new Item("Splines")),
                    new Item("Generator"),
                    new Item("Group"),
                    new Item("Graph")
                };
                menu.color = new Color(0.8f, 0.8f, 0.8f);

                SingleWindow window = new SingleWindow()
                {
                    rootItem = menu, width = 150
                };
                window.Show(Event.current.mousePosition);
            }
        }