Example #1
0
        public Button(string Text, Window window)
            : base(window)
        {
            Selected = new ButtonSelectedEvent(ButtonSelected);
            Margin = 4;
            FlowLayout layout = new FlowLayout(true);
            layout.centered = false;
            label = new Label(Text, window);
            label.Color = Color.LightGray;
            this.AddControl(label);
            this.Name = "Button";
            Color = System.Drawing.Color.White;

            atlas = new HagsAtlas("window-theme/button/button.png");
            atlas["topleft"] = new Rectangle(0, 0, 3, 3);
            atlas["left"] = new Rectangle(0, 3, 3, 15);
            atlas["bottomleft"] = new Rectangle(0, 18, 3, 3);
            atlas["top"] = new Rectangle(3, 0, 34, 3);
            atlas["middle"] = new Rectangle(3, 3, 34, 15);
            atlas["bottom"] = new Rectangle(3, 18, 34, 3);
            atlas["topright"] = new Rectangle(37,0,3,3);
            atlas["right"] = new Rectangle(37, 3, 3, 15);
            atlas["bottomright"] = new Rectangle(37, 18, 3, 3);
            stateOffets.Add(ButtonState.HOVER, new Point(0, 21));
            stateOffets.Add(ButtonState.DOWN, new Point(0, 43));
        }
Example #2
0
        public RibbonGroup(string Name, RibbonMenu menu)
            : base(menu)
        {
            label = new Label(Name, 8f, Color.Gray, menu);

            label.Size = label.GetPreferredSize();
            this.Name = Name;
            Layout = new FlowLayout(false);
            this.menu = menu;
            this.PreferredSize = new System.Drawing.Size(20, 66);
            this.MaxSize = new Size(Renderer.Instance.RenderSize.Width, 66);
        }
Example #3
0
        public RibbonMenuItem(string name, RibbonMenu main)
            : base(name, main)
        {
            this.main = main;

            FlowLayout flow = new FlowLayout(true);
            flow.Margin = 10;

            // Set up panel area
            panel = new Panel(main);
            panel.Layout = flow;
            panel.Position = new Dimension(10, 23);
            panel.Size = new Size(Renderer.Instance.RenderSize.Width - 20, 77);

            //sprite = new Sprite(Renderer.Instance.device);
        }
Example #4
0
        public RibbonMenu()
        {
            // Set up size and position
            this.Size = this.PreferredSize = new System.Drawing.Size(Renderer.Instance.RenderSize.Width, 100);
            UpdateSize();
            this.WindowSpawnPosition = Corner.TOPLEFT;
            FlowLayout layout = new FlowLayout(true);
            //layout.centered = false;
            layout.Margin = 6;
            panel.Layout = layout;

            this.ForcePanelSize = true;
            this.PanelSize = new Size(Renderer.Instance.RenderSize.Width, 23);

            // Make window borderless
            this.Borderless = true;
            this.Resizeable = false;

            // Load textures..
            //backgroundTex = TextureManager.Instance.LoadTexture("gui/ribbon/ribbonbg.png");
            backgroundRect = new Rectangle(0, 0, 19, 99);
            //buttonTex = TextureManager.Instance.LoadTexture("gui/ribbon/ribbonbutton.png");
            buttonRect = new Rectangle[3];
            buttonRect[0] = new Rectangle(0,0,5,24); // left
            buttonRect[1] = new Rectangle(5,0,24,24); // middle (strect-able)
            buttonRect[2] = new Rectangle(28,0,5,24); // right
            //groupTex = TextureManager.Instance.LoadTexture("gui/ribbon/ribbongroup.png");
            groupRect = new Rectangle[9];
            groupRect[0] = new Rectangle(0,0,6,8);
            groupRect[1] = new Rectangle(6,0,44,8);
            groupRect[2] = new Rectangle(50,0,6,8);
            groupRect[3] = new Rectangle(0, 20, 6, 8);
            groupRect[4] = new Rectangle(6, 20, 44, 8);
            groupRect[5] = new Rectangle(50, 20, 6, 8);
            groupRect[6] = new Rectangle(0, 63, 6, 8);
            groupRect[7] = new Rectangle(6, 63, 44, 8);
            groupRect[8] = new Rectangle(50, 63, 6, 8);
            //gradientTex = TextureManager.Instance.LoadTexture("gui/ribbon/blacktransgrad.png");
            gradientRect = new Rectangle(0, 5, 16, 27);

            sprite = new Sprite(Renderer.Instance.device);

            // Set up button
            ToggleRibbonButton = new Button("+", this);
            ToggleRibbonButton.Selected += new Button.ButtonSelectedEvent(ToggleShowRibbon);
            panel.AddControl(ToggleRibbonButton);
        }