Help understanding baselines

I am trying to add support for baseline alignment to my container widget, but I still struggle to understand how I should behave.

To be specific, during .allocate() I call gtk_widget_size_allocate() for each child widget, and there I am asked to provide a baseline; my first question is: Should I give there the baseline provided by gtk_widget_measure() on the child? What if I want to use a different baseline?

My second question is: Could someone explain in simple terms and pseudo-code the algorithm used by GtkBox for baselines every time it calls gtk_widget_size_allocate() on a child (otherwise I will have to study the code, and that is not trivial)? The only explanation I have found so far is this (but I am still confused):

Sets the baseline position of a box.

This affects only horizontal boxes with at least one baseline aligned child. If there is more vertical space available than requested, and the baseline is not allocated by the parent then position is used to allocate the baseline with respect to the extra space available.


This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.