Esempio n. 1
0
        public override void Init()
        {
            base.Init();

            ScrollPanel = GUIManager.Create<Panel>(this);
            ScrollPanel.SetMaterial(Utilities.White);
            ScrollPanel.SetWidth(this.Width);
            ScrollPanel.SetHeight(this.Height);
            ScrollPanel.SetAnchorStyle(Anchors.Left | Anchors.Right);

            Grip = GUIManager.Create<Panel>(this);
            Grip.SetColor(200, 201, 200);
            Grip.SetWidth(20);
            Grip.Dock(DockStyle.RIGHT);
            Grip.IsVisible = false; //We'll be drawing it manually
            Grip.OnMouseDown += new Action<Panel,OpenTK.Input.MouseButtonEventArgs>(Grip_OnMouseDown);
            this.OnMouseMove += new Action<Panel,OpenTK.Input.MouseMoveEventArgs>(ScrollBar_OnMouseMove);

            Utilities.engine.Mouse.ButtonUp += new EventHandler<OpenTK.Input.MouseButtonEventArgs>(Mouse_ButtonUp);
        }
Esempio n. 2
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);
        }