Пример #1
0
        /// <summary>
        /// Draws the rectangle frame into the given cairo context
        /// </summary>
        /// <param name="context">Context.</param>
        /// <param name="lineWidth">Line width.</param>
        /// <param name="lineColor">Line color.</param>
        /// <param name="fillColor">Fill color.</param>
        protected virtual void DrawFrame(Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
        {
            RectangleD rect = DisplayBox;

            rect.OffsetDot5();
            CairoFigures.CurvedRectangle(context, rect, 8);
            context.Color = fillColor;
            context.FillPreserve();
            context.Color     = lineColor;
            context.LineWidth = lineWidth;
            context.Stroke();
        }
Пример #2
0
        protected override void DrawFrame(Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
        {
            RectangleD rect = DisplayBox;

            rect.OffsetDot5();
            CairoFigures.AngleFrame(context, rect, 15, 0, 15, 0);
            context.Color = fillColor;
            context.FillPreserve();
            context.Color     = lineColor;
            context.LineWidth = lineWidth;
            context.Stroke();
        }
Пример #3
0
        protected override void DrawFrame(Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
        {
            // base.DrawFrame (context, lineWidth, lineColor, fillColor);

            rect = DisplayBox;
            rect.OffsetDot5();

            // HERZUM SPRINT 1.2
            // CairoFigures.CurvedRectangle(context, rect, 30);
            CairoFigures.AngleFrame(context, rect, 0, 0, 0, 0);
            // END HERZUM SPRINT 1.2

            Cairo.Color fillColorOrigin;
            fillColorOrigin = fillColor;

            lineWidth = 1;
            fillColor = new Cairo.Color(1.0, 1.0, 1.0, 1.0);

            context.Color = fillColor;
            context.FillPreserve();
            context.Color     = lineColor;
            context.LineWidth = lineWidth;

            double[] dash = { 2, 0, 2 };
            context.SetDash(dash, 0);

            context.Stroke();

            rect2        = DisplayBox;
            rect2.Width  = DisplayBox.Width;
            rect2.Height = 30;
            rect2.OffsetDot5();
            CairoFigures.CurvedRectangle(context, rect2, 30);
            fillColor     = fillColorOrigin;
            context.Color = fillColor;
            context.FillPreserve();
            context.Color     = lineColor;
            context.LineWidth = lineWidth;

            context.Stroke();

            // HERZUM SPRINT 2.1
            // m_applicationContext.MainWindow.ExperimentCanvasPad.LoopNodeControlCurrent = this;
            // END HERZUM SPRINT 2.1

            // HERZUM SPRINT 5.0: TLAB-235
            // DrawScope ();
            DrawScope("Enter", "Exit");
            // END HERZUM SPRINT 5.0: TLAB-235
        }
Пример #4
0
        protected override void DrawFrame (Cairo.Context context, double lineWidth, Cairo.Color lineColor, Cairo.Color fillColor)
        {          
            rect = DisplayBox;
            rect.OffsetDot5();
            CairoFigures.AngleFrame(context, rect, 0, 0, 0, 0);

            Cairo.Color fillColorOrigin;
            fillColorOrigin = fillColor;

            lineWidth = 1;
            fillColor = new Cairo.Color (1.0, 1.0, 1.0, 1.0);

            context.Color = fillColor;  
            context.FillPreserve();
            context.Color = lineColor;
            context.LineWidth = lineWidth;

            double[] dash = {2, 0, 2};
            context.SetDash (dash, 0);

            context.Stroke();

            rect2 = DisplayBox;
            rect2.Width = DisplayBox.Width;
            rect2.Height = 30;
            rect2.OffsetDot5();
            CairoFigures.AngleFrame(context, rect2, 0, 0, 0, 0);
            fillColor = fillColorOrigin;
            context.Color = fillColor;  
            context.FillPreserve();
            context.Color = lineColor;
            context.LineWidth = lineWidth;

            context.Stroke();

            // HERZUM SPRINT 1.1 LOOP 
            DrawScope ();
            // END HERZUM SPRINT 1.1 LOOP

        }
Пример #5
0
        protected override bool OnExposeEvent(Gdk.EventExpose evnt)
        {
            Gdk.Rectangle alloc = this.Allocation;

            // XXX: Not sure why we need to transpose this. Probably
            //      setting up our GdkWindow incorrectly.

            /*if (this.Toplevel as Gtk.Container != null) {
             *  Container parent = this.Toplevel as Container;
             *  alloc.X -= (int) parent.BorderWidth;
             *  alloc.Y -= (int) parent.BorderWidth;
             * }*/
            alloc.X = 0;
            alloc.Y = 0;

            using (Context cr = CairoHelper.Create(this.GdkWindow)) {
                //CrumbHelper.RoundedRectangle (cr, alloc, m_Radius);
                CairoFigures.AngleFrame(cr, alloc, -10, 0, 10, 0);

                // Fill in our default background
                cr.Pattern = m_NormalBg;
                cr.FillPreserve();

                // Draw our outer line
                CairoHelper.SetSourceColor(
                    cr, Style.Dark(StateType.Active));
                cr.LineWidth = 1;
                cr.Stroke();

                // Adjust our allocation to draw our inner line
                alloc.X      += 1;
                alloc.Y      += 1;
                alloc.Width  -= 2;
                alloc.Height -= 2;

                // Draw and stroke our inner line
                //CrumbHelper.RoundedRectangle (cr, alloc, m_Radius);
                CairoFigures.AngleFrame(cr, alloc, -10, 0, 10, 0);
                CairoHelper.SetSourceColor(
                    cr, Style.Light(StateType.Normal));
                cr.LineWidth = 1;
                cr.Stroke();

                int i = 0;
                foreach (Crumb crumb in this.m_Crumbs)
                {
                    Gdk.Rectangle area = m_Coords[crumb];

                    // Pad the widget area
                    area.X      -= 5;
                    area.Y      -= 4;
                    area.Width  += 20;
                    area.Height += 8;

                    // Determine what corners we should draw
//                    Corners corners;
//                    if (i == 0)
//                        corners = Corners.TopLeft | Corners.BottomLeft;
//                    else if (i + 1 == m_Crumbs.Count)
//                        corners = Corners.TopRight | Corners.BottomRight;
//                    else
//                        corners = Corners.None;

                    bool isHover  = crumb == Hover;
                    bool isActive = crumb == Active;

                    if (isHover || isActive)
                    {
                        // Select our area for background drawing
                        // CrumbHelper.RoundedRectangle (cr, area, m_Radius, corners);

                        CairoFigures.AngleFrame(cr, area, -10, 0, 10, 0);

                        // Clear the background
                        //cr.SetSourceRGB (1, 1, 1);
                        //cr.FillPreserve ();

                        // Style our background
                        cr.Pattern =
                            isActive ? m_SelectedBg : m_PrelightBg;
                        cr.FillPreserve();

                        StateType state = isActive ?
                                          StateType.Selected : StateType.Active;

                        // Draw outer line around it
                        CairoHelper.SetSourceColor(cr, Style.Mid(state));
                        cr.LineWidth = 1;
                        cr.Stroke();

                        area.X      += 1;
                        area.Y      += 1;
                        area.Width  -= 2;
                        area.Height -= 2;

                        // Draw our inner highlight line
                        //CrumbHelper.RoundedRectangle (cr, area, m_Radius, corners);
                        CairoFigures.AngleFrame(cr, area, -10, 0, 10, 0);

                        CairoHelper.SetSourceColor(cr, Style.Light(state));
                        cr.LineWidth = 1;
                        cr.Stroke();
                    }

                    // Draw our separator lines if needed
//                    if (i + 1 != m_Crumbs.Count) {
//                        cr.MoveTo (area.X + area.Width + 1, area.Y);
//                        cr.LineTo (area.X + area.Width + 1,
//                                   area.Y + area.Height);
//                        CairoHelper.SetSourceColor (
//                            cr, Style.Dark (StateType.Normal));
//                        cr.LineWidth = 1;
//                        cr.Stroke ();
//
//                        cr.MoveTo (area.X + area.Width + 1.5, area.Y);
//                        cr.LineTo (area.X + area.Width + 1.5,
//                                   area.Y + area.Height);
//                        CairoHelper.SetSourceColor (
//                            cr, Style.Light (StateType.Normal));
//                        cr.LineWidth = 1;
//                        cr.Stroke ();
//                    }

                    this.PropagateExpose(crumb.Widget, evnt);

                    i++;
                }
            }

            return(true);
        }