private void DoPalettesDropdown() { string t = (!(this.palette != null)) ? GridPaintPaletteWindow.Styles.createNewPalette.text : this.palette.name; Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(t), EditorStyles.toolbarDropDown, new GUILayoutOption[] { GUILayout.Width(200f) }); if (GridPalettes.palettes.Count == 0) { if (EditorGUI.DropdownButton(rect, GUIContent.Temp(t), FocusType.Passive, EditorStyles.toolbarDropDown)) { this.OpenAddPalettePopup(rect); } } else { GUIContent content = GUIContent.Temp((GridPalettes.palettes.Count <= 0 || !(this.palette != null)) ? GridPaintPaletteWindow.Styles.createNewPalette.text : this.palette.name); if (EditorGUI.DropdownButton(rect, content, FocusType.Passive, EditorStyles.toolbarPopup)) { GridPalettesDropdown.MenuItemProvider itemProvider = new GridPalettesDropdown.MenuItemProvider(); this.m_PaletteDropdown = new GridPalettesDropdown(itemProvider, GridPalettes.palettes.IndexOf(this.palette), null, new Action <int, object>(this.SelectPalette), 200f); PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), this.m_PaletteDropdown); } } }
private void DoPalettesDropdown() { string name = palette != null ? palette.name : Styles.createNewPalette.text; Rect rect = GUILayoutUtility.GetRect(GUIContent.Temp(name), EditorStyles.toolbarDropDown, GUILayout.Width(k_DropdownWidth)); if (GridPalettes.palettes.Count == 0) { if (EditorGUI.DropdownButton(rect, GUIContent.Temp(name), FocusType.Passive, EditorStyles.toolbarDropDown)) { OpenAddPalettePopup(rect); } } else { GUIContent content = GUIContent.Temp(GridPalettes.palettes.Count > 0 && palette != null ? palette.name : Styles.createNewPalette.text); if (EditorGUI.DropdownButton(rect, content, FocusType.Passive, EditorStyles.toolbarPopup)) { var menuData = new GridPalettesDropdown.MenuItemProvider(); m_PaletteDropdown = new GridPalettesDropdown(menuData, GridPalettes.palettes.IndexOf(palette), null, SelectPalette, k_DropdownWidth); PopupWindow.Show(GUILayoutUtility.topLevel.GetLast(), m_PaletteDropdown); } } }