diff options
author | RSDuck <RSDuck@users.noreply.github.com> | 2019-08-23 22:16:24 +0200 |
---|---|---|
committer | RSDuck <rsduck@users.noreply.github.com> | 2020-04-26 13:05:00 +0200 |
commit | b5dda7d6e2f73941435a8e9a6b71804fad068319 (patch) | |
tree | 0cf3cda9401669a95d843ac644b541887c55a20c | |
parent | 5ea91b8a039e0735ac5cb102e2375c26c4f7a150 (diff) |
add ui confirm dialog for linux
-rw-r--r-- | src/libui_sdl/libui/unix/stddialogs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/libui_sdl/libui/unix/stddialogs.c b/src/libui_sdl/libui/unix/stddialogs.c index 3daeffa..10c598d 100644 --- a/src/libui_sdl/libui/unix/stddialogs.c +++ b/src/libui_sdl/libui/unix/stddialogs.c @@ -93,7 +93,7 @@ char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath) return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_SAVE, "_Save", filter, initpath); } -static void msgbox(GtkWindow *parent, const char *title, const char *description, GtkMessageType type, GtkButtonsType buttons) +static int msgbox(GtkWindow *parent, const char *title, const char *description, GtkMessageType type, GtkButtonsType buttons) { GtkWidget *md; @@ -101,8 +101,10 @@ static void msgbox(GtkWindow *parent, const char *title, const char *description type, buttons, "%s", title); gtk_message_dialog_format_secondary_text(GTK_MESSAGE_DIALOG(md), "%s", description); - gtk_dialog_run(GTK_DIALOG(md)); + int result = gtk_dialog_run(GTK_DIALOG(md)); gtk_widget_destroy(md); + + return result; } void uiMsgBox(uiWindow *parent, const char *title, const char *description) @@ -114,3 +116,11 @@ void uiMsgBoxError(uiWindow *parent, const char *title, const char *description) { msgbox(windowWindow(parent), title, description, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK); } + +int uiMsgBoxConfirm(uiWindow * parent, const char *title, const char *description) +{ + int result = + msgbox(windowWindow(parent), title, description, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL); + + return result == GTK_RESPONSE_OK; +}
\ No newline at end of file |