Inheritance: ButtonCore
Example #1
0
        public static ImagedButton GetImagedButton(EmbeddedImage image, float imageRotationAngle)
        {
            ImagedButton btn = new ImagedButton(DefaultsService.GetDefaultImage(image, EmbeddedImageSize.Size32x32),
                                                imageRotationAngle);

            return(btn);
        }
Example #2
0
        public override void InitWindow()
        {
            SetParameters(this.GetType().Name, this.GetType().Name, 800, 800, false);
            IsCentered = true;

            TitleBar titleBar = new TitleBar(this.GetType().Name);

            OpenGLLayer ogl = new OpenGLLayer();

            ogl.SetMargin(0, titleBar.GetHeight(), 0, 0);

            HorizontalStack toolbar = Items.GetToolbarLayout();

            ImagedButton btnRotateLeft  = Items.GetImagedButton(EmbeddedImage.ArrowUp, -90);
            ImagedButton btnRotateRight = Items.GetImagedButton(EmbeddedImage.ArrowUp, 90);

            HorizontalSlider zoom = Items.GetSlider();

            ImagedButton btnRestoreView = Items.GetImagedButton(EmbeddedImage.Refresh, 0);

            // adding
            AddItems(titleBar, ogl);
            ogl.AddItems(toolbar);
            toolbar.AddItems(btnRotateLeft, btnRotateRight, zoom, btnRestoreView);

            // assign events
            btnRestoreView.EventMousePress += (sender, args) =>
            {
                ogl.RestoreView();
            };

            btnRotateLeft.EventMousePress += (sender, args) =>
            {
                ogl.Rotate(KeyCode.Left);
            };

            btnRotateRight.EventMousePress += (sender, args) =>
            {
                ogl.Rotate(KeyCode.Right);
            };

            zoom.EventValueChanged += (sender) =>
            {
                ogl.SetZoom(zoom.GetCurrentValue());
            };

            // Set focus
            ogl.SetFocus();
            zoom.SetCurrentValue(3);
        }