Re: Custom cel renderer



Hi,

On Fri, Sep 07, 2007 at 05:33:37PM +0530, amol wrote:
What i am trying is to implement  'cell_class->render' and in it try to
draw this widget on parent GdkWindow through gdk_draw_drawable() but i
am not able to get GdkDrawable (GdkWindow) of widget(i.e of button) to
draw it on destination GdkWindow.

GtkButton is a no-window widget (together with a lot of other widgets),
which means that it draws directly on the parent widget's window.  It
does not create a window itself to draw on.

Is there any way to draw this widget on parent GdkWindow or is there any
other way to display widgets with cellrenderer?
Are there any guidelines to write custom cellrenderer which will display
any GtkWidget?

There isn't any cell renderer that displays GtkWidgets.  If at all
possible, it will be hard to get right -- keep in mind that widgets and
cell renderers are very different.  For example: the same cell renderer
is used to render content for every row, how would your cell renderer
deal with this?  Even if you get the cell renderer to draw the widget,
it won't be able to do much because cell renderers do not receive
GdkEvents.

You are probably much better off to "mimic" a widget in a cell renderer
by drawing it yourself.  For example GtkCellRendererProgress is drawing
the progress bars in exactly the same style as the GtkProgressBar widget
by using the gtk_paint_*() calls.  You can draw a button by using the
same set of gtk_paint_*() calls as GtkButton does.


regards,

-kris.



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