| 2039 | |
| 2040 | |
| 2041 | static int messageBoxWinGui( |
| 2042 | char const * aTitle, /* NULL or "" */ |
| 2043 | char const * aMessage, /* NULL or "" may contain \n and \t */ |
| 2044 | char const * aDialogType, /* "ok" "okcancel" "yesno" "yesnocancel" */ |
| 2045 | char const * aIconType, /* "info" "warning" "error" "question" */ |
| 2046 | int aDefaultButton) /* 0 for cancel/no , 1 for ok/yes , 2 for no in yesnocancel */ |
| 2047 | { |
| 2048 | int lIntRetVal; |
| 2049 | wchar_t lTitle[128] = L""; |
| 2050 | wchar_t * lMessage = NULL; |
| 2051 | wchar_t lDialogType[16] = L""; |
| 2052 | wchar_t lIconType[16] = L""; |
| 2053 | wchar_t * lTmpWChar; |
| 2054 | |
| 2055 | if (aTitle) |
| 2056 | { |
| 2057 | if (tinyfd_winUtf8) lTmpWChar = tinyfd_utf8to16(aTitle); |
| 2058 | else lTmpWChar = tinyfd_mbcsTo16(aTitle); |
| 2059 | wcscpy(lTitle, lTmpWChar); |
| 2060 | } |
| 2061 | if (aMessage) |
| 2062 | { |
| 2063 | if (tinyfd_winUtf8) lTmpWChar = tinyfd_utf8to16(aMessage); |
| 2064 | else lTmpWChar = tinyfd_mbcsTo16(aMessage); |
| 2065 | lMessage = (wchar_t *) malloc((wcslen(lTmpWChar) + 1)* sizeof(wchar_t)); |
| 2066 | if (lMessage) wcscpy(lMessage, lTmpWChar); |
| 2067 | } |
| 2068 | if (aDialogType) |
| 2069 | { |
| 2070 | if (tinyfd_winUtf8) lTmpWChar = tinyfd_utf8to16(aDialogType); |
| 2071 | else lTmpWChar = tinyfd_mbcsTo16(aDialogType); |
| 2072 | wcscpy(lDialogType, lTmpWChar); |
| 2073 | } |
| 2074 | if (aIconType) |
| 2075 | { |
| 2076 | if (tinyfd_winUtf8) lTmpWChar = tinyfd_utf8to16(aIconType); |
| 2077 | else lTmpWChar = tinyfd_mbcsTo16(aIconType); |
| 2078 | wcscpy(lIconType, lTmpWChar); |
| 2079 | } |
| 2080 | |
| 2081 | lIntRetVal = tinyfd_messageBoxW(lTitle, lMessage, lDialogType, lIconType, aDefaultButton); |
| 2082 | |
| 2083 | free(lMessage); |
| 2084 | |
| 2085 | return lIntRetVal; |
| 2086 | } |
| 2087 | |
| 2088 | |
| 2089 | static int notifyWinGui( |
no test coverage detected