Hacker News new | ask | show | jobs
by KerrickStaley 4514 days ago
I had this idea about using a "utility" function to represent how useful a given amount of screen space is to each widget, and then choosing the layout that maximizes the sum of the utility functions. It hasn't gained any traction, and I haven't had time to implement it myself.

See http://gtk.10911.n7.nabble.com/Idea-for-automatic-widget-lay... for more details.

1 comments

I quite like this idea. A lot of toolkits already allow a widget to specify a "preferred size." I wonder if a simpler approach to your idea would be similar to e.g. the Accept-Content-Type HTTP header; a widget lists a series of preferred widths (or width ranges) with weights.

  preferred-width: 300px, 1.0; 200px..299px, 0.7; 100px..199px, 0.5;
That's slightly less flexible than a utility curve function, but (especially if ordered) is far easier to optimize for, as choices are ordered and restricted.