Revision: 28842
          http://sourceforge.net/p/bibdesk/svn/28842
Author:   hofman
Date:     2024-03-12 18:00:40 +0000 (Tue, 12 Mar 2024)
Log Message:
-----------
use autolayout for web dialog

Modified Paths:
--------------
    trunk/bibdesk/BDSKWebViewModalDialogController.h
    trunk/bibdesk/BDSKWebViewModalDialogController.m

Modified: trunk/bibdesk/BDSKWebViewModalDialogController.h
===================================================================
--- trunk/bibdesk/BDSKWebViewModalDialogController.h    2024-03-12 17:27:03 UTC 
(rev 28841)
+++ trunk/bibdesk/BDSKWebViewModalDialogController.h    2024-03-12 18:00:40 UTC 
(rev 28842)
@@ -44,6 +44,7 @@
 @interface BDSKWebViewModalDialogController : NSWindowController 
<BDSKWebViewDelegate, NSWindowDelegate> {
     BDSKWebView *webView;
     BDSKStatusBar *statusBar;
+    NSLayoutConstraint *bottomConstraint;
 }
 @property (nonatomic, readonly) BDSKWebView *webView;
 @end

Modified: trunk/bibdesk/BDSKWebViewModalDialogController.m
===================================================================
--- trunk/bibdesk/BDSKWebViewModalDialogController.m    2024-03-12 17:27:03 UTC 
(rev 28841)
+++ trunk/bibdesk/BDSKWebViewModalDialogController.m    2024-03-12 18:00:40 UTC 
(rev 28842)
@@ -56,7 +56,16 @@
         [webView setDelegate:self];
         NSView *contentView = [window contentView];
         [webView setFrame:[contentView bounds]];
+        [webView setTranslatesAutoresizingMaskIntoConstraints:NO];
         [contentView addSubview:webView];
+        NSArray *constraints = @[
+            [[webView leadingAnchor] constraintEqualToAnchor:[contentView 
leadingAnchor]],
+            [[contentView trailingAnchor] constraintEqualToAnchor:[webView 
trailingAnchor]],
+            [[webView topAnchor] constraintEqualToAnchor:[contentView 
topAnchor]],
+            [[contentView bottomAnchor] constraintEqualToAnchor:[webView 
bottomAnchor]],
+        ];
+        [NSLayoutConstraint activateConstraints:constraints];
+        bottomConstraint = [constraints lastObject];
     }
     return self;
 }
@@ -120,7 +129,9 @@
     if (visible != [statusBar isVisible]) {
         if (visible && statusBar == nil) {
             statusBar = [[BDSKStatusBar alloc] initWithFrame:NSMakeRect(0.0, 
0.0, NSWidth([webView frame]), 22.0)];
-            [statusBar setAutoresizingMask:NSViewWidthSizable | 
NSViewMaxXMargin];
+            [statusBar setTranslatesAutoresizingMaskIntoConstraints:NO];
+            [[[statusBar heightAnchor] constraintEqualToConstant:22.0] 
setActive:YES];
+            [statusBar setBottomConstraint:bottomConstraint];
         }
         [statusBar toggleBelowView:webView animate:NO];
     }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to