summaryrefslogtreecommitdiff
path: root/ldmicro/lib/linuxUI/linuxUI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro/lib/linuxUI/linuxUI.cpp')
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp46
1 files changed, 29 insertions, 17 deletions
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index fea10b5..349408f 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -30,28 +30,18 @@ COLORREF RGB(int red, int green, int blue)
return col;
}
-void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
+int MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
{
GtkDialogFlags flags = GTK_DIALOG_DESTROY_WITH_PARENT;
GtkMessageType mType;
- GtkButtonsType mButtons;
-
- if (mFlags & MB_OK == MB_OK)
- mButtons = GTK_BUTTONS_OK;
- else if (mFlags & MB_OKCANCEL == MB_OKCANCEL)
- mButtons = GTK_BUTTONS_OK_CANCEL;
- else if (mFlags & MB_YESNO == MB_YESNO)
- mButtons = GTK_BUTTONS_YES_NO;
- else
- mButtons = GTK_BUTTONS_CLOSE;
- if (mFlags & MB_ICONERROR == MB_ICONERROR)
+ if ((mFlags & MB_ICONERROR) == MB_ICONERROR)
mType = GTK_MESSAGE_ERROR;
- else if (mFlags & MB_ICONQUESTION == MB_ICONQUESTION)
+ else if ((mFlags & MB_ICONQUESTION) == MB_ICONQUESTION)
mType = GTK_MESSAGE_QUESTION;
- else if (mFlags & MB_ICONWARNING == MB_ICONWARNING)
+ else if ((mFlags & MB_ICONWARNING) == MB_ICONWARNING)
mType = GTK_MESSAGE_WARNING;
- else if (mFlags & MB_ICONINFORMATION == MB_ICONINFORMATION)
+ else if ((mFlags & MB_ICONINFORMATION) == MB_ICONINFORMATION)
mType = GTK_MESSAGE_INFO;
else
mType = GTK_MESSAGE_OTHER;
@@ -60,13 +50,35 @@ void MessageBox(HWID pWindow, char* message, char* title, UINT mFlags)
HWID dialog = gtk_message_dialog_new (GTK_WINDOW(pWindow),
flags,
mType,
- mButtons,
+ GTK_BUTTONS_NONE,
message);
+
+ if ((mFlags & MB_OKCANCEL) == MB_OKCANCEL)
+ {
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_OK", IDOK);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_CANCEL", IDCANCEL);
+ }
+ else if ((mFlags & MB_YESNO) == MB_YESNO)
+ {
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_YES", IDYES);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_NO", IDNO);
+ }
+ else if ((mFlags & MB_YESNOCANCEL) == MB_YESNOCANCEL)
+ {
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_YES", IDYES);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_NO", IDNO);
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "_CANCEL", IDCANCEL);
+ }
+ else
+ gtk_dialog_add_button(GTK_DIALOG(dialog), "OK", IDOK);
+
gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG(dialog),
title);
gtk_message_dialog_format_secondary_markup(GTK_MESSAGE_DIALOG(dialog), message);
- gtk_dialog_run (GTK_DIALOG (dialog));
+ int result = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
+
+ return result;
}
BOOL GetSaveFileName(OPENFILENAME *ofn)