A way to get the size of layout
Currently it's quite hard to get the bounding box of a layout. (Top left and bottom right points.) This is useful for placing backdrops for dynamic generated GUI (like item lists), as well as for creating scroll enabled GUI.
A solution could be to add a boundingSize() function to layout that return x, y, width, height where x,y points to the absolut top position of the layout.
I came here to ask for the same feature, and I see it was requested six years ago. @vrld are you still accepting PRs for this project? I'll probably end up implementing a Layout:boundingBox() method in my fork, and would be happy to pass it along when it's done.
I am not maintaining this project anymore. However, there is Layout:size() and you can access the origin with layout._x, layout._y.
Thank you for clarifying; I won't bother with the PRs then. I'm grateful that you've provided this project in the first place; overall I've had no trouble integrating it into my game, and feel confident that I can extend and fix things as necessary from here. I've already hacked in some primitive support for modal dialogs.
I did see Layout:size(), but as far as I could tell the _x,_y,_w,_h values tracked by Layout are the bounding box of the most recently returned cell, not of the layout as a whole. I believe that a better solution for immediate layouts would be to add min and max x/y fields to the Layout struct, track the largest & smallest values returned by any of the other methods, and add a new boundingBox() method that returns the accumulated min and max extents. Precomputed layouts could just precompute the overall extents at init time, of course. It's still probably not 100% bulletproof, since users could theoretically ask for cell coordinates with nextRow() and nextCol() and then not use them, but it's probably good enough for most cases.
You're right. Truth is I haven't looked at this code in a long time, so I am not sure what the right approach is here. Tracking the extent like you described sounds like a good option.