cxhawk
January 6, 2010, 9:27pm
1
In Mac OSX, after doing the following on a DocumentWindow:
setUsingNativeTitleBar(true);
setFullScreen(true);
The window is maximized, but the title bar is hidden behind the OSX menu bar. This is strange because users cannot move/restore the window anymore.
However, by clicking the maximize button on the title bar, it’s fine.
So my question is there a programmatic way to perform a maximize?
jules
January 6, 2010, 10:05pm
2
It doesn’t do that at the moment but probably should do… Maybe something like this:
[code]void NSViewComponentPeer::setFullScreen (bool shouldBeFullScreen)
{
if (! isSharedWindow)
{
Rectangle r (lastNonFullscreenBounds);
setMinimised (false);
if (fullScreen != shouldBeFullScreen)
{
if (shouldBeFullScreen && (getStyleFlags() & windowHasTitleBar) != 0)
{
fullScreen = true;
[window performZoom: nil];
}
else
{
if (shouldBeFullScreen)
r = Desktop::getInstance().getMainMonitorArea();
// (can't call the component's setBounds method because that'll reset our fullscreen flag)
if (r != getComponent()->getBounds() && ! r.isEmpty())
setBounds (r.getX(), r.getY(), r.getWidth(), r.getHeight(), shouldBeFullScreen);
}
}
}
}[/code]