Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DrawActionButton.cs 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. using UnityEditor;
  2. using UnityEngine;
  3. namespace Unity.PlasticSCM.Editor.UI
  4. {
  5. internal static class DrawActionButton
  6. {
  7. internal static bool For(string buttonText)
  8. {
  9. GUIContent buttonContent = new GUIContent(buttonText);
  10. GUIStyle buttonStyle = new GUIStyle(EditorStyles.miniButton);
  11. buttonStyle.stretchWidth = false;
  12. Rect rt = GUILayoutUtility.GetRect(
  13. buttonContent,
  14. buttonStyle,
  15. GUILayout.MinWidth(UnityConstants.REGULAR_BUTTON_WIDTH));
  16. return GUI.Button(rt, buttonText, buttonStyle);
  17. }
  18. internal static bool ForCommentSection(string buttonText)
  19. {
  20. GUIContent buttonContent = new GUIContent(buttonText);
  21. GUIStyle buttonStyle = new GUIStyle(EditorStyles.miniButton);
  22. buttonStyle.stretchWidth = false;
  23. var width = MeasureMaxWidth.ForTexts(buttonStyle, buttonText);
  24. Rect rt = GUILayoutUtility.GetRect(
  25. buttonContent,
  26. buttonStyle,
  27. GUILayout.MinWidth(width),
  28. GUILayout.MaxWidth(width));
  29. return GUI.Button(rt, buttonText, buttonStyle);
  30. }
  31. }
  32. }