Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
You should search for general GUI theory -- the language you implement it in is irrelevant.
A GUI, imo, can be described as a hierarchy of drawable elements. This is how I designed my first GUI. A tree structure was used to contain windows (I implemented an MDI-ish system where each window had a collection of 0 to many subwindows, recursively).
Each window then contained a tree of widgets. Each widget could contain 0 to many sub-widgets.
I used a relatively simple algorithm to figure out which parts of each window are visible. Effectively, each window contained a list of visible rectangles. To repaint the screen, I would loop through all windows, and draw the rectangles that are visible per each window. This was a simple method that was acceptable to me. There are definitely other more efficient ways.
One other thing I did with my windowing system was create a backbuffer for each window. This meant each window was always occupying some area in memory, even if not visible. This area could, potentially, be as large as the entire screen. This is not overly efficient in memory use. The advantage, however, is that is can be drawn incredibly quickly using a bit blit.