Re: inserting ColorButton in CellRenderer ....



Thanks for your help. I'm trying to follow your directions.  I still have some doubts about how to define the two functions you wish me to override.  In get_size_vfunc I receive a &Widget, a Gdk::Rectangle* cell_area, an offset to x and y and a width and height parameters.  How can I use them? Do I set those parameters onto the oncoming widget or do I set them from the Widget's parameters??  For the second function render_vfunc I didn't clearly understand what you wanted me to do.

Thanks

On Thu, Mar 13, 2008 at 4:39 AM, Andrew E. Makeev <andrew solvo ru> wrote:
В Срд, 12/03/2008 в 20:24 -0400, Roberto Alejandro Espí Muñoz пишет:
Tha
> Hi!! I'm trying to use the TreeView widget to show a series of fields
> I have predefined.  One of those is a color atributte.  I was thinking
> maybe using a ColorButton per row.  When I tried to insert it though I
> noticed that the CellRenderer class that determines special kinds of
> widgets on rows only allows a group of them.  My question is, how can
> I insert the ColorButton widget in the TreeView or can anyone let me
> know of a workaround of displaying a color attribute field??
>

Just create your own renderer:

class UserCellRendererColorButton : public CellRenderer

override get_size_vfunc, render_vfunc and add (or reuse from
CellRenderer) properties you will read to draw the button widget (you
will need color value at least).

Inside get_size_vfunc you should set dimensions for ColorButton widget.

Inside render_vfunc you should use method from Gtk::Style that draws
Button (ColorButton) widget.

When creating TreeViewColumn, you should set attribute:

treeColumn->add_attribute( yourRenderer->your_color_property(), yourColumnModel.colorButtonColumn );

Simple, and always works :)

-andrew





--
teratux
------------
http://teratux.blogspot.com


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