comparison ios/dw.m @ 2612:4628c8c34125

iOS: Standardize DWContainer behavior part 1. If single selection a single tap on a row will cause ENTER. It multiple selection... single tap will select or deselect. A long tap will cause CONTEXT, a double tap will cause ENTER.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 18 Jul 2021 20:55:45 +0000
parents da51be036599
children ac51cbdcfbe5
comparison
equal deleted inserted replaced
2611:ed2c4a503666 2612:4628c8c34125
2076 UIColor *fgcolor, *oddcolor, *evencolor; 2076 UIColor *fgcolor, *oddcolor, *evencolor;
2077 unsigned long dw_oddcolor, dw_evencolor; 2077 unsigned long dw_oddcolor, dw_evencolor;
2078 unsigned long _DW_COLOR_ROW_ODD, _DW_COLOR_ROW_EVEN; 2078 unsigned long _DW_COLOR_ROW_ODD, _DW_COLOR_ROW_EVEN;
2079 int iLastAddPoint, iLastQueryPoint; 2079 int iLastAddPoint, iLastQueryPoint;
2080 int filesystem; 2080 int filesystem;
2081 NSTimeInterval lastClick;
2082 NSInteger lastClickRow;
2081 } 2083 }
2082 -(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section; 2084 -(NSInteger)tableView:(UITableView *)aTable numberOfRowsInSection:(NSInteger)section;
2083 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 2085 -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
2084 -(void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath; 2086 -(void)tableView:(UITableView*)tableView willDisplayCell:(UITableViewCell*)cell forRowAtIndexPath:(NSIndexPath*)indexPath;
2085 -(UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point; 2087 -(UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point;
2430 params[1] = (void *)[self getRowData:(int)indexPath.row]; 2432 params[1] = (void *)[self getRowData:(int)indexPath.row];
2431 2433
2432 /* If multiple selection is enabled, treat it as selectionChanged: */ 2434 /* If multiple selection is enabled, treat it as selectionChanged: */
2433 if([self allowsMultipleSelection]) 2435 if([self allowsMultipleSelection])
2434 { 2436 {
2435 /* Handler for container class */ 2437 NSTimeInterval now = [NSDate timeIntervalSinceReferenceDate];
2436 _dw_event_handler(self, (id)params, 12); 2438
2439 /* Handler for container class... check for double tap */
2440 if(lastClickRow == indexPath.row && now - lastClick < 0.3)
2441 _dw_event_handler(self, (id)params, 9);
2442 else
2443 _dw_event_handler(self, (id)params, 12);
2437 /* Handler for listbox class */ 2444 /* Handler for listbox class */
2438 _dw_event_handler(self, DW_INT_TO_POINTER((int)indexPath.row), 11); 2445 _dw_event_handler(self, DW_INT_TO_POINTER((int)indexPath.row), 11);
2446 /* Update lastClick for double tap check */
2447 lastClick = now;
2448 lastClickRow = indexPath.row;
2439 } 2449 }
2440 else /* Otherwise treat it as doubleClicked: */ 2450 else /* Otherwise treat it as doubleClicked: */
2441 { 2451 {
2442 /* Handler for container class */ 2452 /* Handler for container class */
2443 _dw_event_handler(self, (id)params, 9); 2453 _dw_event_handler(self, (id)params, 9);