// Change preferences tab view to selected one. Animate resizing of the window if the selected // tab is different size than the currently visible one. void ShowSelectedTab(IPreferencesTab selectedTab) { float delta = Window.ContentView.Frame.Height - selectedTab.View.Frame.Height; // Delta must be calculated before currect tab view is removed RemoveCurrentTabView(); Window.SetFrame(CalculateNewFrameForWindow (delta), true, true); Window.ContentView.AddSubview(selectedTab.View); }
// Change preferences tab view to selected one. Animate resizing of the window if the selected // tab is different size than the currently visible one. void ShowSelectedTab(IPreferencesTab selectedTab) { float delta = Window.ContentView.Frame.Height - selectedTab.View.Frame.Height; // Delta must be calculated before currect tab view is removed RemoveCurrentTabView(); Window.SetFrame(CalculateNewFrameForWindow(delta), true, true); Window.ContentView.AddSubview(selectedTab.View); }
private void ShowSelectedTab(IPreferencesTab selectedTab) { var contentSize = (selectedTab as NSViewController).View.Bounds.Size; var newWindowSize = Window.FrameRectFor(new CGRect(CGPoint.Empty, contentSize)).Size; var frame = Window.Frame; frame.Y += frame.Height - newWindowSize.Height; frame.Size = newWindowSize; var horizontalDiff = (Window.Frame.Width - newWindowSize.Width) / 2; frame.X += horizontalDiff; RemoveCurrentTabView(); Window.SetFrame(frame, false, true); Window.ContentView.AddSubview(selectedTab.View); }