in Scripts/Editor/WitEditorUI.cs [235:292]
public static void LayoutLockedTextField(GUIContent key, ref string fieldValue, ref bool isUpdated)
{
// Determine if locked
string fieldId = GetFoldoutID(key.text);
bool isEditing = unlockFieldId.Equals(fieldId);
// Begin Horizontal
GUILayout.BeginHorizontal();
// Hide if not editing
GUI.enabled = isEditing;
// Layout
string newFieldValue = isEditing ? unlockFieldText : fieldValue;
bool newUpdate = false;
LayoutTextField(key, ref newFieldValue, ref newUpdate);
// Allow next item
GUI.enabled = true;
// Updated
if (newUpdate && isEditing)
{
unlockFieldText = newFieldValue;
}
// Cancel vs Apply Buttons
if (isEditing)
{
if (LayoutIconButton(WitStyles.ResetIcon))
{
unlockFieldId = string.Empty;
unlockFieldText = string.Empty;
GUI.FocusControl(null);
}
if (LayoutIconButton(WitStyles.AcceptIcon))
{
if (!string.Equals(fieldValue, unlockFieldText))
{
fieldValue = unlockFieldText;
isUpdated = true;
}
unlockFieldId = string.Empty;
unlockFieldText = string.Empty;
GUI.FocusControl(null);
}
}
// Edit button
else
{
if (LayoutIconButton(WitStyles.EditIcon))
{
unlockFieldId = fieldId;
unlockFieldText = fieldValue;
}
}
// End Horizontal
GUILayout.EndHorizontal();
}