# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1298490085 0 # Node ID 27eb39d2577ba2d5c056f83e89c4cdcbc557d979 # Parent 80e253df49fd09d66777e6a5d6c67192c82a378d Calendar and HTML functions filled in. diff -r 80e253df49fd -r 27eb39d2577b mac/dw.m --- a/mac/dw.m Wed Feb 23 18:51:15 2011 +0000 +++ b/mac/dw.m Wed Feb 23 19:41:25 2011 +0000 @@ -435,7 +435,7 @@ -(void)setUserdata:(void *)input { userdata = input; } @end -/* Subclass for a MLE type */ +/* Subclass for a Container/List type */ @interface DWContainer : NSTableView { void *userdata; @@ -449,6 +449,20 @@ -(void)setUserdata:(void *)input { userdata = input; } @end +/* Subclass for a Container/List type */ +@interface DWCalendar : NSDatePicker +{ + void *userdata; +} +-(void *)userdata; +-(void)setUserdata:(void *)input; +@end + +@implementation DWCalendar +-(void *)userdata { return userdata; } +-(void)setUserdata:(void *)input { userdata = input; } +@end + typedef struct { ULONG message; @@ -3109,8 +3123,9 @@ */ HWND API dw_calendar_new(ULONG id) { - NSLog(@"dw_calendar_new() unimplemented\n"); - return HWND_DESKTOP; + DWCalendar *calendar = [[DWCalendar alloc] init]; + /*[calendar setDatePickerMode:UIDatePickerModeDate];*/ + return calendar; } /* @@ -3121,7 +3136,14 @@ */ void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day) { - NSLog(@"dw_calendar_set_date() unimplemented\n"); + DWCalendar *calendar = handle; + NSDate *date; + char buffer[100]; + + sprintf(buffer, "%04d-%02d-%02d 00:00:00 +0600", year, month, day); + + date = [[NSDate alloc] initWithString:[ NSString stringWithUTF8String:buffer ]]; + [calendar setDateValue:date]; } /* @@ -3131,7 +3153,11 @@ */ void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day) { - NSLog(@"dw_calendar_get_date() unimplemented\n"); + DWCalendar *calendar = handle; + NSDate *date = [calendar dateValue]; + NSDateFormatter *df = [[NSDateFormatter alloc] init]; + NSString *nstr = [df stringFromDate:date]; + sscanf([ nstr UTF8String ], "%d-%d-%d", year, month, day); } /* @@ -3142,7 +3168,28 @@ */ void API dw_html_action(HWND handle, int action) { - NSLog(@"dw_html_action() unimplemented\n"); + WebView *html = handle; + switch(action) + { + case DW_HTML_GOBACK: + [html goBack]; + break; + case DW_HTML_GOFORWARD: + [html goForward]; + break; + case DW_HTML_GOHOME: + break; + case DW_HTML_SEARCH: + break; + case DW_HTML_RELOAD: + [html reload:html]; + break; + case DW_HTML_STOP: + [html stopLoading:html]; + break; + case DW_HTML_PRINT: + break; + } } /* @@ -3399,7 +3446,6 @@ id menu = menux; NSMenuItem *menuitem = (NSMenuItem *)[menu itemWithTag:itemid]; - NSLog(@"MenuItem: %x", menuitem); if(menuitem != nil) { if(state & DW_MIS_CHECKED)