Пример #1
0
        public static TableLine InputArea(IWidget parent, string label, int x, int y, int width = 440, int height = 30)
        {
            var rv = new TableLine(parent, height);

            rv.AddColumn(width, null, Align.Left, 20, Palette.Black, new GfxPoint(5, 5));

            //var outline = VGPath.OpenVGPath();
            //VGU.vguRoundRect(outline, 0, 0, width, height, 5, 5);
            //rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background)));

            rv.Move(x, y);

            var hitLabel = new TextArea(rv, 0, 0, rv.Width, rv.Height);

            hitLabel.SetAlign(Align.Left, new GfxPoint(5, 5));
            hitLabel.SetFont(Palette.DarkSlateGray, 20);
            hitLabel.Text = label;

            rv.OnPaint += caller =>
            {
                if (string.IsNullOrEmpty(rv.Text[0].Text))
                {
                    hitLabel.Show();
                }
                else
                {
                    hitLabel.Hide();
                }
            };


            return(rv);
        }
Пример #2
0
        public static TableLine DateTime(IWidget parent, int x, int y)
        {
            const int kHeight = 40;

            var rv = new TableLine(parent, kHeight);

            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // hour
            rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // :
            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // minute
            rv.AddColumn(0, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5));  // :
            rv.AddColumn(0, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5));  // seconds
            rv.AddColumn(20, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // " - "

            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // day
            rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(35, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // month
            rv.AddColumn(15, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(80, null, Align.Center, 40, Palette.Black, new GfxPoint(5, 5)); // year

            //rv.AddColumn(30, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds

            var outline = VGPath.OpenVGPath();

            VGU.vguRoundRect(outline, 0, 0, rv.Width, kHeight, 5, 5);

            rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background)));
            rv.Move(x, y);

            {
                rv.Text[0].Text = "09";
                rv.Text[1].Text = ":";
                rv.Text[2].Text = "00";
                rv.Text[3].Text = ":";
                rv.Text[4].Text = "00";
                rv.Text[5].Text = " - ";


                rv.Text[6].Text  = "01";
                rv.Text[7].Text  = "/";
                rv.Text[8].Text  = "03";
                rv.Text[9].Text  = "/";
                rv.Text[10].Text = "2014";
                //rv.Text[0].Text = ":";
                //rv.Text[0].Text = "14";
            }

            return(rv);
        }
Пример #3
0
        public static TableLine DateTime(IWidget parent, int x, int y)
        {
            const int kHeight = 30;

            var rv = new TableLine(parent, kHeight);

            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // hour
            rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // :
            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // minute
            rv.AddColumn(0, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5));  // :
            rv.AddColumn(0, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5));  // seconds
            rv.AddColumn(15, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // " - "

            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // day
            rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(25, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // month
            rv.AddColumn(10, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // "/"
            rv.AddColumn(55, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // year

            //rv.AddColumn(30, null, Align.Center, 20, Palette.Black, new GfxPoint(5, 5)); // seconds

            //var outline = VGPath.OpenVGPath();
            //VGU.vguRoundRect(outline, 0, 0, rv.Width, kHeight, 5, 5);
            //rv.AddVGPath(new VGPath(outline, new VGSolidColor(Palette.LightGrey), new VGSolidColor(Palette.TextArea.Background)));

            rv.Move(x, y);

            foreach (var label in rv.Text)
            {
                label.SetFont(Palette.Black, 25);
                label.SetAlign(Align.Center);
            }

            //rv.OnShow += caller =>
            {
                rv.Text[0].Text = "09";
                rv.Text[1].Text = ":";
                rv.Text[2].Text = "00";
                rv.Text[3].Text = ":";
                rv.Text[4].Text = "00";
                rv.Text[5].Text = " - ";


                rv.Text[6].Text  = "01";
                rv.Text[7].Text  = "/";
                rv.Text[8].Text  = "03";
                rv.Text[9].Text  = "/";
                rv.Text[10].Text = "2014";
                //rv.Text[0].Text = ":";
                //rv.Text[0].Text = "14";
            }



            rv.OnPress += caller =>
            {
                var cell = caller as TextArea;
                if (cell != null)
                {
                    cell.SetFont(Palette.Red);
                }
            };

            return(rv);
        }
Пример #4
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);
        }