Mercurial > dwindows
comparison win/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 | 23a603b136bd |
children | a3a299455c67 |
comparison
equal
deleted
inserted
replaced
398:255a31a3a1f5 | 399:a7a561103eac |
---|---|
3044 DW_HWND_OBJECT = CreateWindow(ObjectClassName, "", 0, 0, 0, | 3044 DW_HWND_OBJECT = CreateWindow(ObjectClassName, "", 0, 0, 0, |
3045 0, 0, HWND_DESKTOP, NULL, DWInstance, NULL); | 3045 0, 0, HWND_DESKTOP, NULL, DWInstance, NULL); |
3046 | 3046 |
3047 if(!DW_HWND_OBJECT) | 3047 if(!DW_HWND_OBJECT) |
3048 { | 3048 { |
3049 dw_messagebox("Dynamic Windows", "Could not initialize the object window. error code %d", GetLastError()); | 3049 dw_messagebox("Dynamic Windows", DW_MB_OK|DW_MB_ERROR, "Could not initialize the object window. error code %d", GetLastError()); |
3050 exit(1); | 3050 exit(1); |
3051 } | 3051 } |
3052 | 3052 |
3053 /* We need the version to check capability like up-down controls */ | 3053 /* We need the version to check capability like up-down controls */ |
3054 dwVersion = GetVersion(); | 3054 dwVersion = GetVersion(); |
3201 * Parameters: | 3201 * Parameters: |
3202 * title: The title of the message box. | 3202 * title: The title of the message box. |
3203 * format: printf style format string. | 3203 * format: printf style format string. |
3204 * ...: Additional variables for use in the format. | 3204 * ...: Additional variables for use in the format. |
3205 */ | 3205 */ |
3206 int API dw_messagebox(char *title, char *format, ...) | 3206 int API dw_messagebox(char *title, int flags, char *format, ...) |
3207 { | 3207 { |
3208 va_list args; | 3208 va_list args; |
3209 char outbuf[256]; | 3209 char outbuf[256]; |
3210 int rc; | |
3210 | 3211 |
3211 va_start(args, format); | 3212 va_start(args, format); |
3212 vsprintf(outbuf, format, args); | 3213 vsprintf(outbuf, format, args); |
3213 va_end(args); | 3214 va_end(args); |
3214 | 3215 |
3215 MessageBox(HWND_DESKTOP, outbuf, title, MB_OK); | 3216 rc = MessageBox(HWND_DESKTOP, outbuf, title, flags); |
3216 | 3217 if(rc == IDOK) |
3217 return strlen(outbuf); | 3218 return DW_MB_RETURN_OK; |
3218 } | 3219 else if(rc == IDYES) |
3219 | 3220 return DW_MB_RETURN_YES; |
3220 /* | 3221 else if(rc == IDNO) |
3221 * Displays a Message Box with given text and title.. | 3222 return DW_MB_RETURN_NO; |
3222 * Parameters: | 3223 else if(rc == IDCANCEL) |
3223 * title: The title of the message box. | 3224 return DW_MB_RETURN_CANCEL; |
3224 * text: The text to display in the box. | 3225 else return 0; |
3225 * Returns: | |
3226 * True if YES False of NO. | |
3227 */ | |
3228 int API dw_yesno(char *title, char *text) | |
3229 { | |
3230 if(MessageBox(HWND_DESKTOP, text, title, MB_YESNO) == IDYES) | |
3231 return TRUE; | |
3232 return FALSE; | |
3233 } | 3226 } |
3234 | 3227 |
3235 /* | 3228 /* |
3236 * Minimizes or Iconifies a top-level window. | 3229 * Minimizes or Iconifies a top-level window. |
3237 * Parameters: | 3230 * Parameters: |
3533 * handle: Handle to widget for which to change. | 3526 * handle: Handle to widget for which to change. |
3534 * cursortype: ID of the pointer you want. | 3527 * cursortype: ID of the pointer you want. |
3535 */ | 3528 */ |
3536 void API dw_window_pointer(HWND handle, int pointertype) | 3529 void API dw_window_pointer(HWND handle, int pointertype) |
3537 { | 3530 { |
3531 /* | |
3532 if(pointertype == DW_POINTER_ARROW) | |
3533 SetClassLong( handle, GCL_HCURSOR, LoadCursor( NULL, IDC_ARROW)); | |
3534 else if(pointertype == DW_POINTER_CLOCK) | |
3535 SetClassLong( handle, GCL_HCURSOR, LoadCursor( NULL, IDC_WAIT)); | |
3536 else | |
3537 */ | |
3538 SetCursor(pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)pointertype); | 3538 SetCursor(pointertype < 65536 ? LoadCursor(NULL, MAKEINTRESOURCE(pointertype)) : (HCURSOR)pointertype); |
3539 } | 3539 } |
3540 | 3540 |
3541 /* | 3541 /* |
3542 * Create a new Window Frame. | 3542 * Create a new Window Frame. |