Example #1
0
        private static void InitModal()
        {
            if (mModalInitialized)
            {
                return;
            }

            const int kWidth  = 90;
            const int kHeight = 35;
            const int kRound  = 10;

            mModalOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mModalOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            mModalStrokeVGPaint = new VGSolidColor(Palette.LightGrey);

            #region default color
            mModalNormalVGPaintDefault = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight);
            mModalActiveVGPaintDefault = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight);
            #endregion

            #region red color
            mModalNormalVGPaintRed = SetPaint(new Color(0x640000FF), Palette.Red, kHeight);
            mModalActiveVGPaintRed = SetPaint(Palette.Red, new Color(0x640000FF), kHeight);
            #endregion

            #region green color
            mModalNormalVGPaintGreen = SetPaint(new Color(0x006400FF), Palette.Lime, kHeight);
            mModalActiveVGPaintGreen = SetPaint(Palette.Lime, new Color(0x006400FF), kHeight);
            #endregion

            mModalInitialized = true;
        }
Example #2
0
        private static VGLinearGradient SetPaint(Color up, Color down, int height)
        {
            var rv = new VGLinearGradient(0, 0, 0, height);

            rv.AddColor(0, down);
            rv.AddColor(100, up);
            return(rv);
        }
Example #3
0
        public override ModalWindow AddModal(string name)
        {
            var modal = base.AddModal("modal-" + name);

            var modalOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(modalOutline, 0, 0, 400, 230, 20, 20);

            var fill = new VGLinearGradient(0, 0, 0, 230);

            fill.AddColor(0, Palette.DarkGray);
            fill.AddColor(25, Palette.LightGrey);
            fill.AddColor(100, Palette.LightGrey);

            var outline = new VGPath(modalOutline,
                                     new VGSolidColor(Palette.DarkSlateGray),
                                     fill)
            {
                StrokeWidth = 2.0f
            };

            outline.Move(40, 25);
            modal.AddVGPath(outline);

            var textOutline = VGPath.OpenVGPath();

            VGU.vguRect(textOutline, 0, 0, 360, 160);
            var text = new VGPath(textOutline,
                                  new VGSolidColor(Palette.DarkSlateGray),
                                  new VGSolidColor(Palette.White))
            {
                StrokeWidth = 2.0f
            };

            text.Move(60, 85);
            modal.AddVGPath(text);

            switch (name)
            {
            case "yesno":
                ConfigureModalYesNo(modal);
                break;

            case "ok":
                ConfigureModalOk(modal);
                break;
            }

            return(modal);
        }
Example #4
0
        private VGPath GetPanelPath()
        {
            var fill = new VGLinearGradient(0, 0, mPanel.Width, 0);

            fill.AddColor(0, Palette.LightBlue);
            fill.AddColor(25, Palette.Gainsboro);
            fill.AddColor(75, Palette.Gainsboro);
            fill.AddColor(100, Palette.LightBlue);

            var rv = new VGPath(new VGSolidColor(Palette.White), fill);

            VGU.vguRect(rv.GetPath(), 0, 0, mPanel.Width, mPanel.Height);

            return(rv);
        }
Example #5
0
        private VGPath GetPanelPath()
        {
            var fill = new VGLinearGradient(0, 0, mPanel.Width, 0);

            fill.AddColor(0, Palette.LightBlue);
            fill.AddColor(25, Palette.Gainsboro);
            fill.AddColor(75, Palette.Gainsboro);
            fill.AddColor(100, Palette.LightBlue);

            var path = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0,
                                       VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

            VGU.vguRect(path, 0, 0, mPanel.Width, mPanel.Height);
            return(new VGPath(path, new VGSolidColor(Palette.White), fill));
        }
Example #6
0
        public static ProgressBar ClassicBar(IWidget parent, int x, int y)
        {
            var rv = new ProgressBar(parent, x, y, 310, 20, 10);

            rv.Status.SetFont(Palette.White, 20);

            rv.Border = new VGSolidColor(Palette.LightGrey);
            var fill = new VGLinearGradient(0, 0, 0, rv.Height);

            fill.AddColor(0, new Color(0x006400FF));
            fill.AddColor(25, new Color(0x006400FF));
            fill.AddColor(100, Palette.Lime);

            rv.PercentLine = fill;

            return(rv);
        }
Example #7
0
        private static void InitDown()
        {
            if (mDownInitialized)
            {
                return;
            }

            const int kWidth  = 62;
            const int kHeight = 34;
            const int kRound  = 10;

            mDownOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mDownOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            #region default color
            mClassicActiveVGPaintDefault = SetPaint(Palette.Black, new Color(0x58595BFF), kHeight);
            #endregion

            mDownInitialized = true;
        }
Example #8
0
        private static void InitQuad()
        {
            if (mQuadInitialized)
            {
                return;
            }


            const int kButtonsWidth  = 62;
            const int kButtonsHeight = 45;

            mQuadOutline = VGPath.OpenVGPath();

            VGU.vguRect(mQuadOutline, 0, 0, kButtonsWidth, kButtonsHeight);

            #region default color
            mQuadActiveVGPaintDefault = SetPaint(Palette.Black, new Color(0x58595BFF), kButtonsHeight);
            #endregion

            mQuadInitialized = true;
        }
Example #9
0
        private static void InitGiant()
        {
            if (mGiantInitialized)
            {
                return;
            }

            const int kWidth  = 230;
            const int kHeight = 90;
            const int kRound  = 25;

            mGiantOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mGiantOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            mGiantStrokeVGPaint = new VGSolidColor(Palette.LightGrey);
            //mGiantNormalVGPaint = SetPaint(Palette.LightBlue, Palette.LightGrey, kHeight);
            mGiantNormalVGPaint = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight);
            mGiantActiveVGPaint = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight);

            mGiantInitialized = true;
        }
Example #10
0
        private static void InitClassic()
        {
            if (mClassicInitialized)
            {
                return;
            }

            const int kWidth  = 120;
            const int kHeight = 50;
            const int kRound  = 15;

            mClassicOutline = VGPath.OpenVGPath();

            VGU.vguRoundRect(mClassicOutline, 0, 0, kWidth, kHeight, kRound, kRound);

            mClassicStrokeVGPaint = new VGSolidColor(Palette.LightGrey);

            #region default color
            //mClassicNormalVGPaintDefault = SetPaint(Palette.LightBlue, Palette.LightGrey, kHeight);
            mClassicNormalVGPaintDefault = SetPaint(Palette.DarkGray, Palette.LightGrey, kHeight);
            mClassicActiveVGPaintDefault = SetPaint(Palette.LightGrey, Palette.DarkGray, kHeight);
            #endregion

            #region red color
            //mClassicNormalVGPaintRed = SetPaint(Palette.LightBlue, Palette.Red, kHeight);
            mClassicNormalVGPaintRed = SetPaint(new Color(0x640000FF), Palette.Red, kHeight);
            mClassicActiveVGPaintRed = SetPaint(Palette.Red, new Color(0x640000FF), kHeight);
            #endregion

            #region green color
            //mClassicNormalVGPaintGreen = SetPaint(Palette.LightBlue, Palette.Lime, kHeight);
            //mClassicNormalVGPaintGreen = SetPaint(new Color(0x004623FF), Palette.Lime, kHeight);
            mClassicNormalVGPaintGreen = SetPaint(new Color(0x006400FF), Palette.Lime, kHeight);
            mClassicActiveVGPaintGreen = SetPaint(Palette.Lime, new Color(0x006400FF), kHeight);
            #endregion

            mClassicInitialized = true;
        }
Example #11
0
        public static Window ShowWindow()
        {
            var window = new Window("show", kWidth, kHeight)
            {
                Description = "Шеф-повар \"Сибовар\""
            };

            var line = new TableLine(25);

            line.AddColumn(80);
            line.AddColumn(80);
            line.AddColumn(70);

            line.Text[0].Text = "HgjloGreen";
            line.Text[0].SetFont(Palette.Lime, 20);
            line.Text[0].SetAlign(Align.Left, new GfxPoint(0, 3));
            line.Text[1].Text = "HelloRed";
            line.Text[1].SetFont(Palette.Red, 15);
            line.Text[1].SetAlign(Align.Center);
            line.Text[2].Text = "HgelloBlue";
            line.Text[2].SetFont(Palette.PaleTurquoise, 30);
            line.Text[2].SetAlign(Align.Left, new GfxPoint(0, 4));

            line.Name = "line";


            var table = new Table(window)
            {
                Name = "table"
            };

            table.Move(10, 50);
            table.AddLine(new TableLine(line));
            table.AddLine(new TableLine(line));
            table.AddLine(new TableLine(line));
            table.SetBackground(Palette.Red, Palette.White);
            table.SetBorder(1, Palette.Lime);
            table.OnPress += caller =>
            {
                var rv = table.GetLineByCell(caller);
                if (rv == null)
                {
                    return;
                }

                table.ActiveLine   = rv;
                window.Description = rv.Name;
            };


            var text = new TextArea(window, 10, 180, 325, 50);

            text.SetFont("i260c", Palette.PaleTurquoise, 50);
            text.Text = "0123456789:";

            text.OnPress += caller => window.Description = "Text.Pressed";

            var bar = new ProgressBar(window, 40, 30, 200, 15, 15)
            {
                Percent = 10, Status = { Text = "hello" }
            };

            bar.Status.SetAlign(Align.Center, new GfxPoint(3, 3));
            bar.Status.SetFont(Palette.White, 14);
            bar.Rotate(70);

            text.OnRelease += caller =>
            {
                window.Description = "Text.Released";
                //mApplication.SetFocusedWindow("1");
                line.Move(line.X - 3, line.Y - 3);
                table.ActiveLine = null;
                bar.Percent     -= 1;
            };

            window.OnPaint += delegate { Debug.Print(DateTime.Now.ToString("HH:mm:ss") + ":\tHome update"); };

            var activePath = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

            VGU.vguRoundRect(activePath, 0, 0, 60, 100, 20, 20);

            var normalPath = VG.vgCreatePath(0, VGPathDatatype.VG_PATH_DATATYPE_S_16, 1, 0, 0, 0, VGPathCapabilities.VG_PATH_CAPABILITY_ALL);

            VGU.vguRoundRect(normalPath, 0, 0, 100, 50, 20, 20);
            VGU.vguRoundRect(normalPath, 10, 50, 80, 70, 20, 20);



            var activeButton = new VGSolidColor(new Color(0xFF0000FF));
            //var normalButton = new VGSolidColor(new Color(0x00FF00FF));
            var normalButton = new VGLinearGradient(0, 0, 100, 120);

            normalButton.AddColor(0, new Color(0xFF0000FF));
            normalButton.AddColor(100, new Color(0x00FF00FF));

            var button = new Button(window, new VGPath(activePath, null, activeButton), new VGPath(normalPath, null, normalButton));

            button.IsCached = true;
            button.Move(250, 50);
            button.OnPress += delegate { Console.WriteLine("button.OnPress"); };


            var image = new Image(window, 25, 10);

            image.Load("splash.raw");
            image.Scale(0.5f, 0.5f);
            image.RotateCenter = new GfxPoint(image.Width / 2, image.Height / 2);
            //image.Hide();

            window.OnPaint += caller =>
            {
                image.Rotate(mImageRotate);
                mImageRotate += 5;
            };

            var graphicArea = new GraphicArea(window, 200, 200);

            graphicArea.Move(70, 20);
            graphicArea.Background = new Color(0xF0F0F0FF);


            graphicArea.Grid   = new VGPath(activePath, activeButton, null);
            graphicArea.Arrows = new VGPath(normalPath, new VGSolidColor(Palette.PaleTurquoise), null);

            var graphicData1 = new GraphicsData
            {
                Data =
                    new byte[]
                {
                    0, 15, 25, 50, 40, 35, 12, 10, 15, 17, 30, 32, 35, 35, 35, 35, 35, 40,
                    45, 57, 25, 23, 20, 18, 12, 12, 12, 30, 32, 35, 35, 35, 35, 35, 40, 45
                }
            };

            var graphicData2 = new GraphicsData(graphicData1)
            {
                Color = Palette.Lime, Position = new GfxPoint(10, 10)
            };

            graphicArea.AddGrapic(graphicData1);
            graphicArea.AddGrapic(graphicData2);

            return(window);
        }