[vlc-commits] macosx: Limit min and max width of prefs split view

David Fuhrmann git at videolan.org
Sat Feb 3 15:24:28 CET 2018


vlc/vlc-3.0 | branch: master | David Fuhrmann <dfuhrmann at videolan.org> | Fri Feb  2 15:39:43 2018 +0100| [8d776d680e886a6d797289169e29bce6466ea34a] | committer: Felix Paul Kühne

macosx: Limit min and max width of prefs split view

(cherry picked from commit 9d69f17823921bbe3201010058790a47b30b5ac5)
Signed-off-by: Felix Paul Kühne <felix at feepk.net>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=8d776d680e886a6d797289169e29bce6466ea34a
---

 modules/gui/macosx/UI/Preferences.xib |  3 +++
 modules/gui/macosx/prefs.h            |  4 +++-
 modules/gui/macosx/prefs.m            | 22 ++++++++++++++++++++++
 3 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/modules/gui/macosx/UI/Preferences.xib b/modules/gui/macosx/UI/Preferences.xib
index 14ff2dc51d..2a0286877b 100644
--- a/modules/gui/macosx/UI/Preferences.xib
+++ b/modules/gui/macosx/UI/Preferences.xib
@@ -87,6 +87,9 @@
                             <real value="250"/>
                             <real value="250"/>
                         </holdingPriorities>
+                        <connections>
+                            <outlet property="delegate" destination="-2" id="7cX-do-6Lz"/>
+                        </connections>
                     </splitView>
                     <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="1541">
                         <rect key="frame" x="691" y="12" width="70" height="32"/>
diff --git a/modules/gui/macosx/prefs.h b/modules/gui/macosx/prefs.h
index 2dcca555f0..7d7e68f911 100644
--- a/modules/gui/macosx/prefs.h
+++ b/modules/gui/macosx/prefs.h
@@ -22,12 +22,14 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#import <Cocoa/Cocoa.h>
+
 @class VLCTreeMainItem;
 
 /*****************************************************************************
  * VLCPrefs interface
  *****************************************************************************/
- at interface VLCPrefs : NSWindowController
+ at interface VLCPrefs : NSWindowController<NSSplitViewDelegate>
 
 @property (readwrite, weak) IBOutlet NSTextField *titleLabel;
 @property (readwrite, weak) IBOutlet NSOutlineView *tree;
diff --git a/modules/gui/macosx/prefs.m b/modules/gui/macosx/prefs.m
index c8d20b7ecf..57626d9019 100644
--- a/modules/gui/macosx/prefs.m
+++ b/modules/gui/macosx/prefs.m
@@ -277,6 +277,28 @@
     return (item == nil) ? @"" : [item name];
 }
 
+#pragma mark -
+#pragma mark split view delegate
+- (CGFloat)splitView:(NSSplitView *)splitView constrainMaxCoordinate:(CGFloat)proposedMax ofSubviewAt:(NSInteger)dividerIndex
+{
+    return 300.;
+}
+
+- (CGFloat)splitView:(NSSplitView *)splitView constrainMinCoordinate:(CGFloat)proposedMin ofSubviewAt:(NSInteger)dividerIndex
+{
+    return 100.;
+}
+
+- (BOOL)splitView:(NSSplitView *)splitView canCollapseSubview:(NSView *)subview
+{
+    return NO;
+}
+
+- (BOOL)splitView:(NSSplitView *)splitView shouldAdjustSizeOfSubview:(NSView *)subview
+{
+    return [splitView.subviews objectAtIndex:0] != subview;
+}
+
 @end
 
 #pragma mark -



More information about the vlc-commits mailing list