public void Show(ShowMode showMode, bool loadPosition, bool displayImmediately) { if (showMode == ShowMode.AuxWindow) { showMode = ShowMode.Utility; } if (showMode == ShowMode.Utility || ContainerWindow.IsPopup(showMode)) { this.m_DontSaveToLayout = true; } this.m_ShowMode = (int)showMode; if (!this.isPopup) { this.Load(loadPosition); } this.Internal_Show(this.m_PixelRect, this.m_ShowMode, this.m_MinSize, this.m_MaxSize); if (this.m_RootView) { this.m_RootView.SetWindowRecurse(this); } this.Internal_SetTitle(this.m_Title); this.SetBackgroundColor(ContainerWindow.skinBackgroundColor); this.Internal_BringLiveAfterCreation(displayImmediately, true); if (!(this == null)) { this.position = this.FitWindowRectToScreen(this.m_PixelRect, true, false); this.rootView.position = new Rect(0f, 0f, this.m_PixelRect.width, this.m_PixelRect.height); this.rootView.Reflow(); this.Save(); } }
// Show as drop down list with custom fit to screen callback // 'buttonRect' is used for displaying the dropdown below that rect if possible otherwise above // 'windowSize' is used for setting up initial size // 'locationPriorityOrder' is for manual popup direction, if null it uses default order: down, up, left or right // 'giveFocus' is for whether the window should immediately be given focus (default true) internal void ShowAsDropDown(Rect buttonRect, Vector2 windowSize, PopupLocation[] locationPriorityOrder, ShowMode mode, bool giveFocus) { // Setup position before bringing window live (otherwise the dropshadow on Windows will be placed in 0,0 first frame) position = ShowAsDropDownFitToScreen(buttonRect, windowSize, locationPriorityOrder); // ShowWithMode() always grabs window focus so we use ShowPopup() for popup windows so PopupWindowWithoutFocus // will work correctly (no focus when opened). if (ContainerWindow.IsPopup(mode)) { ShowPopupWithMode(mode, giveFocus); } else { ShowWithMode(mode); } // Fit to screen again now that we have a container window position = ShowAsDropDownFitToScreen(buttonRect, windowSize, locationPriorityOrder); // Default to none resizable window minSize = new Vector2(position.width, position.height); maxSize = new Vector2(position.width, position.height); // Focus window if (giveFocus && focusedWindow != this) { Focus(); } else { Repaint(); } // Add after unfreezing display because AuxWindowManager.cpp assumes that aux windows are added after we got/lost- focus calls. m_Parent.AddToAuxWindowList(); // Dropdown windows should not be saved to layout m_Parent.window.m_DontSaveToLayout = true; }