// 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 internal void ShowAsDropDown(Rect buttonRect, Vector2 windowSize, PopupLocationHelper.PopupLocation[] locationPriorityOrder, ShowMode mode) { // Setup position before bringing window live (otherwise the dropshadow on Windows will be placed in 0,0 first frame) position = ShowAsDropDownFitToScreen(buttonRect, windowSize, locationPriorityOrder); // Show window and focus 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 (focusedWindow != this) { Focus(); } // 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; }
// 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; }