// Draws the help and settings part of the header.
// Returns a Rect to know where to draw the rest of the header.
internal virtual Rect DrawHeaderHelpAndSettingsGUI(Rect r)
{
// Help
var settingsSize = EditorStyles.iconButton.CalcSize(EditorGUI.GUIContents.titleSettingsIcon);
float currentOffset = settingsSize.x;
const int kTopMargin = 5;
// Settings; process event even for disabled UI
Rect settingsRect = new Rect(r.xMax - currentOffset, r.y + kTopMargin, settingsSize.x, settingsSize.y);
var wasEnabled = GUI.enabled;
GUI.enabled = true;
var showMenu = EditorGUI.DropdownButton(settingsRect, EditorGUI.GUIContents.titleSettingsIcon, FocusType.Passive,
EditorStyles.iconButton);
GUI.enabled = wasEnabled;
if (showMenu)
{
EditorUtility.DisplayObjectContextMenu(settingsRect, targets, 0);
}
currentOffset += settingsSize.x;
// Show Editor Header Items.
return(EditorGUIUtility.DrawEditorHeaderItems(new Rect(r.xMax - currentOffset, r.y + kTopMargin, settingsSize.x, settingsSize.y), targets));
}