Hello, I am not trying to write whole new UI library, I use existing library, but I just want my own code to control positions of objects. I have one exact question, but I would apperciate any advices on how this can / is / should be done. I am familiar with multiple ui libraries, but I want to make sure that I am not forgetting anything.
Basic idea of my approach to UI composition is that there are <basic items> (buttons, images, and such) and <containers>. A <container> can contain multiple instances of both <containers> and <basic items>. Each item should propagate some informations about its preferred size to its parent. After this information propagates to the top level, each container will reize its children properly, dividing its size between those children. This way the UI should adapt to size changes nicely.
The thing I am not sure about is what exactly should be this information about required size of an item, that propagates to parent containers. I see two optons:
a) vec2 required_size_min, vec2 required_size_max
b) vec2 preferred_size
I initialy chose the first option (gtk has it like this I think), but then I realize, that:
- I might not be able to satisfy these requirements all the time
- required_size_max is too often 'infinity'
So currently I am leaning towards the second option (have just preferred_size), but I am afraid that I might run in another problems in the future.
Any advices?
Thx :-)