Re: size requests/allocations of own widgets



Ronald Bultje <rbultje ronald bitfreak net> writes:
> 
> I have made my own simple widget, it works, but one thing I don't like is
> that if I request a size (width/height) and one of them gets bigger, the
> other doesn't. Now, I really want the ration width:height to be 4:3. My
> simple solution was to just draw it bigger in the function
> gtk_<widget)_expose();, but that doesn't work. The image gets bigger but
> the allocated space doesn't, so the widgets below it are layed over my own.
> Does anyone know how to make a "fixed" width/height ration?
> 

There is no way to "force" an allocation, you must be prepared to
handle any allocation without crashing (though you might not be able
to display properly).

The right solution is just to pack your widget in containers such that
it gets its size request and not some other size. Normally this means
having "expand" and "fill" parameters turned off. I wouldn't solve
this problem by changing the widget itself (any more than you would
solve the problem of a huge distorted GtkButton by changing
GtkButton).

Havoc




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