changeset 729:6712e4211522

Switched to graphical calendar control style... and fixed date querying code. There is probably a better way to do this but it works for now.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 15 Mar 2011 00:45:27 +0000
parents 55f22b39ab57
children d3fb3613726a
files mac/dw.m
diffstat 1 files changed, 17 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mac/dw.m	Mon Mar 14 22:25:01 2011 +0000
+++ b/mac/dw.m	Tue Mar 15 00:45:27 2011 +0000
@@ -5031,10 +5031,12 @@
  */
 HWND API dw_calendar_new(ULONG cid)
 {
-	DWCalendar *calendar = [[DWCalendar alloc] init];
-	/*[calendar setDatePickerMode:UIDatePickerModeDate];*/
+    DWCalendar *calendar = [[DWCalendar alloc] init];
+    [calendar setDatePickerMode:NSSingleDateMode];
+    [calendar setDatePickerStyle:NSClockAndCalendarDatePickerStyle];
+    [calendar setDatePickerElements:NSYearMonthDayDatePickerElementFlag];
     [calendar setTag:cid];
-	return calendar;
+    return calendar;
 }
 
 /*
@@ -5045,14 +5047,14 @@
  */
 void dw_calendar_set_date(HWND handle, unsigned int year, unsigned int month, unsigned int day)
 {
-	DWCalendar *calendar = handle;
-	NSDate *date;
-	char buffer[100];
+    DWCalendar *calendar = handle;
+    NSDate *date;
+    char buffer[100];
 	
-	sprintf(buffer, "%04d-%02d-%02d 00:00:00 +0600", year, month, day);
+    sprintf(buffer, "%04d-%02d-%02d 00:00:00 +0600", year, month, day);
 	
-	date = [[NSDate alloc] initWithString:[ NSString stringWithUTF8String:buffer ]];
-	[calendar setDateValue:date];
+    date = [[NSDate alloc] initWithString:[ NSString stringWithUTF8String:buffer ]];
+    [calendar setDateValue:date];
     [date release];
 }
 
@@ -5063,11 +5065,12 @@
  */
 void dw_calendar_get_date(HWND handle, unsigned int *year, unsigned int *month, unsigned int *day)
 {
-	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);
+    DWCalendar *calendar = handle;
+    NSDate *date = [calendar dateValue];
+    NSDateFormatter *df = [[NSDateFormatter alloc] init];
+    [df setDateStyle:NSDateFormatterShortStyle];
+    NSString *nstr = [df stringFromDate:date];
+    sscanf([ nstr UTF8String ], "%d/%d/%d", month, day, year);
     [df release];
 }