Esempio n. 1
0
    public static bool HotkeyButton(GUIContent guiContent, NPVoxHotkey hotkey = null, bool showKey = true, bool bold = false, bool hotcontrolCheck = false, GUIStyle style = null)
    {
        Event e       = Event.current;
        bool  focusOK = EditorGUIUtility.keyboardControl == 0 && (!hotcontrolCheck || GUIUtility.hotControl == 0);

        guiContent.text = guiContent.text + (showKey && hotkey != null ? " (" + hotkey + ")" : "");
        style           = style == null ? GUI.skin.button : style;
        if (bold)
        {
            style.fontStyle = FontStyle.Bold;
        }
        if (GUILayout.Button(guiContent, style) || (focusOK && hotkey != null && hotkey.IsDown(e)))
        {
            e.Use();
            EditorWindow.focusedWindow.Repaint();
            return(true);
        }
        return(false);
    }
Esempio n. 2
0
 public static bool HotkeyButton(string label, NPVoxHotkey hotkey, bool showKey = true, bool bold = false, bool hotcontrolCheck = false) //, bool showKey = true, bool cmdRequired = false, bool bold = false, bool shiftRequired = false, bool altRequired = false)
 {
     return(HotkeyButton(new GUIContent(label), hotkey, showKey, bold, hotcontrolCheck));
 }