[gtkada] How to set the pixbuf attribute of a gtk_cell_renderer_pixbuf
Rob Groen
robgr at xs4all.nl
Sun Sep 21 12:32:08 CEST 2008
Thanks Dmitry, sorry for the long delay in replying
Dmitry A. Kazakov wrote:
> On Sun, 24 Aug 2008 12:36:12 +0200, you wrote:
>
>
>> How do you set the pixbuf property of a Gtk_Cell_Renderer_Pixbuf ?
>> The property type is a Glib.Properties.Property_Object, but a Pixbuf is
>> derived from Glib.C_Proxy.
>>
>> So, the compiler won't accept a call to Glib.Properties.Set_Attribute
>> with a Pixbuf as parameter, and there are no type conversions that make
>> sense
>>
>
> Hmm, Set_Property or Add_Attribute? There is no Set_Attribute.
>
I meant Set_Property. That was my first attemp and obviously not the
right one. However, this still leaves the question of how to set the
pixbuf property of a gtk_cell_renderer_pixbuf with Set_Property
> What are you going to achieve? Normally, you create a renderer, pack it
> into a column and then add an attribute to bind the column, the renderer
> and a model column containing the image or its name together. Sort of:
>
> declare
> Column_No : GInt;
> Column : Gtk_Tree_View_Column;
> Icon : Gtk_Cell_Renderer_Pixbuf;
> begin
> -- The first visible column will be an image of the model's column 0
> Gtk_New (Column);
> Set_Title (Column, "Icon");
> Gtk_New (Icon);
> Pack_Start (Column, Icon, True);
> Add_Attribute (Column, Icon, "pixbuf", 0);
> Column_No := Append_Column (Tree_View, Column);
> ...
>
> Usually you never need to set this property manually. It is the job of the
> tree view widget. It will permanently reset this property when it needs to
> render the column. So it makes little or no sense to set or query it.
>
>
Indeed, that is the way I've done it. Thnx
Rob
More information about the gtkada
mailing list