comparison mac/dw.m @ 1102:cfe7d2b6bc16

Added DW_INT_TO_POINTER/DW_UINT_TO_POINTER/DW_POINTER_TO_INT/DW_POINTER_TO_UINT macros. These are used to cast between pointer and integers without generate warnings on 64bit systems. Converted Mac source and dwtest source to use them. Not sure if limits.h is available on all target platforms, will commit fixes as necessary.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 03:09:41 +0000
parents d7eafaa054ab
children 404b639f096b
comparison
equal deleted inserted replaced
1101:d7eafaa054ab 1102:cfe7d2b6bc16
355 /* Generic selection changed event for several classes */ 355 /* Generic selection changed event for several classes */
356 case 11: 356 case 11:
357 case 14: 357 case 14:
358 { 358 {
359 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction; 359 int (* API valuechangedfunc)(HWND, int, void *) = (int (* API)(HWND, int, void *))handler->signalfunction;
360 int selected = (int)event; 360 int selected = DW_POINTER_TO_INT(event);
361 361
362 return valuechangedfunc(handler->window, selected, handler->data);; 362 return valuechangedfunc(handler->window, selected, handler->data);;
363 } 363 }
364 /* Tree class selection event */ 364 /* Tree class selection event */
365 case 12: 365 case 12:
407 } 407 }
408 /* Notebook page change event */ 408 /* Notebook page change event */
409 case 15: 409 case 15:
410 { 410 {
411 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction; 411 int (* API switchpagefunc)(HWND, unsigned long, void *) = (int (* API)(HWND, unsigned long, void *))handler->signalfunction;
412 int pageid = (int)event; 412 int pageid = DW_POINTER_TO_INT(event);
413 413
414 return switchpagefunc(handler->window, pageid, handler->data); 414 return switchpagefunc(handler->window, pageid, handler->data);
415 } 415 }
416 case 16: 416 case 16:
417 { 417 {
420 return treeexpandfunc(handler->window, (HTREEITEM)event, handler->data); 420 return treeexpandfunc(handler->window, (HTREEITEM)event, handler->data);
421 } 421 }
422 case 17: 422 case 17:
423 { 423 {
424 int (*clickcolumnfunc)(HWND, int, void *) = handler->signalfunction; 424 int (*clickcolumnfunc)(HWND, int, void *) = handler->signalfunction;
425 int column_num = (int)event; 425 int column_num = DW_POINTER_TO_INT(event);
426 426
427 return clickcolumnfunc(handler->window, column_num, handler->data); 427 return clickcolumnfunc(handler->window, column_num, handler->data);
428 } 428 }
429 } 429 }
430 } 430 }
1102 Box *box = [view box]; 1102 Box *box = [view box];
1103 NSSize size = [view frame].size; 1103 NSSize size = [view frame].size;
1104 _do_resize(box, size.width, size.height); 1104 _do_resize(box, size.width, size.height);
1105 _handle_resize_events(box); 1105 _handle_resize_events(box);
1106 } 1106 }
1107 _event_handler(self, (void *)[page pageid], 15); 1107 _event_handler(self, DW_INT_TO_POINTER([page pageid]), 15);
1108 } 1108 }
1109 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; } 1109 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
1110 @end 1110 @end
1111 1111
1112 @implementation DWNotebookPage 1112 @implementation DWNotebookPage
1285 newpos = (newpos - (double)newposi) > 0.5 ? (double)(newposi + 1) : (double)newposi; 1285 newpos = (newpos - (double)newposi) > 0.5 ? (double)(newposi + 1) : (double)newposi;
1286 if(newpos != result) 1286 if(newpos != result)
1287 { 1287 {
1288 [self setDoubleValue:(newpos/max)]; 1288 [self setDoubleValue:(newpos/max)];
1289 } 1289 }
1290 _event_handler(self, (void *)(int)newpos, 14); 1290 _event_handler(self, DW_INT_TO_POINTER((int)newpos), 14);
1291 } 1291 }
1292 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; } 1292 -(void)dealloc { UserData *root = userdata; _remove_userdata(&root, NULL, TRUE); [super dealloc]; }
1293 @end 1293 @end
1294 1294
1295 /* Subclass for a MLE type */ 1295 /* Subclass for a MLE type */
1606 -(void)selectionChanged:(id)sender 1606 -(void)selectionChanged:(id)sender
1607 { 1607 {
1608 /* Handler for container class */ 1608 /* Handler for container class */
1609 _event_handler(self, (NSEvent *)[self getRowTitle:(int)[self selectedRow]], 12); 1609 _event_handler(self, (NSEvent *)[self getRowTitle:(int)[self selectedRow]], 12);
1610 /* Handler for listbox class */ 1610 /* Handler for listbox class */
1611 _event_handler(self, (NSEvent *)(int)[self selectedRow], 11); 1611 _event_handler(self, DW_INT_TO_POINTER((int)[self selectedRow]), 11);
1612 } 1612 }
1613 -(NSMenu *)menuForEvent:(NSEvent *)event 1613 -(NSMenu *)menuForEvent:(NSEvent *)event
1614 { 1614 {
1615 int row; 1615 int row;
1616 NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil]; 1616 NSPoint where = [self convertPoint:[event locationInWindow] fromView:nil];