public NativeMessageBox.Result Show(string text, string caption, NativeMessageBox.Type messageBoxType, bool useWindowHandle = true) { switch (messageBoxType) { case NativeMessageBox.Type.YesNo: return(UnityEditor.EditorUtility.DisplayDialog(caption, text, "Yes", "No") ? NativeMessageBox.Result.Yes : NativeMessageBox.Result.No); case NativeMessageBox.Type.YesNoCancel: { int result = UnityEditor.EditorUtility.DisplayDialogComplex(caption, text, "Yes", "No", "Cancel"); switch (result) { case 0: return(NativeMessageBox.Result.Yes); case 1: return(NativeMessageBox.Result.No); case 2: return(NativeMessageBox.Result.Cancel); default: break; } } break; default: break; } throw new NotSupportedException(); }
public NativeMessageBox.Result Show(string text, string caption, NativeMessageBox.Type messageBoxType, bool useWindowHandle = true) { IntPtr messagePtr = useWindowHandle ? ChartEditor.Instance.windowHandleManager.windowPtr : IntPtr.Zero; int result = MessageBox(messagePtr, text.ToString(), caption.ToString(), (uint)messageBoxType); return((NativeMessageBox.Result)result); }
public NativeMessageBox.Result Show(string text, string caption, NativeMessageBox.Type messageBoxType, NativeWindow childWindow) { IntPtr messagePtr = IntPtr.Zero; if (childWindow != null) { NativeWindow_Windows winInterface = childWindow.GetInterface() as NativeWindow_Windows; UnityEngine.Debug.Assert(winInterface != null); messagePtr = winInterface.sdlWindowPtr; } return(NativeMessageBoxSDL.Show(text, caption, messageBoxType, messagePtr)); }
public NativeMessageBox.Result Show(string text, string caption, NativeMessageBox.Type messageBoxType, NativeWindow childWindow) { IntPtr messagePtr = IntPtr.Zero; if (childWindow != null) { NativeWindow_Windows winInterface = childWindow.GetInterface() as NativeWindow_Windows; UnityEngine.Debug.Assert(winInterface != null); messagePtr = winInterface.windowPtr; } int result = MessageBox(messagePtr, text.ToString(), caption.ToString(), (uint)messageBoxType); return((NativeMessageBox.Result)result); }
public static NativeMessageBox.Result Show(string text, string caption, NativeMessageBox.Type messageBoxType, IntPtr sdlWindowHandle) { List <SDL.SDL_MessageBoxButtonData> buttons = new List <SDL.SDL_MessageBoxButtonData>(); switch (messageBoxType) { case NativeMessageBox.Type.YesNo: { buttons.Add(NO_BUTTON); buttons.Add(YES_BUTTON); break; } case NativeMessageBox.Type.YesNoCancel: { buttons.Add(CANCEL_BUTTON); buttons.Add(NO_BUTTON); buttons.Add(YES_BUTTON); break; } default: { UnityEngine.Debug.LogError("Unabled message box type"); break; } } SDL.SDL_MessageBoxData messageBoxData = new SDL.SDL_MessageBoxData(); messageBoxData.window = sdlWindowHandle; messageBoxData.title = caption; messageBoxData.message = text; messageBoxData.buttons = buttons.ToArray(); messageBoxData.numbuttons = buttons.Count; int buttonId; if (SDL.SDL_ShowMessageBox(ref messageBoxData, out buttonId) < 0) { UnityEngine.Debug.LogError("SDL Message box error- " + SDL2.SDL.SDL_GetError()); } UnityEngine.Debug.Log("SDL message box button id = " + buttonId); return((NativeMessageBox.Result)buttonId); }
public NativeMessageBox.Result Show(string text, string caption, NativeMessageBox.Type messageBoxType, NativeWindow childWindow) { int flags = 0; switch (messageBoxType) { case NativeMessageBox.Type.YesNo: flags |= SFB_MESSAGE_BOX_YESNO; break; case NativeMessageBox.Type.YesNoCancel: flags |= SFB_MESSAGE_BOX_YESNOCANCEL; break; } int result = sfb_message_box_open(flags, caption, text); switch (result) { case SFB_MESSAGE_BOX_RESULT_OK: return(NativeMessageBox.Result.OK); case SFB_MESSAGE_BOX_RESULT_CANCEL: return(NativeMessageBox.Result.Cancel); case SFB_MESSAGE_BOX_RESULT_YES: return(NativeMessageBox.Result.Yes); case SFB_MESSAGE_BOX_RESULT_NO: return(NativeMessageBox.Result.No); case SFB_MESSAGE_BOX_RESULT_NONE: default: return(NativeMessageBox.Result.None); } }