Re: GtkScale small feature

On 1 May 2000, Owen Taylor wrote:

> 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)

shouldn't that be value_size_request to stick to the established
::size_request signal name?

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

you need to pass in an allocation here, not just the upper left and right,
to avoid extra complexity on the signal handler implementation side (i.e.
storing the last requisition).

> Regards,
>                                         Owen


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