Re: GtkScale small feature

Havoc Pennington <> writes:

> Hi,
> If anyone wants a small useful GTK project, GtkScale could be hacked
> so that a custom draw_value can be easily provided in a subclass; I
> think this means you need to virtualize the get_value_width()
> function, and then be sure there's a way for the implementor of a
> custom draw_value() to determine the position where they should draw
> the value.

Note that this portion has been changed in the Pango branch of 
GTK+ - it is now get_value_size() not get_value_width().

I think that the right way to do it is to have two 
virtual functions / signals. (They should be signals to allow
easy overriding in C)

 - get_value_size():  (Argument a GtkRequisition, to be filled in)

 - draw_value():      Draw the value - the coordinates passed
                      in are the upper left corner of the 
                      requisition returned by get_value_size().

Another possible approach is to replace these with get_value_text();
the problem with this is that determining the maximum size from this
is difficult unless the size of the value is known to be maximum at
either the maximum or minimum position of the slider.

Which is not going to be the case in such usages as a slider where the
value is the name of a day of a week.



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