comparison ios/dw.m @ 2409:2ab3e88e5d68

iOS: Implement dw_notebook_page_set(). Fix statusbar offset location. Set the UIWindow background color to the default system background color.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Mon, 29 Mar 2021 23:15:43 +0000
parents 795056df9efd
children 5db33d37cc1a
comparison
equal deleted inserted replaced
2408:795056df9efd 2409:2ab3e88e5d68
1137 */ 1137 */
1138 id object = [array lastObject]; 1138 id object = [array lastObject];
1139 if(![object isMemberOfClass:[DWView class]]) 1139 if(![object isMemberOfClass:[DWView class]])
1140 [object setHidden:YES]; 1140 [object setHidden:YES];
1141 /* Adjust the frame to account for the status bar */ 1141 /* Adjust the frame to account for the status bar */
1142 frame.size.height -= [UIApplication sharedApplication].statusBarFrame.size.height;; 1142 NSInteger sbheight = [UIApplication sharedApplication].statusBarFrame.size.height;
1143 frame.size.height -= sbheight;
1144 frame.origin.y += sbheight;
1143 [view setFrame:frame]; 1145 [view setFrame:frame];
1144 [view windowResized:frame.size]; 1146 [view windowResized:frame.size];
1145 } 1147 }
1146 @end 1148 @end
1147 1149
7341 * Sets the currently visibale page ID. 7343 * Sets the currently visibale page ID.
7342 * Parameters: 7344 * Parameters:
7343 * handle: Handle to the notebook widget. 7345 * handle: Handle to the notebook widget.
7344 * pageid: ID of the page to be made visible. 7346 * pageid: ID of the page to be made visible.
7345 */ 7347 */
7346 void API dw_notebook_page_set(HWND handle, unsigned int pageid) 7348 DW_FUNCTION_DEFINITION(dw_notebook_page_set, void, HWND handle, unsigned int pageid)
7347 { 7349 DW_FUNCTION_ADD_PARAM2(handle, pageid)
7348 #if 0 /* TODO: Don't see a method to select a tab */ 7350 DW_FUNCTION_NO_RETURN(dw_notebook_page_set)
7351 DW_FUNCTION_RESTORE_PARAM2(handle, HWND, pageid, unsigned int)
7352 {
7349 DWNotebook *notebook = handle; 7353 DWNotebook *notebook = handle;
7350 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid); 7354 DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid);
7351 7355
7352 if(notepage != nil) 7356 if(notepage != nil)
7353 { 7357 {
7354 NSMutableArray<DWNotebookPage *> *views = [notebook views]; 7358 NSMutableArray<DWNotebookPage *> *views = [notebook views];
7355 NSUInteger index = [views indexOfObject:notepage]; 7359 NSUInteger index = [views indexOfObject:notepage];
7356 7360
7357 if(index != NSNotFound) 7361 if(index != NSNotFound)
7358 { 7362 {
7359 [notebook selectTabViewItem:notepage]; 7363 [notebook tabs].selectedSegmentIndex = index;
7360 } 7364 }
7361 } 7365 }
7362 #endif 7366 DW_FUNCTION_RETURN_NOTHING;
7363 } 7367 }
7364 7368
7365 /* 7369 /*
7366 * Sets the text on the specified notebook tab. 7370 * Sets the text on the specified notebook tab.
7367 * Parameters: 7371 * Parameters:
7431 DWView *view = [[DWView alloc] init]; 7435 DWView *view = [[DWView alloc] init];
7432 7436
7433 [window setWindowLevel:UIWindowLevelNormal]; 7437 [window setWindowLevel:UIWindowLevelNormal];
7434 [window setRootViewController:[[DWViewController alloc] init]]; 7438 [window setRootViewController:[[DWViewController alloc] init]];
7435 [window addSubview:view]; 7439 [window addSubview:view];
7440 [window setBackgroundColor:[UIColor systemBackgroundColor]];
7436 7441
7437 /* TODO: Handle style flags... if we can? There is no visible frame */ 7442 /* TODO: Handle style flags... if we can? There is no visible frame */
7438 if(@available(iOS 13.0, *)) { 7443 if(@available(iOS 13.0, *)) {
7439 [window setLargeContentTitle:[NSString stringWithUTF8String:title]]; 7444 [window setLargeContentTitle:[NSString stringWithUTF8String:title]];
7440 } 7445 }