I've built my own GUI on top of cocos2d::Node.
My UI base class is called GWidget, and it inherits Node. Some of my GWidget-derived classes are:
HorizontalLayoutWidget, VerticalLayoutWidget, HorizontalSpacerWidget, VerticalSpacerWidget, ButtonWidget,
On top of GWidget I've built windows and also a window manager that keeps track of window Z order and lets you drag windows around the screen. I also have Panels, which are windows that don't move. I've had the Qt way of doing layout in mind while coding this, since that's what I'm used to.
For instance, to create a requester window with content and a ok/cancel button pair, I do this (pseudocode):
- Create a GWindow
- Create a VerticalLayoutWidget
- Create a HorizontalLayoutWidget
- Create a HorizontalSpacer, the OK button, the Cancel button, and add them to the HorizontalLayout - the HorizonalSpacer has its isHorizontallyExpanding flag set, which means that it will push the two buttons to the right end of the HorizontalLayoutWidget.
- Add my requester content, such as a lineedit, scrollview or anything, to the VerticalLayoutWidget
- Add the HorizontalLayout, with buttons etc in it, to the VerticalLayoutWidget
- and finally, do GWindow->setContentWidget(myVerticalLayout)
I look forward to hearing about other approaches.
Edit: I had a look at the Studio UI code, but I don't think it works as dynamically as my system. If I'm wrong, please correct me.