comparison ios/dw.m @ 2622:07c504257e42

iOS: Switch to using internal event message constants.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 26 Jul 2021 00:25:26 +0000
parents a256caa5034c
children 401a3b9f21ba
comparison
equal deleted inserted replaced
2621:e63c1373c010 2622:07c504257e42
311 311
312 /* List of signals */ 312 /* List of signals */
313 #define SIGNALMAX 19 313 #define SIGNALMAX 19
314 314
315 static DWSignalList DWSignalTranslate[SIGNALMAX] = { 315 static DWSignalList DWSignalTranslate[SIGNALMAX] = {
316 { 1, DW_SIGNAL_CONFIGURE }, 316 { _DW_EVENT_CONFIGURE, DW_SIGNAL_CONFIGURE },
317 { 2, DW_SIGNAL_KEY_PRESS }, 317 { _DW_EVENT_KEY_PRESS, DW_SIGNAL_KEY_PRESS },
318 { 3, DW_SIGNAL_BUTTON_PRESS }, 318 { _DW_EVENT_BUTTON_PRESS, DW_SIGNAL_BUTTON_PRESS },
319 { 4, DW_SIGNAL_BUTTON_RELEASE }, 319 { _DW_EVENT_BUTTON_RELEASE, DW_SIGNAL_BUTTON_RELEASE },
320 { 5, DW_SIGNAL_MOTION_NOTIFY }, 320 { _DW_EVENT_MOTION_NOTIFY, DW_SIGNAL_MOTION_NOTIFY },
321 { 6, DW_SIGNAL_DELETE }, 321 { _DW_EVENT_DELETE, DW_SIGNAL_DELETE },
322 { 7, DW_SIGNAL_EXPOSE }, 322 { _DW_EVENT_EXPOSE, DW_SIGNAL_EXPOSE },
323 { 8, DW_SIGNAL_CLICKED }, 323 { _DW_EVENT_CLICKED, DW_SIGNAL_CLICKED },
324 { 9, DW_SIGNAL_ITEM_ENTER }, 324 { _DW_EVENT_ITEM_ENTER, DW_SIGNAL_ITEM_ENTER },
325 { 10, DW_SIGNAL_ITEM_CONTEXT }, 325 { _DW_EVENT_ITEM_CONTEXT, DW_SIGNAL_ITEM_CONTEXT },
326 { 11, DW_SIGNAL_LIST_SELECT }, 326 { _DW_EVENT_LIST_SELECT, DW_SIGNAL_LIST_SELECT },
327 { 12, DW_SIGNAL_ITEM_SELECT }, 327 { _DW_EVENT_ITEM_SELECT, DW_SIGNAL_ITEM_SELECT },
328 { 13, DW_SIGNAL_SET_FOCUS }, 328 { _DW_EVENT_SET_FOCUS, DW_SIGNAL_SET_FOCUS },
329 { 14, DW_SIGNAL_VALUE_CHANGED }, 329 { _DW_EVENT_VALUE_CHANGED, DW_SIGNAL_VALUE_CHANGED },
330 { 15, DW_SIGNAL_SWITCH_PAGE }, 330 { _DW_EVENT_SWITCH_PAGE, DW_SIGNAL_SWITCH_PAGE },
331 { 16, DW_SIGNAL_TREE_EXPAND }, 331 { _DW_EVENT_TREE_EXPAND, DW_SIGNAL_TREE_EXPAND },
332 { 17, DW_SIGNAL_COLUMN_CLICK }, 332 { _DW_EVENT_COLUMN_CLICK, DW_SIGNAL_COLUMN_CLICK },
333 { 18, DW_SIGNAL_HTML_RESULT }, 333 { _DW_EVENT_HTML_RESULT, DW_SIGNAL_HTML_RESULT },
334 { 19, DW_SIGNAL_HTML_CHANGED } 334 { _DW_EVENT_HTML_CHANGED, DW_SIGNAL_HTML_CHANGED }
335 }; 335 };
336 336
337 int _dw_event_handler1(id object, id event, int message) 337 int _dw_event_handler1(id object, id event, int message)
338 { 338 {
339 SignalHandler *handler = _dw_get_handler(object, message); 339 SignalHandler *handler = _dw_get_handler(object, message);
599 @interface DWTimerHandler : NSObject { } 599 @interface DWTimerHandler : NSObject { }
600 -(void)runTimer:(id)sender; 600 -(void)runTimer:(id)sender;
601 @end 601 @end
602 602
603 @implementation DWTimerHandler 603 @implementation DWTimerHandler
604 -(void)runTimer:(id)sender { _dw_event_handler(sender, nil, 0); } 604 -(void)runTimer:(id)sender { _dw_event_handler(sender, nil, _DW_EVENT_TIMER); }
605 @end 605 @end
606 606
607 @interface DWAppDel : UIResponder <UIApplicationDelegate> { } 607 @interface DWAppDel : UIResponder <UIApplicationDelegate> { }
608 -(void)applicationWillTerminate:(UIApplication *)application; 608 -(void)applicationWillTerminate:(UIApplication *)application;
609 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions; 609 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions;
611 611
612 @implementation DWAppDel 612 @implementation DWAppDel
613 -(void)applicationWillTerminate:(UIApplication *)application 613 -(void)applicationWillTerminate:(UIApplication *)application
614 { 614 {
615 /* On iOS we can't prevent temrination, but send the notificatoin anyway */ 615 /* On iOS we can't prevent temrination, but send the notificatoin anyway */
616 _dw_event_handler(application, nil, 6); 616 _dw_event_handler(application, nil, _DW_EVENT_DELETE);
617 } 617 }
618 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions 618 -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary<UIApplicationLaunchOptionsKey, id> *)launchOptions
619 { 619 {
620 return true; 620 return true;
621 } 621 }
745 [super dealloc]; 745 [super dealloc];
746 } 746 }
747 -(Box *)box { return box; } 747 -(Box *)box { return box; }
748 -(void *)userdata { return userdata; } 748 -(void *)userdata { return userdata; }
749 -(void)setUserdata:(void *)input { userdata = input; } 749 -(void)setUserdata:(void *)input { userdata = input; }
750 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)){ _dw_event_handler(self, key, 2); } 750 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)){ _dw_event_handler(self, key, _DW_EVENT_KEY_PRESS); }
751 @end 751 @end
752 752
753 @interface DWWindow : UIWindow 753 @interface DWWindow : UIWindow
754 { 754 {
755 DWMenu *windowmenu, *popupmenu; 755 DWMenu *windowmenu, *popupmenu;
773 -(void)sendEvent:(UIEvent *)theEvent 773 -(void)sendEvent:(UIEvent *)theEvent
774 { 774 {
775 int rcode = -1; 775 int rcode = -1;
776 if([theEvent type] == UIEventTypePresses) 776 if([theEvent type] == UIEventTypePresses)
777 { 777 {
778 rcode = _dw_event_handler(self, theEvent, 2); 778 rcode = _dw_event_handler(self, theEvent, _DW_EVENT_KEY_PRESS);
779 } 779 }
780 if ( rcode != TRUE ) 780 if ( rcode != TRUE )
781 [super sendEvent:theEvent]; 781 [super sendEvent:theEvent];
782 } 782 }
783 -(void)keyDown:(UIKey *)key { } 783 -(void)keyDown:(UIKey *)key { }
870 if(![_DWDirtyDrawables containsObject:self]) 870 if(![_DWDirtyDrawables containsObject:self])
871 [_DWDirtyDrawables addObject:self]; 871 [_DWDirtyDrawables addObject:self];
872 return cachedImage; 872 return cachedImage;
873 } 873 }
874 -(void)drawRect:(CGRect)rect { 874 -(void)drawRect:(CGRect)rect {
875 _dw_event_handler(self, nil, 7); 875 _dw_event_handler(self, nil, _DW_EVENT_EXPOSE);
876 if(cachedImage) 876 if(cachedImage)
877 { 877 {
878 [[cachedImage image] drawInRect:self.bounds]; 878 [[cachedImage image] drawInRect:self.bounds];
879 [_DWDirtyDrawables removeObject:self]; 879 [_DWDirtyDrawables removeObject:self];
880 [self setNeedsDisplay]; 880 [self setNeedsDisplay];
881 } 881 }
882 } 882 }
883 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)){ _dw_event_handler(self, key, 2); } 883 -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)){ _dw_event_handler(self, key, _DW_EVENT_KEY_PRESS); }
884 -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 884 -(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
885 { 885 {
886 _dw_event_handler(self, event, 3); 886 _dw_event_handler(self, event, _DW_EVENT_BUTTON_PRESS);
887 [super touchesBegan:touches withEvent:event]; 887 [super touchesBegan:touches withEvent:event];
888 } 888 }
889 -(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 889 -(void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
890 { 890 {
891 _dw_event_handler(self, event, 4); 891 _dw_event_handler(self, event, _DW_EVENT_BUTTON_RELEASE);
892 [super touchesEnded:touches withEvent:event]; 892 [super touchesEnded:touches withEvent:event];
893 } 893 }
894 -(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event 894 -(void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
895 { 895 {
896 _dw_event_handler(self, event, 5); 896 _dw_event_handler(self, event, _DW_EVENT_MOTION_NOTIFY);
897 [super touchesMoved:touches withEvent:event]; 897 [super touchesMoved:touches withEvent:event];
898 } 898 }
899 -(UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location 899 -(UIContextMenuConfiguration *)contextMenuInteraction:(UIContextMenuInteraction *)interaction configurationForMenuAtLocation:(CGPoint)location
900 { 900 {
901 DWWindow *window = (DWWindow *)[self window]; 901 DWWindow *window = (DWWindow *)[self window];
902 UIContextMenuConfiguration *config = nil; 902 UIContextMenuConfiguration *config = nil;
903 903
904 _dw_event_point = location; 904 _dw_event_point = location;
905 _dw_event_handler(self, nil, 3); 905 _dw_event_handler(self, nil, _DW_EVENT_BUTTON_PRESS);
906 906
907 if(window && [window popupMenu]) 907 if(window && [window popupMenu])
908 { 908 {
909 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; 909 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain];
910 config = [UIContextMenuConfiguration configurationWithIdentifier:nil 910 config = [UIContextMenuConfiguration configurationWithIdentifier:nil
1037 } 1037 }
1038 -(UIWindow *)hiddenWindow { return hiddenWindow; }; 1038 -(UIWindow *)hiddenWindow { return hiddenWindow; };
1039 -(void)uselessThread:(id)sender { /* Thread only to initialize threading */ } 1039 -(void)uselessThread:(id)sender { /* Thread only to initialize threading */ }
1040 -(void)menuHandler:(id)param 1040 -(void)menuHandler:(id)param
1041 { 1041 {
1042 _dw_event_handler(param, nil, 8); 1042 _dw_event_handler(param, nil, _DW_EVENT_CLICKED);
1043 } 1043 }
1044 -(void)callBack:(NSPointerArray *)params 1044 -(void)callBack:(NSPointerArray *)params
1045 { 1045 {
1046 void (*mycallback)(NSPointerArray *) = [params pointerAtIndex:0]; 1046 void (*mycallback)(NSPointerArray *) = [params pointerAtIndex:0];
1047 if(mycallback) 1047 if(mycallback)
1316 -(void *)userdata { return userdata; } 1316 -(void *)userdata { return userdata; }
1317 -(void)setUserdata:(void *)input { userdata = input; } 1317 -(void)setUserdata:(void *)input { userdata = input; }
1318 -(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation 1318 -(void)webView:(WKWebView *)webView didCommitNavigation:(WKNavigation *)navigation
1319 { 1319 {
1320 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_STARTED), [[self URL] absoluteString] }; 1320 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_STARTED), [[self URL] absoluteString] };
1321 _dw_event_handler(self, (id)params, 19); 1321 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED);
1322 } 1322 }
1323 -(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation 1323 -(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
1324 { 1324 {
1325 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_COMPLETE), [[self URL] absoluteString] }; 1325 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_COMPLETE), [[self URL] absoluteString] };
1326 _dw_event_handler(self, (id)params, 19); 1326 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED);
1327 } 1327 }
1328 -(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation 1328 -(void)webView:(WKWebView *)webView didStartProvisionalNavigation:(WKNavigation *)navigation
1329 { 1329 {
1330 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_LOADING), [[self URL] absoluteString] }; 1330 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_LOADING), [[self URL] absoluteString] };
1331 _dw_event_handler(self, (id)params, 19); 1331 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED);
1332 } 1332 }
1333 -(void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation 1333 -(void)webView:(WKWebView *)webView didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation
1334 { 1334 {
1335 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_REDIRECT), [[self URL] absoluteString] }; 1335 void *params[2] = { DW_INT_TO_POINTER(DW_HTML_CHANGE_REDIRECT), [[self URL] absoluteString] };
1336 _dw_event_handler(self, (id)params, 19); 1336 _dw_event_handler(self, (id)params, _DW_EVENT_HTML_CHANGED);
1337 } 1337 }
1338 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } 1338 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; }
1339 @end 1339 @end
1340 1340
1341 /* Subclass for a top-level window */ 1341 /* Subclass for a top-level window */
1350 @end 1350 @end
1351 1351
1352 @implementation DWView 1352 @implementation DWView
1353 -(BOOL)windowShouldClose:(id)sender 1353 -(BOOL)windowShouldClose:(id)sender
1354 { 1354 {
1355 if(_dw_event_handler(sender, nil, 6) > 0) 1355 if(_dw_event_handler(sender, nil, _DW_EVENT_DELETE) > 0)
1356 return NO; 1356 return NO;
1357 return YES; 1357 return YES;
1358 } 1358 }
1359 -(void)willMoveToSuperview:(UIView *)newSuperview 1359 -(void)willMoveToSuperview:(UIView *)newSuperview
1360 { 1360 {
1370 -(void)windowResized:(CGSize)size; 1370 -(void)windowResized:(CGSize)size;
1371 { 1371 {
1372 if(oldsize.width != size.width || oldsize.height != size.height) 1372 if(oldsize.width != size.width || oldsize.height != size.height)
1373 { 1373 {
1374 _dw_do_resize(box, size.width, size.height); 1374 _dw_do_resize(box, size.width, size.height);
1375 _dw_event_handler([self window], nil, 1); 1375 _dw_event_handler([self window], nil, _DW_EVENT_CONFIGURE);
1376 oldsize.width = size.width; 1376 oldsize.width = size.width;
1377 oldsize.height = size.height; 1377 oldsize.height = size.height;
1378 _dw_handle_resize_events(box); 1378 _dw_handle_resize_events(box);
1379 } 1379 }
1380 } 1380 }
1389 } 1389 }
1390 1390
1391 } 1391 }
1392 -(void)windowDidBecomeMain:(id)sender 1392 -(void)windowDidBecomeMain:(id)sender
1393 { 1393 {
1394 _dw_event_handler([self window], nil, 13); 1394 _dw_event_handler([self window], nil, _DW_EVENT_SET_FOCUS);
1395 } 1395 }
1396 -(void)menuHandler:(id)sender 1396 -(void)menuHandler:(id)sender
1397 { 1397 {
1398 [DWObj menuHandler:sender]; 1398 [DWObj menuHandler:sender];
1399 } 1399 }
1492 if(type == _DW_BUTTON_TYPE_CHECK) 1492 if(type == _DW_BUTTON_TYPE_CHECK)
1493 [self setState:(state ? FALSE : TRUE)]; 1493 [self setState:(state ? FALSE : TRUE)];
1494 else if(type == _DW_BUTTON_TYPE_RADIO) 1494 else if(type == _DW_BUTTON_TYPE_RADIO)
1495 [self setState:TRUE]; 1495 [self setState:TRUE];
1496 1496
1497 _dw_event_handler(self, nil, 8); 1497 _dw_event_handler(self, nil, _DW_EVENT_CLICKED);
1498 1498
1499 /* If it is a radio button, uncheck all the other radio buttons in the box */ 1499 /* If it is a radio button, uncheck all the other radio buttons in the box */
1500 if(type == _DW_BUTTON_TYPE_RADIO) 1500 if(type == _DW_BUTTON_TYPE_RADIO)
1501 { 1501 {
1502 DWBox *viewbox = [self parent]; 1502 DWBox *viewbox = [self parent];
1942 [page setHidden:NO]; 1942 [page setHidden:NO];
1943 visible = page; 1943 visible = page;
1944 _dw_do_resize(box, frame.size.width, frame.size.height); 1944 _dw_do_resize(box, frame.size.width, frame.size.height);
1945 _dw_handle_resize_events(box); 1945 _dw_handle_resize_events(box);
1946 } 1946 }
1947 _dw_event_handler(self, DW_INT_TO_POINTER(intpageid), 15); 1947 _dw_event_handler(self, DW_INT_TO_POINTER(intpageid), _DW_EVENT_SWITCH_PAGE);
1948 } 1948 }
1949 } 1949 }
1950 -(void)dealloc { 1950 -(void)dealloc {
1951 UserData *root = userdata; 1951 UserData *root = userdata;
1952 _dw_remove_userdata(&root, NULL, TRUE); 1952 _dw_remove_userdata(&root, NULL, TRUE);
2028 vertical = vert; 2028 vertical = vert;
2029 } 2029 }
2030 -(BOOL)vertical { return vertical; } 2030 -(BOOL)vertical { return vertical; }
2031 -(void *)userdata { return userdata; } 2031 -(void *)userdata { return userdata; }
2032 -(void)setUserdata:(void *)input { userdata = input; } 2032 -(void)setUserdata:(void *)input { userdata = input; }
2033 -(void)sliderChanged:(id)sender { int intVal = (int)[self value]; _dw_event_handler(self, DW_INT_TO_POINTER(intVal), 14); } 2033 -(void)sliderChanged:(id)sender { int intVal = (int)[self value]; _dw_event_handler(self, DW_INT_TO_POINTER(intVal), _DW_EVENT_VALUE_CHANGED); }
2034 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } 2034 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; }
2035 @end 2035 @end
2036 2036
2037 /* Subclass for a MLE type */ 2037 /* Subclass for a MLE type */
2038 @interface DWMLE : UITextView 2038 @interface DWMLE : UITextView
2166 params[1] = [self getRowData:(int)indexPath.row]; 2166 params[1] = [self getRowData:(int)indexPath.row];
2167 params[2] = DW_INT_TO_POINTER((int)point.x); 2167 params[2] = DW_INT_TO_POINTER((int)point.x);
2168 params[3] = DW_INT_TO_POINTER((int)point.y); 2168 params[3] = DW_INT_TO_POINTER((int)point.y);
2169 2169
2170 _dw_event_point = point; 2170 _dw_event_point = point;
2171 _dw_event_handler(self, (id)params, 10); 2171 _dw_event_handler(self, (id)params, _DW_EVENT_ITEM_CONTEXT);
2172 2172
2173 if(window && [window popupMenu]) 2173 if(window && [window popupMenu])
2174 { 2174 {
2175 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain]; 2175 __block UIMenu *popupmenu = [[[window popupMenu] menu] retain];
2176 config = [UIContextMenuConfiguration configurationWithIdentifier:nil 2176 config = [UIContextMenuConfiguration configurationWithIdentifier:nil
2436 { 2436 {
2437 NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate]; 2437 NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
2438 2438
2439 /* Handler for container class... check for double tap */ 2439 /* Handler for container class... check for double tap */
2440 if(lastClickRow == indexPath.row && now - lastClick < 0.3) 2440 if(lastClickRow == indexPath.row && now - lastClick < 0.3)
2441 _dw_event_handler(self, (id)params, 9); 2441 _dw_event_handler(self, (id)params, _DW_EVENT_ITEM_ENTER);
2442 else 2442 else
2443 _dw_event_handler(self, (id)params, 12); 2443 _dw_event_handler(self, (id)params, _DW_EVENT_ITEM_SELECT);
2444 /* Handler for listbox class */ 2444 /* Handler for listbox class */
2445 _dw_event_handler(self, DW_INT_TO_POINTER((int)indexPath.row), 11); 2445 _dw_event_handler(self, DW_INT_TO_POINTER((int)indexPath.row), _DW_EVENT_LIST_SELECT);
2446 /* Update lastClick for double tap check */ 2446 /* Update lastClick for double tap check */
2447 lastClick = now; 2447 lastClick = now;
2448 lastClickRow = indexPath.row; 2448 lastClickRow = indexPath.row;
2449 } 2449 }
2450 else /* Otherwise treat it as doubleClicked: */ 2450 else /* Otherwise treat it as doubleClicked: */
2451 { 2451 {
2452 /* Handler for container class */ 2452 /* Handler for container class */
2453 _dw_event_handler(self, (id)params, 9); 2453 _dw_event_handler(self, (id)params, _DW_EVENT_ITEM_ENTER);
2454 } 2454 }
2455 } 2455 }
2456 -(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath 2456 -(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
2457 { 2457 {
2458 if([self allowsMultipleSelection]) 2458 if([self allowsMultipleSelection])
2539 -(void)textFieldDidEndEditing:(UITextField *)textField 2539 -(void)textFieldDidEndEditing:(UITextField *)textField
2540 { 2540 {
2541 long val = [[textfield text] intValue]; 2541 long val = [[textfield text] intValue];
2542 [stepper setValue:(float)val]; 2542 [stepper setValue:(float)val];
2543 [textfield setText:[NSString stringWithFormat:@"%d", (int)[stepper value]]]; 2543 [textfield setText:[NSString stringWithFormat:@"%d", (int)[stepper value]]];
2544 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), 14); 2544 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), _DW_EVENT_VALUE_CHANGED);
2545 } 2545 }
2546 -(void)stepperChanged:(UIStepper*)theStepper 2546 -(void)stepperChanged:(UIStepper*)theStepper
2547 { 2547 {
2548 [textfield setText:[NSString stringWithFormat:@"%d", (int)[theStepper value]]]; 2548 [textfield setText:[NSString stringWithFormat:@"%d", (int)[theStepper value]]];
2549 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), 14); 2549 _dw_event_handler(self, DW_INT_TO_POINTER((int)[stepper value]), _DW_EVENT_VALUE_CHANGED);
2550 } 2550 }
2551 -(void)setClickDefault:(id)input { clickDefault = input; } 2551 -(void)setClickDefault:(id)input { clickDefault = input; }
2552 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; } 2552 -(void)dealloc { UserData *root = userdata; _dw_remove_userdata(&root, NULL, TRUE); dw_signal_disconnect_by_window(self); [super dealloc]; }
2553 @end 2553 @end
2554 2554
2580 dw_signal_disconnect_by_window(notification); 2580 dw_signal_disconnect_by_window(notification);
2581 } 2581 }
2582 else if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier]) 2582 else if ([response.actionIdentifier isEqualToString:UNNotificationDefaultActionIdentifier])
2583 { 2583 {
2584 /* The user launched the app. */ 2584 /* The user launched the app. */
2585 _dw_event_handler(notification, nil, 8); 2585 _dw_event_handler(notification, nil, _DW_EVENT_CLICKED);
2586 dw_signal_disconnect_by_window(notification); 2586 dw_signal_disconnect_by_window(notification);
2587 } 2587 }
2588 completionHandler(); 2588 completionHandler();
2589 } 2589 }
2590 @end 2590 @end
2651 -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component 2651 -(void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
2652 { 2652 {
2653 selectedIndex = (int)row; 2653 selectedIndex = (int)row;
2654 [self setText:[dataArray objectAtIndex:row]]; 2654 [self setText:[dataArray objectAtIndex:row]];
2655 [self sendActionsForControlEvents:UIControlEventValueChanged]; 2655 [self sendActionsForControlEvents:UIControlEventValueChanged];
2656 _dw_event_handler(self, DW_INT_TO_POINTER(selectedIndex), 11); 2656 _dw_event_handler(self, DW_INT_TO_POINTER(selectedIndex), _DW_EVENT_LIST_SELECT);
2657 } 2657 }
2658 -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [dataArray count]; } 2658 -(NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { return [dataArray count]; }
2659 -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component 2659 -(NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
2660 { 2660 {
2661 return [dataArray objectAtIndex:row]; 2661 return [dataArray objectAtIndex:row];
2819 if(oldsize.width != newsize.width || oldsize.height != newsize.height) 2819 if(oldsize.width != newsize.width || oldsize.height != newsize.height)
2820 { 2820 {
2821 if(newsize.width > 0 && newsize.height > 0) 2821 if(newsize.width > 0 && newsize.height > 0)
2822 { 2822 {
2823 [render setSize:newsize]; 2823 [render setSize:newsize];
2824 _dw_event_handler(handle, nil, 1); 2824 _dw_event_handler(handle, nil, _DW_EVENT_CONFIGURE);
2825 } 2825 }
2826 } 2826 }
2827 } 2827 }
2828 /* Special handling for notebook controls */ 2828 /* Special handling for notebook controls */
2829 else if([handle isMemberOfClass:[DWNotebook class]]) 2829 else if([handle isMemberOfClass:[DWNotebook class]])
7552 DW_LOCAL_POOL_IN; 7552 DW_LOCAL_POOL_IN;
7553 7553
7554 [html evaluateJavaScript:[NSString stringWithUTF8String:script] completionHandler:^(NSString *result, NSError *error) 7554 [html evaluateJavaScript:[NSString stringWithUTF8String:script] completionHandler:^(NSString *result, NSError *error)
7555 { 7555 {
7556 void *params[2] = { result, scriptdata }; 7556 void *params[2] = { result, scriptdata };
7557 _dw_event_handler(html, (id)params, 18); 7557 _dw_event_handler(html, (id)params, _DW_EVENT_HTML_RESULT);
7558 }]; 7558 }];
7559 DW_LOCAL_POOL_OUT; 7559 DW_LOCAL_POOL_OUT;
7560 DW_FUNCTION_RETURN_THIS(retval); 7560 DW_FUNCTION_RETURN_THIS(retval);
7561 } 7561 }
7562 7562