Example #1
0
        protected override void Render (Gdk.Drawable window, Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gdk.Rectangle expose_area, CellRendererState state)
        {
            if (Theme == null) {
                Theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (widget);
                Theme.Context.Radius = 3;
            }

            Context cr = Gdk.CairoHelper.Create (window);

            // Setup the drawing boundaries/positioning
            cr.Rectangle (cell_area.X, cell_area.Y, cell_area.Width, cell_area.Height);
            cr.Clip ();
            cr.Translate (cell_area.X, cell_area.Y);

            // Clear any existing drawing
            cr.Rectangle (0, 0, cell_area.Width, cell_area.Height);
            cr.Color = Theme.ViewFill;
            cr.Fill ();

            if (state == CellRendererState.Selected) {
                Theme.DrawRowSelection (cr, 0, 0, cell_area.Width, cell_area.Height, true);
            } else if (state == CellRendererState.Focused) {
                Theme.DrawRowSelection (cr, 0, 0, cell_area.Width, cell_area.Height, false);
            }

            var border = Theme.TotalBorderWidth;
            cr.Translate (border, border);
            var width = cell_area.Width - 2 * border;
            var height = cell_area.Height - 2 * border;

            Render (cr, width, height, state);

            Hyena.Gui.CairoExtensions.DisposeContext (cr);
        }
Example #2
0
        public static void Gradient(Cairo.Context cr, Theme theme, Rect rect, double opacity)
        {
            cr.Save ();
            cr.Translate (rect.X, rect.Y);

            var x = rect.Width / 2.0;
            var y = rect.Height / 2.0;
            using (var grad = new Cairo.RadialGradient (x, y, 0, x, y, rect.Width / 2.0)) {
                grad.AddColorStop (0, new Cairo.Color (0, 0, 0, 0.1 * opacity));
                grad.AddColorStop (1, new Cairo.Color (0, 0, 0, 0.35 * opacity));
                cr.SetSource (grad);
                CairoExtensions.RoundedRectangle (cr, rect.X, rect.Y, rect.Width, rect.Height, theme.Context.Radius);
                cr.Fill ();
            }

            cr.Restore ();
        }
Example #3
0
 protected override void OnStyleUpdated()
 {
     base.OnStyleUpdated ();
     theme = ThemeEngine.CreateTheme (this);
     theme.Context.Radius = 10;
 }
Example #4
0
 protected override void OnRealized()
 {
     base.OnRealized ();
     theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);
 }
 protected override void OnStyleSet (Style old_style)
 {
     base.OnStyleSet (old_style);
     theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);
 }
Example #6
0
        protected override void OnStyleSet (Style old_style)
        {
            base.OnStyleSet (old_style);
            theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);

            var light_text = Hyena.Gui.Theming.GtkTheme.GetCairoTextMidColor (this);
            header_renderer.Foreground = CairoExtensions.ColorGetHex (light_text, false);
        }
Example #7
0
 private void InitTheme()
 {
     theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);
     frame_width = (int)theme.Context.Radius + 1;
 }
Example #8
0
        protected override void OnStyleSet(Style old_style)
        {
            if (changing_style) {
                return;
            }

            changing_style = true;

            theme = new GtkTheme (this);
            if (canvas_child != null) {
                canvas_child.Theme = theme;
            }

            changing_style = false;

            base.OnStyleSet (old_style);
        }
Example #9
0
 protected override void OnRealized()
 {
     base.OnRealized ();
     theme = new GtkTheme (this);
 }
Example #10
0
 protected override void OnStyleSet (Style previous_style)
 {
     base.OnStyleSet (previous_style);
     theme = Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);
     frame_width = (int)theme.Context.Radius + 1;
 }
Example #11
0
        protected override void OnStyleUpdated()
        {
            if (changing_style) {
                return;
            }

            changing_style = true;

            theme = new GtkTheme (this);
            context.Theme = theme;
            if (canvas_child != null) {
                canvas_child.Theme = theme;
            }

            changing_style = false;

            base.OnStyleUpdated ();
        }
Example #12
0
        protected override void DrawShape(Cairo.Context cr)
        {
            theme = theme ?? Hyena.Gui.Theming.ThemeEngine.CreateTheme (this);

            cr.SetSourceRGBA (0, 0, 0, 0);
            cr.Operator = Cairo.Operator.Source;
            cr.Paint ();

            var box_height = Allocation.Height - ArrowSize;
            var arrow_x = (Allocation.Width - ArrowSize) / 2;
            /*
            cr.NewPath ();

            CairoExtensions.RoundedRectangle (cr, 0, 0,
                Allocation.Width, box_height, CornerRadius);

            cr.Operator = Cairo.Operator.In;

            cr.MoveTo (arrow_x, box_height);
            cr.LineTo (Allocation.Width / 2, Allocation.Height);
            cr.LineTo (arrow_x + ArrowSize, box_height);

            cr.ClosePath ();

            var grad = new Cairo.LinearGradient (0, 0, 0, Allocation.Height);
            grad.AddColorStop (0, theme.Colors.GetWidgetColor (GtkColorClass.Background, StateType.Normal));
            grad.AddColorStop (1, theme.Colors.GetWidgetColor (GtkColorClass.Background, StateType.Active));

            cr.Operator = Cairo.Operator.Over;
            cr.Pattern = grad;
            cr.FillPreserve ();

            cr.Color = theme.Colors.GetWidgetColor (GtkColorClass.Dark, StateType.Active);
            cr.Stroke ();*/

            double x = 0, y = 0;
            double w = Allocation.Width;
            double h = box_height;
            double r = 20;

            cr.NewPath ();

            cr.MoveTo (x + r, y);
            cr.LineTo (x + w - r, y);
            cr.Arc (x + w - r, y + r, r, Math.PI * 1.5, Math.PI * 2);
            cr.LineTo (x + w, y + h - r);
            cr.Arc (x + w - r, y + h - r, r, 0, Math.PI * 0.5);
            cr.LineTo (x + r, y + h);
            cr.Arc (x + r, y + h - r, r, Math.PI * 0.5, Math.PI);
            cr.LineTo (x, y + r);
            cr.Arc (x + r, y + r, r, Math.PI, Math.PI * 1.5);

            cr.ClosePath ();

            cr.Color = new Cairo.Color (0, 0, 0, 1);
            cr.Fill ();

            //grad.Destroy ();
        }
Example #13
0
 protected override void OnStyleSet (Style previous_style)
 {
     base.OnStyleSet (previous_style);
     theme = ThemeEngine.CreateTheme (this);
     theme.Context.Radius = 10;
 }