Recommended Posts

I am currently trying to add in a user interface system to my engine. I have the window drawing in place and have a system where by u can attach other windows as children etc etc.
However, my problem is that when i move a bigger window over a smaller one and when the user clicks ontop of both windows, both receive messages.
What i think i need is some kind of Z-Ordering. Here is the system i propose.
-When a child is added to the main Interface class it is set onto the top of the stack and thus is the active one.
-When a user clicks on my applications window the message is passed to the Interface class. This checks to see if the active window (top of the stack) is the window that gets it (if the mouse x and y are within the window).
-If so, that window receives the message and the loop quits
-If not, the loop continues until it finds a window that has been hit, this is then set as the active one (put to the top of the stack)
-If no window is hit then the list remains the same.
I can, in this case use this list of windows as the list that i use to draw my windows (i will get proper Z-Ordering).
Does this seem like a good way to do it ?
How would it be best to move windows to the top of the ''stack'' ?
-Also, i dont want to be using 3rd party libraries such as GLUI.