protected void onExpose(object sender, ExposeEventArgs args)
        {
            var area = sender as EventBox;

            using (Context cr = Gdk.CairoHelper.Create(area.GdkWindow)) {
                int width = Allocation.Width;

                cr.MoveTo(0, 0);
                cr.LineTo(width, 0);
                cr.LineTo(width, 17);
                cr.LineTo(0, 17);
                cr.MoveTo(0, 0);
                cr.ClosePath();
                cr.SetSourceRGB(0.15, 0.15, 0.15);
                cr.Fill();

                cr.MoveTo(0, 17);
                cr.LineTo(width, 17);
                cr.LineTo(width, 19);
                cr.LineTo(0, 19);
                cr.LineTo(0, 17);
                cr.ClosePath();

                using (var pat = new LinearGradient(0, 19, width, 19)) {
                    pat.AddColorStop(0.0, TouchColor.NewCairoColor("grey2", 0.35));
                    pat.AddColorStop(0.5, TouchColor.NewCairoColor("pri"));
                    pat.AddColorStop(1.0, TouchColor.NewCairoColor("grey2", 0.35));
                    cr.SetSource(pat);
                    cr.Fill();
                }

                TouchText textRender = new TouchText(DateTime.Now.ToLongTimeString());
                textRender.alignment = TouchAlignment.Right;
                textRender.Render(this, width - 120, 0, 120, 19);

                textRender.text = alarmName;
                if (alarmName == "No Alarms")
                {
                    textRender.font.color = "white";
                }
                else
                {
                    textRender.font.color = "compl";
                }
                textRender.alignment = TouchAlignment.Left;
                textRender.Render(this, 0, 0, 500, 19);
            }
        }
Exemple #2
0
            protected void OnEventBoxExpose(object sender, ExposeEventArgs args)
            {
                EventBox eb = sender as EventBox;

                using (Context cr = Gdk.CairoHelper.Create(eb.GdkWindow)) {
                    int height = Allocation.Height;
                    int width  = Allocation.Width;
                    int top    = Allocation.Top;
                    int left   = Allocation.Left;
                    int radius = 4;

                    if (!selected)
                    {
                        width  -= 25;
                        left   += position * 13;
                        top    += 7;
                        height -= 7;
                    }

                    cr.MoveTo(left, top + radius);
                    cr.Arc(left + radius, top + radius, radius, Math.PI, -Math.PI / 2);
                    cr.LineTo(left + width - radius, top);
                    cr.Arc(left + width - radius, top + radius, radius, -Math.PI / 2, 0);
                    cr.LineTo(left + width, top + height);
                    cr.LineTo(left, top + height);
                    cr.ClosePath();

                    if (selected)
                    {
                        color   = "grey2";
                        color.A = 1.0f;
                    }
                    else
                    {
                        color   = "grey4";
                        color.A = 0.1f;
                    }
                    color.SetSource(cr);

                    cr.Fill();

                    TouchText render = new TouchText(text);
                    render.alignment  = TouchAlignment.Center;
                    render.font.color = "white";
                    render.Render(this, left, top, width, height);
                }
            }
        protected void OnExpose(object sender, ExposeEventArgs args)
        {
            TouchSelectorSwitch ss = sender as TouchSelectorSwitch;
            int seperation         = ss.Allocation.Width / ss.selectionCount;
            int x = ss.Allocation.Left;

            TouchText render = new TouchText();

            render.textWrap   = TouchTextWrap.Shrink;
            render.alignment  = TouchAlignment.Center;
            render.font.color = "white";

            foreach (var l in labels)
            {
                render.text = l;
                render.Render(ss, x, ss.Allocation.Top, seperation, ss.Allocation.Height);
                x += seperation;
            }
        }
Exemple #4
0
        protected void onExpose(object sender, ExposeEventArgs args)
        {
            using (Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                int left   = Allocation.Left;
                int right  = Allocation.Right;
                int top    = Allocation.Top;
                int bottom = Allocation.Bottom;
                int width  = Allocation.Width;
                int height = Allocation.Height;

                double originY = top + (height / 2d);
                double originX = -850.105;
                double radius  = 1075.105;

                if (expanded)
                {
                    cr.Rectangle(left, top, width, height);
                    TouchColor.SetSource(cr, "grey0", 0.80);
                    cr.Fill();

                    cr.MoveTo(left, top);
                    cr.LineTo(200, top);
                    cr.Arc(originX, originY, radius, (192.41466).ToRadians(), (167.58534).ToRadians());
                    cr.LineTo(200, top + height);
                    cr.LineTo(left, top + height);
                    cr.LineTo(left, top);
                    cr.ClosePath();
                    TouchColor.SetSource(cr, "grey3", 0.80);
                    cr.Fill();

                    var currentWindowTop = (height / 2) - 30 + top;
                    TouchGlobal.DrawRoundedRectangle(cr, left - 50, currentWindowTop, 300, 60, 20);

                    var color        = new TouchColor("grey3");
                    var outlineColor = new TouchColor(color);
                    outlineColor.ModifyColor(0.5);
                    var highlightColor = new TouchColor(color);
                    highlightColor.ModifyColor(1.1);
                    var lowlightColor = new TouchColor(color);
                    lowlightColor.ModifyColor(0.75);

                    using (var grad = new LinearGradient(left, currentWindowTop, left, currentWindowTop + 60)) {
                        grad.AddColorStop(0, highlightColor.ToCairoColor());
                        grad.AddColorStop(0.15, color.ToCairoColor());
                        grad.AddColorStop(0.85, lowlightColor.ToCairoColor());
                        cr.SetSource(grad);
                        cr.FillPreserve();
                    }

                    outlineColor.SetSource(cr);
                    cr.LineWidth = 1;
                    cr.Stroke();

                    // Menu Button
                    cr.MoveTo(right + 5, top);
                    cr.LineTo(right - 120, top);
                    cr.LineTo(right - 120, top + 20);
                    cr.ArcNegative(right - 100, top + 20, 20, 0, Math.PI / 2);
                    cr.LineTo(right + 5, top + 40);
                    cr.ClosePath();

                    color          = new TouchColor("grey4", 0.8);
                    highlightColor = new TouchColor(color);
                    highlightColor.ModifyColor(1.3);
                    lowlightColor = new TouchColor(color);
                    lowlightColor.ModifyColor(0.75);

                    using (var grad = new LinearGradient(right - 120, top, right - 120, top + 40)) {
                        grad.AddColorStop(0, highlightColor.ToCairoColor());
                        grad.AddColorStop(0.2, color.ToCairoColor());
                        grad.AddColorStop(0.85, lowlightColor.ToCairoColor());
                        cr.SetSource(grad);
                        cr.Fill();
                    }

                    // Home Button
                    cr.MoveTo(right + 5, bottom + 5);
                    cr.LineTo(right - 120, bottom + 5);
                    cr.LineTo(right - 120, bottom - 20);
                    cr.Arc(right - 100, bottom - 20, 20, 0, -Math.PI / 2);
                    cr.LineTo(right + 5, bottom - 40);
                    cr.ClosePath();

                    using (var grad = new LinearGradient(right - 165, bottom - 40, right - 165, bottom)) {
                        grad.AddColorStop(0, highlightColor.ToCairoColor());
                        grad.AddColorStop(0.2, color.ToCairoColor());
                        grad.AddColorStop(0.85, lowlightColor.ToCairoColor());
                        cr.SetSource(grad);
                        cr.Fill();
                    }

                    var t = new TouchText(windows[highlighedScreenIndex]);
                    t.font.color = "pri";
                    t.alignment  = TouchAlignment.Right;
                    if (clicked)
                    {
                        t.font.size = 18;
                        double radians   = (180 + (offset * 2.75881)).ToRadians();
                        double textWidth = 210 - CalcX(radius, radians);
                        t.Render(this, left, (height / 2) - 25 + top - (offset * 50.0).ToInt(), textWidth.ToInt(), 50);
                    }
                    else
                    {
                        t.font.size = 20;
                        t.Render(this, left, (height / 2) - 25 + top, 245, 50);
                    }

                    t.font.color = "black";
                    for (int i = 0; i < 4; ++i)
                    {
                        int drawIndex = highlighedScreenIndex + 1 + i;
                        if (drawIndex >= windows.Length)
                        {
                            drawIndex -= windows.Length;
                        }

                        double radians   = (177.24119 - (i * 2.75881) + (offset * 2.75881)).ToRadians();
                        double textWidth = 210 - CalcX(radius, radians);

                        t.text      = windows[drawIndex];
                        t.font.size = 16 - (i * 0.75).ToInt();
                        int textY = (height / 2) + top + 25 + (i * 50) - (offset * 50.0).ToInt();

                        t.Render(
                            this,
                            left,
                            textY,
                            textWidth.ToInt(),
                            50);

                        drawIndex = highlighedScreenIndex - 1 - i;
                        if (drawIndex < 0)
                        {
                            drawIndex = windows.Length + drawIndex; //adding drawIndex because its negative
                        }

                        t.text = windows[drawIndex];
                        textY  = (height / 2) + top - 75 - (i * 50) - (offset * 50.0).ToInt();

                        t.Render(
                            this,
                            left,
                            textY,
                            textWidth.ToInt(),
                            50);
                    }

                    // Menu Text
                    t.text      = "Menu";
                    t.font.size = 18;
                    t.alignment = TouchAlignment.Right;
                    t.Render(this, right - 120, top, 115, 40);

                    // Home Text
                    t.text = "Home";
                    t.Render(this, right - 120, bottom - 40, 115, 40);
                }
                else
                {
                    cr.Arc(originX - 208, originY, radius, 0, 2 * Math.PI);
                    cr.ClosePath();

                    TouchColor.SetSource(cr, "grey3", 0.75);
                    cr.LineWidth = 0.75;
                    cr.StrokePreserve();

                    TouchColor.SetSource(cr, "grey2", 0.25);
                    cr.Fill();

                    var topEdge = (height / 2) - 30 + top;
                    TouchGlobal.DrawRoundedRectangle(cr, left - 30, topEdge, 55, 60, 25);

                    var color        = new TouchColor("grey3");
                    var outlineColor = new TouchColor(color);
                    outlineColor.ModifyColor(0.5);
                    var highlightColor = new TouchColor(color);
                    highlightColor.ModifyColor(1.1);
                    var lowlightColor = new TouchColor(color);
                    lowlightColor.ModifyColor(0.75);

                    using (var grad = new LinearGradient(left, topEdge, left, topEdge + 60)) {
                        grad.AddColorStop(0, highlightColor.ToCairoColor());
                        grad.AddColorStop(0.15, color.ToCairoColor());
                        grad.AddColorStop(0.85, lowlightColor.ToCairoColor());
                        cr.SetSource(grad);
                        cr.FillPreserve();
                    }

                    outlineColor.SetSource(cr);
                    cr.LineWidth = 1;
                    cr.Stroke();
                }
            }
        }