Maximize/Restore functionality for MyGUI::Window

simed

26-10-2011 21:55:44

I thought it would be cool to add simple maximize/restore functionality... double-clicking a Window's caption would toggle it from being maximized and normal state.
I ran into a couple of issues,mostly centered around the difference between resizable and non-resizable Windows:
  1. I only want resizable windows to support maximizing... given an existing Window*, I can't see how to tell if it's resizable.[/*:m]
  2. When a window is maximized, I want to stop it being manually resizable by dragging corners[/*:m]
  3. My maximize code looks a bit like: setRealCoord(0,0,1,1) followed by setAlign(Align::Stretch). But this invariably means window caption is hidden underneath my menu and now I can't move/close/restore[/*:m][/list:o]Advice on any of these issues would be great... the core idea works nicely enough.

simed

30-10-2011 23:29:58

Regarding menu overlap, one thing I tried was to create a top-level widget the size of the entire window, minus the menu; and then parent all Windows to this "desktop" window:
init()
{
m_area = m_gui->createWidgetT("Widget","EmptySkin",
0,m_menuBar->getBottom(),size.width,size.height,
Align::Stretch,"Overlapped");
}

addDialog(Window *dlg)
{
dlg->attachToWidget(m_area,MyGUI::WidgetStyle::Overlapped);
}


However this ran into two problems:
  1. I used an empty panel as the desktop so it would be invisible, but found it consumed mouse events even when clicking on the empty parts - I want the child windows to receive mouse events but not the 'desktop' itself.[/*:m]
  2. Overlapping doesn't work properly. Even though I create my 'desktop' in 'Overlapped' layer and use WidgetStyle::Overlapped for parenting, if I add 2 'dialogs' and drag one on top of the other, mouse input often goes to the wrong window... though rendering is not broken.[/*:m][/list:o]

    So, is what I am doing here workable - does MyGUI support proper hierarchy of nested widgets?

simed

31-10-2011 22:26:05

Overlapping doesn't work properly. Even though I create my 'desktop' in 'Overlapped' layer and use WidgetStyle::Overlapped for parenting, if I add 2 'dialogs' and drag one on top of the other, mouse input often goes to the wrong window... though rendering is not broken.Actually, looking at this more, it's more than that. Rendering is done in the right order, but mouse-picking when windows overlap is in exactly the wrong order. In other words if I put 3 windows on top of each other and click, the bottom one receives the event and raises to the top. Click again and the new bottom window (the middle one initially) now raises to top. And so on - I can cycle through the windows in this way. I can't figure out what's going on here but it seems like something that almost works.