Forum: Ruby-Gnome 2 treeview internal widgets question

Posted by Dobai-Pataky Bálint (Guest)
on 2008-11-30 23:06
Attachment: dpblnt.vcf (162 Bytes)
(Received via mailing list)
Hi,

I'd like to implement a widget of two Fixeds in a Vbox, attached to a
TreeView in a HBox.
The top Fixed would be attached to the TreeView's header, in sense, it'd
allocate the same vertical space. Would show some cairo drawings.
The Bottom Fixed would show some cairo drawings. in a ScrolledWindow,
scrolled by the TreeView's vertical scroller.

My current problem is: i can't get the TreeView's columns' allocated
height, so i could fixate the height of the top Fixed.
Is it possible?
i tried TreeViewColumn.widget.allocation, but the widget it's nil, since
it's not set by me.
I'd welcome anything

Thanks
Balint
Posted by Roy Wright (royw)
on 2008-12-02 02:26
Dobai-Pataky Bálint wrote:
> I'd like to implement a widget of two Fixeds in a Vbox, attached to a
> TreeView in a HBox.
> The top Fixed would be attached to the TreeView's header, in sense, it'd
> allocate the same vertical space. Would show some cairo drawings.
> The Bottom Fixed would show some cairo drawings. in a ScrolledWindow,
> scrolled by the TreeView's vertical scroller.
> 
> My current problem is: i can't get the TreeView's columns' allocated
> height, so i could fixate the height of the top Fixed.
> Is it possible?
> i tried TreeViewColumn.widget.allocation, but the widget it's nil, since
> it's not set by me.
> I'd welcome anything

While I haven't tried what you are doing, here's a suggestion.  Don't 
use Fixeds.  Instead create an Image to place in the VBox.  I haven't 
looked at cairo yet, but am assuming you can draw on a Pixbuf which you 
can get from the Image.

HTH,
Roy
Posted by Dobai-Pataky Bálint (Guest)
on 2008-12-02 09:52
Attachment: plan_low.jpg (20,6 KB)
Attachment: dpblnt.vcf (162 Bytes)
(Received via mailing list)
resending with lowres image, to avoid the 40Kb limit

Roy Wright wrote:
>> height, so i could fixate the height of the top Fixed.
>> Is it possible?
>> i tried TreeViewColumn.widget.allocation, but the widget it's nil, since
>> it's not set by me.
>> I'd welcome anything
>>     
>
> While I haven't tried what you are doing, here's a suggestion.  Don't 
> use Fixeds.
How would that help me get the TreeView's header widgets' height?
>   Instead create an Image to place in the VBox.  I haven't 
> looked at cairo yet, but am assuming you can draw on a Pixbuf which you 
> can get from the Image.
>   
Even on the Image  I'd use cairo, i need transparency.

I attached an image, so it's easier to get want i want to do.
Now the top Fixed is fixed to a 20px height, but that may change with
the theme or if the Column header text is wrapped into rows.

Thanks
Balint
Posted by Roy Wright (royw)
on 2008-12-02 23:57
OK, here's kind of an ugly way that may do what you want.

A TreeView header is actually a Button.  Here's a php-gtk tutorial that 
includes how to get the Button.

http://www.kksou.com/php-gtk2/articles/set-the-background-color-of-the-column-header-of-a-treeview.php

I think you can then get the size from Gtk::Widget#size_request, but 
haven't tried it.  There is a caveat on size_request must be associated 
with a screen.

HTH,
Roy
Posted by Dobai-Pataky Bálint (Guest)
on 2008-12-03 11:51
Attachment: dpblnt.vcf (162 Bytes)
(Received via mailing list)
hi Roy,

this php example sets the column widget, and then uses it, in my
question i noted, that i use the default column widgets, thus
TreeViewColumn.widget returns nil.
my original question was if i can query the header height without using
custom column widgets, but seems this is the only way. i might give that
a try.

thanks for your support
balint
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.