I’ve been fighting with creating a resizable DocumentWindow that does not allow the maximize button to be used. I haven’t found a solution yet, and i’ve tried stepping through all of the DocumentWindow/ResizableWindow/TopLevelWindow code to find where the ComponentPeer::StyleFlags::windowHasMaximiseButton is being set to true when calling the constructor for DocumentWindow like this:
juce::DocumentWindow(contentToDisplay.getName(),
Colours::white,
0)
This is super easy to verify that it doesn’t work as expected if you create a new GUI project, and set up the MainWindow constructor like this:
class MainWindow : public DocumentWindow
{
public:
MainWindow (String name) : DocumentWindow (name,
Colours::lightgrey,
0) //DocumentWindow::allButtons to '0'
{
setUsingNativeTitleBar (true);
setContentOwned (new MainContentComponent(), true);
setResizable(true, false); //add this line here
centreWithSize (getWidth(), getHeight());
setVisible (true);
}
For whatever reason (I haven’t found it yet), the call to setResizable(true,...) seems to override the ComponentPeer flag for showing/hiding the MaximizeButton. Also, doing this:
void maximiseButtonPressed() override
{
/*
since I can't seem to make this button be hidden, I'll just override the behavior so it doesn't do anything.
*/
}
has no effect whatsoever.
Is there a proper way to make this happen?
a few months ago I was able to get somewhat of a similar behavior with a completely hidden title bar that allowed being resizable via this:
class SeparateWindowModule : public juce::Component, public AsyncUpdater, //etc
{
SeparateWindowModule()
{
//snip...
addToDesktop(juce::ComponentPeer::windowIsResizable /*| ComponentPeer::windowHasDropShadow */ );
getPeer()->setConstrainer(&constrainer); //gotta set the constrainer AFTER its on the desktop. there's no peer until it's on the desktop
triggerAsyncUpdate();
}
void handleAsyncUpdate() override
{
toFront(true); //must be called after the window is visible
}
}
However, this approach is just a regular component and doesn’t have a title bar.
Any ideas?!?!

