コード例 #1
0
            protected virtual void OnExpose(object sender, ExposeEventArgs args)
            {
                using (Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                    TouchColor.SetSource(cr, "grey3", 0.75);

                    double midY = 272.5;

                    for (int i = 0; i < 3; ++i)
                    {
                        cr.MoveTo(60 + (i * 185), midY);
                        cr.LineTo(220 + (i * 185), midY);
                        cr.ClosePath();
                        cr.Stroke();

                        cr.MoveTo(232.5 + (i * 185), 115);
                        cr.LineTo(232.5 + (i * 185), 425);
                        cr.ClosePath();
                        cr.Stroke();
                    }

                    cr.MoveTo(615, midY);
                    cr.LineTo(775, midY);
                    cr.ClosePath();
                    cr.Stroke();
                }
            }
コード例 #2
0
 protected void OnTouchAreaExpose(object obj, ExposeEventArgs args)
 {
     if (selected)
     {
         using (Context cr = CairoHelper.Create(GdkWindow)) {
             cr.Rectangle(Allocation.Left, Allocation.Top, Allocation.Width, Allocation.Height);
             TouchColor.SetSource(cr, "grey0", 0.5);
             cr.Fill();
         }
     }
 }
コード例 #3
0
            protected override void OnExpose(object sender, ExposeEventArgs args)
            {
                using (Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                    cr.Rectangle(Allocation.Left, Allocation.Top, Allocation.Width, Allocation.Height);
                    color.SetSource(cr);
                    cr.Fill();

                    cr.MoveTo(Allocation.Left, Allocation.Top);
                    cr.LineTo(Allocation.Right + 1, Allocation.Top);
                    TouchColor.SetSource(cr, "grey2", 1.0);
                    cr.LineWidth = 2.0;
                    cr.Stroke();
                }
            }
コード例 #4
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);
                }
            }
コード例 #5
0
        protected void OnExpose(object sender, ExposeEventArgs args)
        {
            using (Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                TouchColor.SetSource(cr, "grey3", 0.75);
                cr.LineWidth = 3;

                cr.MoveTo(402.5, 70);
                cr.LineTo(402.5, 460);
                cr.ClosePath();
                cr.Stroke();

                cr.MoveTo(417.5, 267.5);
                cr.LineTo(780, 267.5);
                cr.ClosePath();
                cr.Stroke();
            }
        }
コード例 #6
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();
                }
            }
        }
コード例 #7
0
        public AddHomeWidgetDialog(Window parent) : base("Add Home Screen Widget", parent, DialogFlags.DestroyWithParent)
        {
            Name           = "AquaPic.Home.Settings.Widget.Add";
            WindowPosition = (WindowPosition)4;
            SetSizeRequest(600, 320);

#if RPI_BUILD
            Decorated = false;

            ExposeEvent += (o, args) => {
                using (var cr = Gdk.CairoHelper.Create(GdkWindow)) {
                    cr.MoveTo(Allocation.Left, Allocation.Top);
                    cr.LineTo(Allocation.Right, Allocation.Top);
                    cr.LineTo(Allocation.Right, Allocation.Bottom);
                    cr.LineTo(Allocation.Left, Allocation.Bottom);
                    cr.ClosePath();
                    cr.LineWidth = 1.8;
                    TouchColor.SetSource(cr, "grey4");
                    cr.Stroke();
                }
            };
#endif

            ModifyBg(StateType.Normal, TouchColor.NewGtkColor("grey0"));

            foreach (Widget w in Children)
            {
                Remove(w);
                w.Dispose();
            }

            fix = new Fixed();
            fix.SetSizeRequest(600, 320);

            addBtn = new TouchButton();
            addBtn.SetSizeRequest(100, 30);
            addBtn.text = "Add";
            addBtn.ButtonReleaseEvent += OnAddButtonReleased;
            fix.Put(addBtn, 495, 285);
            addBtn.Show();

            cancelButton = new TouchButton();
            cancelButton.SetSizeRequest(100, 30);
            cancelButton.text = "Cancel";
            cancelButton.ButtonReleaseEvent += (o, args) => {
                Destroy();
            };
            fix.Put(cancelButton, 385, 285);
            cancelButton.Show();

            var widgetLabel = new TouchLabel();
            widgetLabel.text          = "Home Screen Widgets";
            widgetLabel.textAlignment = TouchAlignment.Right;
            widgetLabel.WidthRequest  = 185;
            fix.Put(widgetLabel, 5, 11);
            widgetLabel.Show();

            nameTextBox         = new SettingsTextBox("Name");
            nameTextBox.Visible = false;
            fix.Put(nameTextBox, 5, 40);

            moduleComboBox = new SettingsComboBox("Module");
            moduleComboBox.combo.nonActiveMessage   = "Please select module";
            moduleComboBox.combo.maxListHeight      = 6;
            moduleComboBox.combo.ComboChangedEvent += OnModuleComboChanged;
            moduleComboBox.Visible             = false;
            moduleComboBox.ButtonReleaseEvent += (o, args) => SwapTypeComboToTop();
            fix.Put(moduleComboBox, 5, 40);

            nameComboBox = new SettingsComboBox("Name");
            nameComboBox.combo.nonActiveMessage   = "Please select name";
            nameComboBox.combo.maxListHeight      = 3;
            nameComboBox.combo.ComboChangedEvent += OnModuleComboChanged;
            nameComboBox.Visible             = false;
            nameComboBox.ButtonReleaseEvent += (o, args) => SwapTypeComboToTop();
            fix.Put(nameComboBox, 5, 40);

            groupComboBox = new SettingsComboBox("Group");
            groupComboBox.combo.nonActiveMessage = "Please select group";
            groupComboBox.combo.maxListHeight    = 3;
            groupComboBox.Visible             = false;
            groupComboBox.ButtonReleaseEvent += (o, args) => SwapTypeComboToTop();
            fix.Put(groupComboBox, 305, 40);

            typeCombo = new TouchComboBox();
            typeCombo.comboList.Add("Line Plot");
            typeCombo.comboList.Add("Curved Bar Plot");
            typeCombo.comboList.Add("Button");
            typeCombo.comboList.Add("Timer");
            typeCombo.comboList.Add("Bar Plot");
            typeCombo.nonActiveMessage   = "Select type";
            typeCombo.WidthRequest       = 400;
            typeCombo.maxListHeight      = 6;
            typeCombo.ComboChangedEvent += OnTypeComboChanged;
            fix.Put(typeCombo, 195, 5);
            typeCombo.Show();

            Add(fix);
            fix.Show();
        }
コード例 #8
0
        public CalibrationDialog(
            string name,
            Window parent,
            GetCalibrationValueHandler GetCalibrationValue,
            CalibrationState startingState = CalibrationState.ZeroValue)
            : base(name + " Calibration", parent, DialogFlags.DestroyWithParent)
        {
            Name           = "AquaPic.Calibration." + name;
            WindowPosition = (WindowPosition)4;
            SetSizeRequest(600, 300);
#if RPI_BUILD
            Decorated = false;

            ExposeEvent += (o, args) => {
                using (Context cr = Gdk.CairoHelper.Create(GdkWindow)) {
                    cr.MoveTo(Allocation.Left, Allocation.Top);
                    cr.LineTo(Allocation.Right, Allocation.Top);
                    cr.LineTo(Allocation.Right, Allocation.Bottom);
                    cr.LineTo(Allocation.Left, Allocation.Bottom);
                    cr.ClosePath();
                    cr.LineWidth = 1.8;
                    TouchColor.SetSource(cr, "grey4");
                    cr.Stroke();
                }
            };
#endif

            ModifyBg(StateType.Normal, TouchColor.NewGtkColor("grey0"));

            foreach (var w in Children)
            {
                Remove(w);
                w.Destroy();
            }

            ExposeEvent += OnExpose;

            this.GetCalibrationValue = GetCalibrationValue;
            if ((startingState == CalibrationState.ZeroActual) || (startingState == CalibrationState.ZeroValue))
            {
                calState = startingState;
            }
            else
            {
                calState = CalibrationState.ZeroValue;
            }
            calArgs = new CalibrationArguments();
            forced  = false;
            init    = false;

            fix = new Fixed();
            fix.SetSizeRequest(600, 300);

            tv = new TextView();
            tv.ModifyFont(Pango.FontDescription.FromString("Sans 11"));
            tv.ModifyBase(StateType.Normal, TouchColor.NewGtkColor("grey4"));
            tv.ModifyText(StateType.Normal, TouchColor.NewGtkColor("black"));
            tv.CanFocus = false;
            tv.Editable = false;

            ScrolledWindow sw = new ScrolledWindow();
            sw.SetSizeRequest(580, 225);
            sw.Add(tv);
            tv.Show();
            fix.Put(sw, 10, 25);
            sw.Show();

            var l = new TouchLabel();
            l.text          = name;
            l.WidthRequest  = 600;
            l.textAlignment = TouchAlignment.Center;
            fix.Put(l, 0, 3);
            l.Show();

            valTb = new TouchTextBox();
            valTb.SetSizeRequest(110, 30);
            valTb.textAlignment   = TouchAlignment.Center;
            valTb.backgroundColor = "grey1";
            if (calState == CalibrationState.ZeroActual)
            {
                valTb.text              = "Enter Actual";
                valTb.enableTouch       = true;
                valTb.backgroundColor   = "grey4";
                valTb.TextChangedEvent += OnValueTextBoxTextChanged;
            }
            else
            {
                valTb.text = GetCalibrationValue().ToString("F2");
            }
            fix.Put(valTb, 10, 260);
            valTb.Show();

            actionBtn = new TouchButton();
            actionBtn.SetSizeRequest(150, 30);
            if (calState == CalibrationState.ZeroActual)
            {
                actionBtn.text = "Zero Actual";
            }
            else
            {
                actionBtn.text = "Zero Value";
            }
            actionBtn.ButtonReleaseEvent += OnActionButtonReleaseEvent;
            fix.Put(actionBtn, 440, 260);
            actionBtn.Show();

            var cancelBtn = new TouchButton();
            cancelBtn.SetSizeRequest(100, 30);
            cancelBtn.text                = "Cancel";
            cancelBtn.buttonColor         = "compl";
            cancelBtn.ButtonReleaseEvent += (o, args) => Destroy();
            fix.Put(cancelBtn, 335, 260);
            cancelBtn.Show();

            skipBtn = new TouchButton();
            skipBtn.SetSizeRequest(100, 30);
            skipBtn.text                = "Skip";
            skipBtn.buttonColor         = "seca";
            skipBtn.ButtonReleaseEvent += OnSkipButtonReleaseEvent;
            fix.Put(skipBtn, 230, 260);
            skipBtn.Show();

            var forceBtn = new TouchButton();
            forceBtn.SetSizeRequest(100, 30);
            forceBtn.text                = "Force";
            forceBtn.buttonColor         = "grey3";
            forceBtn.ButtonReleaseEvent += OnForceButtonReleaseEvent;
            fix.Put(forceBtn, 125, 260);
            forceBtn.Show();

            Add(fix);
            fix.Show();

            timerId = GLib.Timeout.Add(1000, OnUpdateTimer);
        }