Managing pop-up GUI items

Started by
3 comments, last by AaronWizardstar 10 years, 11 months ago

In a GUI system, what would be a good way to represent pop-up items such as menus and dialog boxes?

My GUI system is based on trees of widgets, e.g. a panel has a button has a label. Now I need widgets that are on top of other widgets instead of just inside them. Some pop-ups are modal, like dialog boxes, but some pop-ups like collapsable menus would only block the widgets directly under them.
One idea I had was to have all my widget trees in a stack. The tree for my main interface would live at the bottom, and any pop-ups would be additional trees pushed on to the stack. A widget tree could also have a flag for whether it's modal or not, likely kept in its root widget.
I'd also want to position some pop-ups relative to another widget, like a menu that's under a button. I'm not sure how I'd be able to do that aside from working out the screen coordinates of the parent widget. I wouldn't make the pop-up an actual child of the parent widget, since that relationship is for widgets contained by other widgets.
Advertisement

Yeah I've seen some people implement modal type dialog boxes using a stack (some even use the built in stack you get through function calls - simply returning back to the underlying window when the topmost "pop-up" is closed).

As to your final question, if you don't use inheritance to push a parent window's screen position to its children, you could push that information through parameters when the parent window makes the function calls to pop-up its child widget(s).

Honestly there are so many already built GUI systems that you are probably wasting your time working on this unless you are just doing it solely to teach yourself something. For Windows you could try, GDI, Win32 APIs, for DirectX you could use DXUT, for other platforms and languages simple Google searches will turn up a few pre-built GUI libraries you could link into your project (Scaleform is a good choice for larger more professional projects).

As to your final question, if you don't use inheritance to push a parent window's screen position to its children, you could push that information through parameters when the parent window makes the function calls to pop-up its child widget(s).

I do push the parent's position in a way. When I draw a widget, I translate the screen coordinates by the widget's (x, y) position before drawing the children.
That's for widgets that are inside widgets though, and the parent widget stores its child widgets. Most widgets even clip the screen by their dimensions before drawing their children. I don't think I can represent "anchored" pop-ups the same way.

Honestly there are so many already built GUI systems that you are probably wasting your time working on this unless you are just doing it solely to teach yourself something. For Windows you could try, GDI, Win32 APIs, for DirectX you could use DXUT, for other platforms and languages simple Google searches will turn up a few pre-built GUI libraries you could link into your project (Scaleform is a good choice for larger more professional projects).

I could start a new thread on this, but requirements and restrictions prevent me from using most libraries. I want to be cross platform - I'm actually developing on a Mac - so Windows and DirectX based libraries are out (so are Apple's libraries). I'm doing this as a hobby and intend to make my game open source, so it's hard to justify to myself spending money on a GUI library, or even a general toolkit like Flash. Most of the cross platform open source [C++] libraries besides CEGUI seem to be in a perpetually alpha state, and I was turned off by CEGUI because it seemed to want to do its own rendering and resource management independent of my own engine's rendering and resource management. I briefly looked at libRocket and decided structuring everything in HTML didn't mesh with me since I couldn't figure out how to make a mouse cursor. And I'm programming my game in Ruby with Gosu, so most of those libraries would be unusable for me anyway. sad.png

Hello,

At Coherent Labs we're developing a HTML5-based GUI library that will help you with the pop-up GUI. However, we're a commercial closed source vendor. So it might not be appropriate for your game but you can give it a try.

There are also some open source solutions that might help you out:

Chromium Embedded Framework

EAWebKit

I hope this will help you out with your project.

Thanks for the post, Martin, though unfortunately I'm not sure your suggestions would be much help.

There are also some open source solutions that might help you out:
Chromium Embedded Framework
EAWebKit

There isn't any info on the EAWebKit page. Just a couple of download links.

The Chromium Embedded Framework would require me to dip into C++. In that case I'd might as well try to learn libRocket again, since that would likely be lighter than embedding all of the Chromium engine.

Thanks anyway though.

This topic is closed to new replies.

Advertisement