Exemple #1
0
        public Button()
        {
            this.SetColor(33, 36, 45);
            this.SetDisabledColor(33/2, 36/2, 45/2);
            this.SetImage( Utilities.White);
            this.OnEnableChange += new Action<Panel, bool>(Button_OnEnableChange);

            TextLabel = GUIManager.Create<Label>();
            TextLabel.SetColor(255, 255, 255);
            TextLabel.SetDisabledColor(100, 100, 100);
            TextLabel.SetParent(this);
            TextLabel.Autosize = false;
            TextLabel.Dock(DockStyle.FILL);
            TextLabel.SetAlignment(Label.TextAlign.MiddleCenter);
        }
Exemple #2
0
        public override void Init()
        {
            base.Init();

            this.SetColor(255, 255, 255);

            this.SetImages(Resource.GetTexture("gui/checkbox_checked.png"), Resource.GetTexture("gui/checkbox_unchecked.png"));
            this.SetHeight(16);
            this.SetWidth(16);
            this.ClipChildren = false;

            TextLabel = GUIManager.Create<Label>();
            TextLabel.SetColor(255, 255, 255);
            TextLabel.SetParent(this);
            TextLabel.Autosize = false;
            TextLabel.SetHeight(this.Height);
            TextLabel.SetPos(new Vector2(this.Position.X + this.Width, 0));
            TextLabel.SetAlignment(Label.TextAlign.MiddleLeft);
        }
Exemple #3
0
        public override void Init()
        {
            this.Position = new Vector2(200, 480);
            this.WindowTitle = "Untitled";
            this.Width = 200;
            this.Height = 150;
            this.SetMaterial(Resource.GetTexture("gui/window.png"));
            this.SetColor(20, 24, 33);

            //Create the grabbable title section of the window
            Title = GUIManager.Create<Panel>( this.Parent );
            Title.SetMaterial(Resource.GetTexture("gui/title.png"));
            Title.SetWidthHeight(this.Width, 25);
            Title.SetPos(this.Position - new Vector2(0, Title.Height));
            Title.OnMouseDown += new Action<Panel,OpenTK.Input.MouseButtonEventArgs>(Title_OnMouseDown);
            Title.OnMouseMove += new Action<Panel,OpenTK.Input.MouseMoveEventArgs>(Title_OnMouseMove);
            Title.OnMouseUp += new Action<Panel,OpenTK.Input.MouseButtonEventArgs>(Title_OnMouseUp);
            Title.SetColor(135, 36, 31);

            //Create the text that is overlayed upon the title section
            TitleText = GUIManager.Create<Label>(Title);
            TitleText.SetFont("defaultTitle");
            TitleText.SetPos(0, 0);
            TitleText.SetWidthHeight(this.Width, Title.Height);
            TitleText.SetColor(255, 255, 255);
            TitleText.SetText(this.WindowTitle);
            TitleText.Dock(DockStyle.LEFT);
            TitleText.SetAlignment(Label.TextAlign.MiddleLeft);
            TitleText.DockPadding(10, 10, 0, 0);

            //Create the close button
            closeButton = GUIManager.Create<Button>(Title);
            closeButton.SetImage(Resource.GetTexture("gui/close.png"));
            closeButton.SetWidthHeight(25, 25);
            closeButton.SetColor(26, 30, 38);
            closeButton.Dock(DockStyle.RIGHT);
            closeButton.AlignRight();
            closeButton.OnButtonPress += new Button.OnButtonPressDel(closeButton_OnButtonPress);
            closeButton.PreDraw += new Action<Panel, Vector2, DrawEventArgs>(closeButton_PreDraw);
        }
Exemple #4
0
        public override void Init()
        {
            base.Init();

            this.SetColor(255, 255, 255);
            this.SetHeight(20);
            this.SetWidth(40);

            TextLabel = GUIManager.Create<Label>();
            TextLabel.SetColor(73, 73, 73);
            TextLabel.SetParent(this);
            TextLabel.DockPadding(3, 3, 0, 0);
            TextLabel.Dock(DockStyle.FILL);
            TextLabel.SetAlignment(Label.TextAlign.MiddleLeft);

            Utilities.engine.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonDown);
            Utilities.engine.Keyboard.KeyDown += new EventHandler<KeyboardKeyEventArgs>(Keyboard_KeyDown);
        }
Exemple #5
0
        public override void Init()
        {
            base.Init();

            contextPanel = GUIManager.Create<Panel>();
            contextPanel.ShouldPassInput = true;
            contextPanel.SetWidth(150);
            contextPanel.SetPos(this.Position.X, this.Position.Y + this.Height);

            //Create our text label
            TextLabel = GUIManager.Create<Label>();
            TextLabel.SetParent(this);
            TextLabel.Autosize = false;
            TextLabel.Dock(DockStyle.FILL);
            TextLabel.SetAlignment(Label.TextAlign.MiddleCenter);

            this.SetButtonState(State.Idle);

            Utilities.engine.Mouse.ButtonDown += new EventHandler<MouseButtonEventArgs>(Mouse_ButtonDown);
        }