示例#1
0
 /// <summary>
 /// Encoge-contrae el menú expandido. Shrink = encoger
 /// </summary>
 public void SetShrink()
 {
     if (expandMenu != null)
     {
         expandMenu.Shrink();
     }
     expandMenu = null;
     expand = false;
 }
示例#2
0
 public void AddMenu(Menu menu)
 {
     menuList.Add(menu);
     menu.SetMenuBar(this);
     UpdateLayout();
 }
示例#3
0
        /// <summary>
        /// Contrae el menú expandido actual Y después establece el menú expandido al pasado como parámetro.
        /// </summary>
        /// <param name="expandMenu"></param>
        public void SetExpand(Menu expandMenu)
        {
            if (this.expandMenu != null)
                this.expandMenu.Shrink();

            this.expandMenu = expandMenu;
            expand = true;
        }
示例#4
0
        public override void PaintMenu(Menu component)
        {
            float x1 = 0;
            float y1 = 0;
            float x2 = 0;
            float y2 = 0;

            if (component.IsExpand)
            {
                x1 = component.Position.X;
                y1 = component.Position.Y;
                x2 = component.Position.X + component.Size.width;
                y2 = component.Position.Y + component.Size.height;

                GL.Disable(EnableCap.Texture2D);
                GL.Color3((byte)44, (byte)55, (byte)55);
                GL.Begin(BeginMode.Quads);
                GL.Vertex2(x1 + 6, y1);
                GL.Vertex2(x2 - 6, y1);
                GL.Vertex2(x2 - 6, y2);
                GL.Vertex2(x1 + 6, y2);
                GL.End();
                GL.Enable(EnableCap.Texture2D);
                GL.Color3((byte)255, (byte)255, (byte)255);
                menuLeft.Paint(x1, y1, x1 + 6, y2);
                menuRight.Paint(x2 - 6, y1, x2, y2);
                GL.Color3((byte)150, (byte)155, (byte)161);
            }
            else
            {
                switch (component.GetStatus)
                {
                    case EStatus.Hover:
                        // flotar
                        {
                            x1 = component.Position.X;
                            y1 = component.Position.Y;
                            x2 = component.Position.X + component.Size.width;
                            y2 = component.Position.Y + component.Size.height;

                            GL.Disable(EnableCap.Texture2D);
                            GL.Color3((byte)44, (byte)55, (byte)55);
                            GL.Begin(BeginMode.Quads);
                            GL.Vertex2(x1 + 6, y1);
                            GL.Vertex2(x2 - 6, y1);
                            GL.Vertex2(x2 - 6, y2);
                            GL.Vertex2(x1 + 6, y2);
                            GL.End();
                            GL.Enable(EnableCap.Texture2D);
                            GL.Color3((byte)255, (byte)255, (byte)255);
                            menuLeft.Paint(x1, y1, x1 + 6, y2);
                            menuRight.Paint(x2 - 6, y1, x2, y2);
                            GL.Color3((byte)150, (byte)155, (byte)161);
                            break;
                        }


                    case EStatus.Normal:
                        {
                            x1 = component.Position.X;
                            y1 = component.Position.Y;
                            GL.Color3((byte)150, (byte)155, (byte)161);
                            break;
                        }


                    case EStatus.Pressed:
                        {
                            x1 = component.Position.X;
                            y1 = component.Position.Y;
                            GL.Color3((byte)250, (byte)250, (byte)250);
                            break;
                        }


                }
            }
            component.textFont.PosX = (int)(x1 + 3);
            component.textFont.PosY = (int)(y1 + 0);
            component.textFont.Render(true);
        }
示例#5
0
 private MenuBar()
 {
     //leftSpacer = 45;
     rightSpacer = 45;
     topSpacer = 5;
     //bottomSpacer = 5;
     expand = false;
     expandMenu = null;
 }
示例#6
0
 public override Size GetMenuPreferedSize(Menu component)
 {
     UI.Instance.CurrentTheme.defaultTextFont.MeasureString(component.Text, out w, out h);
     return new Size(12 + (uint)w, 19);
 }
示例#7
0
 public abstract void PaintMenu(Menu component);
示例#8
0
 public abstract Size GetMenuPreferedSize(Menu component);
示例#9
0
        public MainV3(uint width, uint height)
            : base((int)width, (int)height)
        {
            MainV3.instance = this;

            UI.Instance.Init(width, height);
            Keyboard.KeyDown += Keyboard_KeyDown;
            Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonDown);
            Mouse.ButtonUp += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonUp);

            Menu menuConnect = new Menu("Connect");
            Menu menuFlightData = new Menu("FlightData");
            Menu menuFlightPlanner = new Menu("FlightPlanner");
            Menu menuConfig = new Menu("Config");
            Menu menuFirmware = new Menu("Firmware");
            Menu menuTerminal = new Menu("Terminal");
            Menu menuHelp = new Menu("Help");
            Menu menuExit = new Menu("Exit");

            MenuItemButton menuItemPort = new MenuItemButton("Port");
            MenuItemButton menuItemBaud = new MenuItemButton("Baud");

            menuConnect.AddItem(menuItemPort);
            menuConnect.AddItem(menuItemBaud);

            MenuBar.Instance.AddMenu(menuConnect);
            MenuBar.Instance.AddMenu(menuFlightData);
            MenuBar.Instance.AddMenu(menuFlightPlanner);
            MenuBar.Instance.AddMenu(menuConfig);
            MenuBar.Instance.AddMenu(menuFirmware);
            MenuBar.Instance.AddMenu(menuTerminal);
            MenuBar.Instance.AddMenu(menuHelp);
            MenuBar.Instance.AddMenu(menuExit);

            menuConnect.MousePressedEvent += new MousePressedHandler(MenuConnect_Click);
            menuExit.MousePressedEvent += new AssortedWidgets.Widgets.MousePressedHandler(menuItemFileExit_MousePressedEvent);

            Dialog dl = new Dialog("test", 23, 32, 150, 150);
            PictureBox picb = new PictureBox();
            picb.Image = ArdupilotMega.Properties.Resources.x8;

            dl.Add(picb);

            DialogManager.Instance.SetModelessDialog(dl);

            CustomMessageBox.Show("test", "test2",MessageBox.MessageBoxButtons.YesNo);
        }
示例#10
0
        public void Init(uint width, uint height)
        {
            ReSize(width, height);

            DefaultTheme theme = new DefaultTheme(width, height);
            theme.Setup("aw.png", "./Resources/");
            //selectionManager.setup(width,height);
            UI.Instance.CurrentTheme = theme;
            MenuBar.Instance.Init(width);

            menuFile = new Menu("File");
            menuItemFileOpen = new MenuItemButton("Open");
            menuItemFileSave = new MenuItemButton("Save");
            menuItemFileSaveAs = new MenuItemButton("Save As");
            menuItemFileSeparator = new MenuItemSeparator();
            menuItemFileExit = new MenuItemButton("Exit");
            menuItemFileExport = new MenuItemSubMenu("Export");
            menuItemFilePNG = new MenuItemSubMenu("PNG Image");
            menuItemFilePNGNone = new MenuItemButton("None");
            menuItemFilePNGInterlaced = new MenuItemButton("Interlaced");
            menuItemFilePNG.AddItem(menuItemFilePNGNone);
            menuItemFilePNG.AddItem(menuItemFilePNGInterlaced);
            menuItemFileJPEG = new MenuItemButton("JPEG Image");
            menuItemFileExport.AddItem(menuItemFilePNG);
            menuItemFileExport.AddItem(menuItemFileJPEG);
            menuItemFileImport = new MenuItemSubMenu("Import");
            menuItemFile3DS = new MenuItemButton("3DS Model");
            menuItemFileOBJ = new MenuItemButton("OBJ Model");
            menuItemFileSIA = new MenuItemButton("SIA Model");
            menuItemFileImport.AddItem(menuItemFile3DS);
            menuItemFileImport.AddItem(menuItemFileOBJ);
            menuItemFileImport.AddItem(menuItemFileSIA);
            menuFile.AddItem(menuItemFileOpen);
            menuFile.AddItem(menuItemFileSave);
            menuFile.AddItem(menuItemFileSaveAs);
            menuFile.AddItem(menuItemFileExport);
            menuFile.AddItem(menuItemFileImport);
            menuFile.AddItem(menuItemFileSeparator);
            menuFile.AddItem(menuItemFileExit);

            menuHelp = new Menu("Help");
            menuItemHelpAbout = new MenuItemButton("About");
            menuItemHelpHelp = new MenuItemButton("Help");
            menuHelp.AddItem(menuItemHelpAbout);
            menuHelp.AddItem(menuItemHelpHelp);

            menuAssortedWidgetsTest = new Menu("Assorted Widgets Test");

            dialogTestDialog = new DialogTestDialog();
            menuItemDialogTest = new MenuItemButton("Modal Dialog Test");
            menuAssortedWidgetsTest.AddItem(menuItemDialogTest);

            checkNRadioTestDialog = new CheckNRadioTestDialog();
            menuItemCheckNRadioTest = new MenuItemButton("Check & Radio Test");
            menuAssortedWidgetsTest.AddItem(menuItemCheckNRadioTest);

            progressNSliderTestDialog = new ProgressNSliderTestDialog();
            menuItemProgressNSliderTest = new MenuItemButton("Progress & Slider Test");
            menuAssortedWidgetsTest.AddItem(menuItemProgressNSliderTest);

            multipleLayoutTestDialog = new MultipleLayoutTestDialog();
            menuItemMultipleTest = new MenuItemButton("MultipleLayout Test");
            menuAssortedWidgetsTest.AddItem(menuItemMultipleTest);

            scrollPanelTestDialog = new ScrollPanelTestDialog();
            menuItemScrollPanelTest = new MenuItemButton("Scroll Panel Test");
            menuAssortedWidgetsTest.AddItem(menuItemScrollPanelTest);

            textNDropTestDialog = new TextNDropTestDialog();
            menuItemTextNDropTest = new MenuItemButton("DropList Test");
            menuAssortedWidgetsTest.AddItem(menuItemTextNDropTest);

            MenuBar.Instance.AddMenu(menuFile);
            MenuBar.Instance.AddMenu(menuHelp);
            MenuBar.Instance.AddMenu(menuAssortedWidgetsTest);

            menuItemDialogTest.MousePressedEvent += new MousePressedHandler(menuItemDialogTest_MousePressedEvent);
            menuItemCheckNRadioTest.MousePressedEvent += new MousePressedHandler(menuItemCheckNRadioTest_MousePressedEvent);
            menuItemProgressNSliderTest.MousePressedEvent += new MousePressedHandler(menuItemProgressNSliderTest_MousePressedEvent);
            menuItemMultipleTest.MousePressedEvent += new MousePressedHandler(menuItemMultipleTest_MousePressedEvent);
            menuItemScrollPanelTest.MousePressedEvent += new MousePressedHandler(menuItemScrollPanelTest_MousePressedEvent);
            menuItemTextNDropTest.MousePressedEvent += new MousePressedHandler(menuItemTextNDropTest_MousePressedEvent);
        }