Re: Thinking about adjustments



On 6 Jun 2003, Owen Taylor wrote:

> This mail is an attempt to establish some rules for how adjustments are
> supposed to work:
>
> * Adjustments should always be construct only properties or appear as
> such. [1]

construct-only? that'd mean they can only be set at construction time,
not later. you probably mean just construct properties, i.e. they are
created for a widget around init time already.

> * If you replace the adjustment of a range widget with a new one,
> all properties of the new adjustment are preserved and applied to the
> range widget.
>
> * If you replace an adjustment of a scrollable widget (such as a
> gtkviewport), then all properties of the adjustment other than the value
> are replaced with those applicable to the viewport. The effect is (other
> than the new object) equivalent to:
>
> gtk_adjustment_set_value (range->hadjustment, new_hadjustment->value);

the value needs to be clamped into adjustment->lower and adjustment->upper -
adjustment->page_size before that. (unfortunately gtk_adjustment_set_value()
only clamps into lower, upper, not taking page size into account).

> * Directly setting the adjustments of a widget that is already within
> a scrolled window is illegal.

s/illegal/invalid/ ;)
how are you going to enforce this?

> [1] That is, the widget always appears to have an adjustment set; for
> widgets that have "public" [hv]adjusment fields, that means creating
> the adjustments at construct time. Widgets that keep the fields private
> could do it lazily.
>
> Regards,
> 					Owen
>

---
ciaoTJ




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