internal void ShowWithMode(ShowMode mode)
{
if (m_Parent == null)
{
SavedGUIState oldState = SavedGUIState.Create();
ContainerWindow cw = ScriptableObject.CreateInstance <ContainerWindow>();
cw.title = titleContent.text;
HostView host = ScriptableObject.CreateInstance <HostView>();
host.actualView = this; // Among other things, this sets m_Parent to host
Rect r = m_Parent.borderSize.Add(new Rect(position.x, position.y, position.width, position.height));
// Order is important here: first set rect of container, then assign main view, then apply various settings, then show.
// Otherwise the rect won't be set until first resize happens.
cw.position = r;
cw.rootView = host;
MakeParentsSettingsMatchMe();
cw.Show(mode, loadPosition: true, displayImmediately: false, setFocus: true);
// set min/max size now that native window is not null so that it will e.g., use proper styleMask on macOS
cw.SetMinMaxSizes(minSize, maxSize);
oldState.ApplyAndForget();
}
}