Esempio n. 1
0
        protected override void Render(Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
        {
            int width, height;

            GetCellSize(widget, (int)(cell_area.Width - this.Xpad * 2), out width, out height);

            int x = (int)(cell_area.X + this.Xpad);
            int y = cell_area.Y + (cell_area.Height - height) / 2;

            StateType state;

            if (!sensitive)
            {
                state = StateType.Insensitive;
            }
            else if ((flags & CellRendererState.Selected) != 0)
            {
                state = StateType.Selected;
            }
            else
            {
                state = StateType.Normal;
            }

            if (IsGroup)
            {
                TreeGroup grp = new TreeGroup();
                grp.X     = x;
                grp.Y     = y;
                grp.Group = Text;
                grp.State = state;
                InternalTree tree = (InternalTree)widget;
                tree.Groups.Add(grp);
            }
            else
            {
                window.DrawLayout(widget.Style.TextGC(state), x, y, layout);
                int bx = background_area.X + background_area.Width - 1;
                using (Gdk.GC gc = new Gdk.GC(window)) {
                    gc.RgbFgColor = tree.Style.MidColors [(int)Gtk.StateType.Normal];
                    window.DrawLine(gc, bx, background_area.Y, bx, background_area.Y + background_area.Height);
                }
            }
        }
Esempio n. 2
0
        protected override void Render(Drawable window, Widget widget, Rectangle background_area, Rectangle cell_area, Rectangle expose_area, CellRendererState flags)
        {
            int width, height;
            GetCellSize (widget, (int)(cell_area.Width - this.Xpad * 2), out width, out height);

            int x = (int) (cell_area.X + this.Xpad);
            int y = cell_area.Y + (cell_area.Height - height) / 2;

            StateType state;
            if (!sensitive)
                state = StateType.Insensitive;
            else if ((flags & CellRendererState.Selected) != 0)
                state = StateType.Selected;
            else
                state = StateType.Normal;

            if (IsGroup) {
                TreeGroup grp = new TreeGroup ();
                grp.X = x;
                grp.Y = y;
                grp.Group = Text;
                grp.State = state;
                InternalTree tree = (InternalTree) widget;
                tree.Groups.Add (grp);
            } else {
                window.DrawLayout (widget.Style.TextGC (state), x, y, layout);
                int bx = background_area.X + background_area.Width - 1;
                Gdk.GC gc = new Gdk.GC (window);
               		gc.RgbFgColor = tree.Style.MidColors [(int)Gtk.StateType.Normal];
                window.DrawLine (gc, bx, background_area.Y, bx, background_area.Y + background_area.Height);
            }
        }