changeset 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 0286ac44d347
files ios/dw.m
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/ios/dw.m	Mon Mar 29 22:46:01 2021 +0000
+++ b/ios/dw.m	Mon Mar 29 23:15:43 2021 +0000
@@ -1139,7 +1139,9 @@
     if(![object isMemberOfClass:[DWView class]])
         [object setHidden:YES];
     /* Adjust the frame to account for the status bar */
-    frame.size.height -= [UIApplication sharedApplication].statusBarFrame.size.height;;
+    NSInteger sbheight = [UIApplication sharedApplication].statusBarFrame.size.height;
+    frame.size.height -= sbheight;
+    frame.origin.y += sbheight;
     [view setFrame:frame];
     [view windowResized:frame.size];
 }
@@ -7343,9 +7345,11 @@
  *          handle: Handle to the notebook widget.
  *          pageid: ID of the page to be made visible.
  */
-void API dw_notebook_page_set(HWND handle, unsigned int pageid)
-{
-#if 0 /* TODO: Don't see a method to select a tab */
+DW_FUNCTION_DEFINITION(dw_notebook_page_set, void, HWND handle, unsigned int pageid)
+DW_FUNCTION_ADD_PARAM2(handle, pageid)
+DW_FUNCTION_NO_RETURN(dw_notebook_page_set)
+DW_FUNCTION_RESTORE_PARAM2(handle, HWND, pageid, unsigned int)
+{
     DWNotebook *notebook = handle;
     DWNotebookPage *notepage = _dw_notepage_from_id(notebook, pageid);
 
@@ -7356,10 +7360,10 @@
 
         if(index != NSNotFound)
         {
-            [notebook selectTabViewItem:notepage];
-        }
-    }
-#endif
+            [notebook tabs].selectedSegmentIndex = index;
+        }
+    }
+    DW_FUNCTION_RETURN_NOTHING;
 }
 
 /*
@@ -7433,6 +7437,7 @@
     [window setWindowLevel:UIWindowLevelNormal];
     [window setRootViewController:[[DWViewController alloc] init]];
     [window addSubview:view];
+    [window setBackgroundColor:[UIColor systemBackgroundColor]];
 
     /* TODO: Handle style flags... if we can? There is no visible frame */
     if(@available(iOS 13.0, *)) {