Mercurial > dwindows
comparison os2/dw.c @ 399:a7a561103eac
Add flags parameter to dw_messagebox() to specify buttons and icon displayed.
Remove dw_yesno(); now superfluous.
author | mhessling@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 09 May 2003 12:54:51 +0000 |
parents | d8176c73a081 |
children | 720e61df8cf6 |
comparison
equal
deleted
inserted
replaced
398:255a31a3a1f5 | 399:a7a561103eac |
---|---|
3274 | 3274 |
3275 /* | 3275 /* |
3276 * Displays a Message Box with given text and title.. | 3276 * Displays a Message Box with given text and title.. |
3277 * Parameters: | 3277 * Parameters: |
3278 * title: The title of the message box. | 3278 * title: The title of the message box. |
3279 * flags: flags to indicate buttons and icon | |
3279 * format: printf style format string. | 3280 * format: printf style format string. |
3280 * ...: Additional variables for use in the format. | 3281 * ...: Additional variables for use in the format. |
3281 */ | 3282 */ |
3282 int API dw_messagebox(char *title, char *format, ...) | 3283 int API dw_messagebox(char *title, int flags, char *format, ...) |
3283 { | 3284 { |
3284 va_list args; | 3285 va_list args; |
3285 char outbuf[1024]; | 3286 char outbuf[1024]; |
3287 int rc; | |
3286 | 3288 |
3287 va_start(args, format); | 3289 va_start(args, format); |
3288 vsprintf(outbuf, format, args); | 3290 vsprintf(outbuf, format, args); |
3289 va_end(args); | 3291 va_end(args); |
3290 | 3292 |
3291 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, MB_OK | MB_INFORMATION | MB_MOVEABLE); | 3293 rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, outbuf, title, 0, flags | MB_MOVEABLE | MB_SYSTEMMODAL); |
3292 | 3294 if(rc == MBID_OK) |
3293 return strlen(outbuf); | 3295 return DW_MB_RETURN_OK; |
3294 } | 3296 else if(rc == MBID_YES) |
3295 | 3297 return DW_MB_RETURN_YES; |
3296 /* | 3298 else if(rc == MBID_NO) |
3297 * Displays a Message Box with given text and title.. | 3299 return DW_MB_RETURN_NO; |
3298 * Parameters: | 3300 else if(rc == MBID_CANCEL) |
3299 * title: The title of the message box. | 3301 return DW_MB_RETURN_CANCEL; |
3300 * text: The text to display in the box. | 3302 else return 0; |
3301 * Returns: | |
3302 * True if YES False of NO. | |
3303 */ | |
3304 int API dw_yesno(char *title, char *text) | |
3305 { | |
3306 if(WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, title, 0, MB_YESNO | MB_INFORMATION | MB_MOVEABLE | MB_SYSTEMMODAL)==MBID_YES) | |
3307 return TRUE; | |
3308 return FALSE; | |
3309 } | 3303 } |
3310 | 3304 |
3311 /* | 3305 /* |
3312 * Makes the window topmost. | 3306 * Makes the window topmost. |
3313 * Parameters: | 3307 * Parameters: |