Resources for creating a GUI Layout Manager?
I was working on a simple GUI and ended up at the roadblock. I haven't found examples or even readable sources on how to create a GUI layout manager. I was wondering if anyone knows about some resources when building one or some source code that is not cryptic like Qt's linking mechanism.
source to share
It depends on what you mean by "layout manager" and I'm not familiar with Qt, so it doesn't give me much clue.
If you mean things like window resizing, I believe the appropriate term is "constraint solver". I never really understood this, but I believe that GUI constraint solvers are based on linear programming - Simplex Algorithm and all. Maybe something can be done with Gaussian Elimination , but I'm not sure about that.
Based on a quick search for "linear programming of the gii line", you might find this article from CiteSeerX interesting - there's a PDF download there. If you don't like cryptic, well, at first glance, at least it's not exactly mathematically hard, but I suspect it's not easy reading either. I think I'll find out soon, as you are interested.
source to share
I am currently making a Windows port for Mozilla XUL. My approach does not involve linear programming techniques like Steve, but it is a more object oriented approach. It is based on the Composite and Decorator design patterns.
A composite template allows you to create controls with child controls, which in turn can have children of their own. The control is responsible for positioning its child controls within the selected client rectangle.
For example, suppose you want to implement a layout that positions its child controls horizontally. The layout algorithm then has to calculate the width of each child control in order to calculate the x offsets for each child control.
Calculating the width of the container is done by returning the sum of the width of the child controls.
Decorator classes can be used to add additional properties. For example, a MarginDecorator can add spacing between child controls, a ScrollDecorator can scroll scrollbars, etc.
This is a funny thing, I wish you the best of luck!
source to share