Exemplo n.º 1
0
        void SyntaxCellRenderer(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
        {
            var    renderer = (Gtk.CellRendererText)cell;
            var    data     = (ColorMetaData)colorStore.GetValue(iter, 2);
            var    style    = (ChunkStyle)colorStore.GetValue(iter, 1);
            string markup   = GLib.Markup.EscapeText(data.Description);

            if (style.Bold)
            {
                markup = "<b>" + markup + "</b>";
            }
            if (style.Italic)
            {
                markup = "<i>" + markup + "</i>";
            }
            renderer.Markup = markup;
            if (data.ColorsAvailable == ColorsAvailable.Text || data.ColorsAvailable == ColorsAvailable.FgBg)
            {
                renderer.ForegroundGdk = style.Color;
                renderer.BackgroundGdk = style.GotBackgroundColorAssigned ? style.BackgroundColor : Style.Base(StateType.Normal);
            }
            else
            {
                var b = Math.Abs(HslColor.Brightness(style.Color) - HslColor.Brightness(Style.Text(StateType.Normal)));
                renderer.ForegroundGdk = b < 0.4 ? Style.Background(StateType.Normal) : Style.Text(StateType.Normal);
                renderer.BackgroundGdk = style.Color;
            }
        }
Exemplo n.º 2
0
        void SyntaxCellRenderer(Gtk.CellLayout cell_layout, Gtk.CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
        {
            var    renderer = (Gtk.CellRendererText)cell;
            var    data     = (ColorScheme.PropertyDecsription)colorStore.GetValue(iter, 1);
            string markup   = GLib.Markup.EscapeText(data.Attribute.Name);

            renderer.Markup = markup;
        }
Exemplo n.º 3
0
        void HandleCellLayoutDataFunc(Gtk.CellLayout cell_layout, CellRenderer cell, Gtk.TreeModel tree_model, Gtk.TreeIter iter)
        {
            string text = DomainHelper.GetTitle(tree_model.GetValue(iter, 0));

            (cell as CellRendererText).Text = text;
        }