comparison os2/dw.c @ 1354:1f22addc2722

Changed the behavior of dw_html_new() to return NULL on failure like the documentation indicates... Instead of creating a text widget with an error message. This error message is now sent to the console. This allows programs to be able to gracefully handle the failure to create the HTML widget. Also updated the dwtest program to create a text widget in a similar fashion on failure. Also updated the dw_calendar_* comments to no longer be unsupported on OS/2.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Fri, 18 Nov 2011 13:34:36 +0000
parents 19aa1af6855e
children 46c3bcd25b53
comparison
equal deleted inserted replaced
1353:f4ad4ba39b61 1354:1f22addc2722
10731 * id: An ID to be used with dw_window_from_id() or 0L. 10731 * id: An ID to be used with dw_window_from_id() or 0L.
10732 */ 10732 */
10733 HWND API dw_html_new(unsigned long id) 10733 HWND API dw_html_new(unsigned long id)
10734 { 10734 {
10735 id = id; 10735 id = id;
10736 return dw_box_new(DW_HORZ, 0); 10736 dw_debug("HTML widget not available; OS/2 currently does not support it.");
10737 return 0;
10737 } 10738 }
10738 10739
10739 typedef struct _dwprint 10740 typedef struct _dwprint
10740 { 10741 {
10741 HDC hdc; 10742 HDC hdc;
11469 tmp = tmp->next; 11470 tmp = tmp->next;
11470 } 11471 }
11471 } 11472 }
11472 } 11473 }
11473 11474
11474 11475 /*
11475 11476 * Create a new calendar window (widget) to be packed.
11476 /* 11477 * Parameters:
11477 * Create a new static text window (widget) to be packed.
11478 * Not available under OS/2, eCS
11479 * Parameters:
11480 * text: The text to be display by the static text widget.
11481 * id: An ID to be used with dw_window_from_id() or 0L. 11478 * id: An ID to be used with dw_window_from_id() or 0L.
11479 * Returns:
11480 * Handle to the created calendar or NULL on error.
11482 */ 11481 */
11483 HWND API dw_calendar_new(ULONG id) 11482 HWND API dw_calendar_new(ULONG id)
11484 { 11483 {
11485 WindowData *blah = calloc(sizeof(WindowData), 1); 11484 WindowData *blah = calloc(sizeof(WindowData), 1);
11486 DATETIME dt; 11485 DATETIME dt;
11501 dw_calendar_set_date(tmp, dt.year, dt.month, dt.day); 11500 dw_calendar_set_date(tmp, dt.year, dt.month, dt.day);
11502 return tmp; 11501 return tmp;
11503 } 11502 }
11504 11503
11505 /* 11504 /*
11506 * The following are stubs 11505 * Sets the current date of a calendar.
11506 * Parameters:
11507 * handle: The handle to the calendar returned by dw_calendar_new().
11508 * year, month, day: To set the calendar to display.
11507 */ 11509 */
11508 void API dw_calendar_set_date( HWND window, unsigned int year, unsigned int month, unsigned int day ) 11510 void API dw_calendar_set_date( HWND window, unsigned int year, unsigned int month, unsigned int day )
11509 { 11511 {
11510 /* Need to be 0 based */ 11512 /* Need to be 0 based */
11511 if(year > 0) 11513 if(year > 0)
11520 dw_window_set_data(window, "_dw_day", DW_INT_TO_POINTER(day)); 11522 dw_window_set_data(window, "_dw_day", DW_INT_TO_POINTER(day));
11521 /* Make it redraw */ 11523 /* Make it redraw */
11522 WinPostMsg(window, WM_PAINT, 0, 0); 11524 WinPostMsg(window, WM_PAINT, 0, 0);
11523 } 11525 }
11524 11526
11527 /*
11528 * Gets the year, month and day set in the calendar widget.
11529 * Parameters:
11530 * handle: The handle to the calendar returned by dw_calendar_new().
11531 * year: Variable to store the year or NULL.
11532 * month: Variable to store the month or NULL.
11533 * day: Variable to store the day or NULL.
11534 */
11525 void API dw_calendar_get_date( HWND window, unsigned int *year, unsigned int *month, unsigned int *day ) 11535 void API dw_calendar_get_date( HWND window, unsigned int *year, unsigned int *month, unsigned int *day )
11526 { 11536 {
11527 if(year) 11537 if(year)
11528 *year = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_year")) + 1; 11538 *year = DW_POINTER_TO_UINT(dw_window_get_data(window, "_dw_year")) + 1;
11529 if(month) 11539 if(month)