Drawing widgets in a custom cellrenderer



Hi Everyone,

I was wondering if it's possible or not to draw widgets into a custom cellrenderer. Basically, I'm trying to achieve something like that shown here - http://beagle-project.org/images/b/b2/BeagleScreenie_crop.png where child rows may either be rendererd as individual treeviews or iconviews depending on the content within them although occasionally I might need to render an arbitrary widget too.

What i've tried so far amounts to something derived from examples/celrenderer_progress.pl but I am stuck at rendering the widget onto  the custom cellrenderer. Now, from what i can understand from the various examples of custom renderers, you paint an object onto the widget's style (as per Gtk2::Style::Paint_*) but how is a widget to be renderered?

package Gtk2::CellRendererWidget;

use strict;
use warnings;
use Glib qw(G_PARAM_READWRITE);
use Gtk2;
use Glib::Object::Subclass
    "Gtk2::CellRenderer",
    properties => [
      Glib::ParamSpec->object ('widget',
                               'widget',
                               'The widget to display',
                   'Gtk2::Widget', G_PARAM_READWRITE),
    ],
  ;

sub INIT_INSTANCE { my $self = shift; }

sub RENDER {
    my ($cell, $drawable, $widget, $bg_area, $cell_area, $expose_area, $flags) = @_;

    my $cwidget = $cell->{widget};   # how is $cwidget rendered onto $widget?
}

...
1;

I've searched far and wide but have turned up nothing fruitful. Somebody's attempted this in python but doesn't seem to have gotten anywhere - http://www.nabble.com/Drawing-widgets-in-a-custom-cellrenderer-td14207692.html .

I'd very much appreciate if someone could shed some light on this.

Thanks,

Shalom




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]