Commit 17769a39 authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx: prepare sidebar

removed remnants of the Dudiak interface, added PXSourceList by Alex Rozanski (BSD-new licensed) which will be used for the new implementation, added a to-be-replaced png for the window's topbar
parent 666390fa
......@@ -52,6 +52,8 @@
// TODO Playlist table, additional ui stuff at the top of the window
IBOutlet id o_playlist_table;
IBOutlet id o_video_view;
IBOutlet id o_split_view;
IBOutlet id o_sidebar_view;
BOOL b_dark_interface;
BOOL b_video_playback_enabled;
......
......@@ -69,7 +69,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
if( [[NSWindow class] instancesRespondToSelector:@selector(setContentBorderThickness:forEdge:)] )
{
b_useTextured = NO;
styleMask ^= NSTexturedBackgroundWindowMask;
// styleMask ^= NSTexturedBackgroundWindowMask;
}
self = [super initWithContentRect:contentRect styleMask:styleMask //& ~NSTitledWindowMask
......@@ -208,7 +208,7 @@ static VLCMainWindow *_o_sharedInstance = nil;
[o_play_btn setImage: o_play_img];
[o_play_btn setAlternateImage: o_play_pressed_img];
[o_video_view setFrame: [o_playlist_table frame]];
[o_video_view setFrame: [o_split_view frame]];
[self setDelegate: self];
[self setExcludedFromWindowsMenu: YES];
// Set that here as IB seems to be buggy
......@@ -219,6 +219,21 @@ static VLCMainWindow *_o_sharedInstance = nil;
[self updateVolumeSlider];
}
- (void)becomeMainWindow
{
[o_sidebar_view setBackgroundColor: [NSColor colorWithCalibratedRed:0.820
green:0.843
blue:0.886
alpha:1.0]];
[super becomeMainWindow];
}
- (void)resignMainWindow
{
[o_sidebar_view setBackgroundColor: [NSColor colorWithCalibratedWhite:0.91 alpha:1.0]];
[super resignMainWindow];
}
#pragma mark -
#pragma mark Button Actions
......
......@@ -55,10 +55,10 @@ SOURCES_macosx = \
bookmarks.m \
embeddedwindow.h \
embeddedwindow.m \
sidebarview.h \
sidebarview.m \
sidestatusview.h \
sidestatusview.m \
PXSourceList.h \
PXSourceList.m \
PXSourceListDataSource.h \
PXSourceListDelegate.h \
fspanel.m \
fspanel.h \
eyetv.h \
......
//
// PXSourceList.h
// PXSourceList
//
// Created by Alex Rozanski on 05/09/2009.
// Copyright 2009-10 Alex Rozanski http://perspx.com
//
#import <Cocoa/Cocoa.h>
#import "PXSourceListDelegate.h"
#import "PXSourceListDataSource.h"
#ifndef MAC_OS_X_VERSION_10_6
@protocol NSOutlineViewDelegate <NSObject> @end
@protocol NSOutlineViewDataSource <NSObject> @end
#endif
@interface PXSourceList: NSOutlineView <NSOutlineViewDelegate, NSOutlineViewDataSource>
{
id <PXSourceListDelegate> _secondaryDelegate; //Used to store the publicly visible delegate
id <PXSourceListDataSource> _secondaryDataSource; //Used to store the publicly visible data source
NSSize _iconSize; //The size of icons in the Source List. Defaults to 16x16
}
@property NSSize iconSize;
@property (assign) id<PXSourceListDataSource> dataSource;
@property (assign) id<PXSourceListDelegate> delegate;
- (NSUInteger)numberOfGroups; //Returns the number of groups in the Source List
- (BOOL)isGroupItem:(id)item; //Returns whether `item` is a group
- (BOOL)isGroupAlwaysExpanded:(id)group; //Returns whether `group` is displayed as always expanded
- (BOOL)itemHasBadge:(id)item; //Returns whether `item` has a badge
- (NSInteger)badgeValueForItem:(id)item; //Returns the badge value for `item`
@end
This diff is collapsed.
//
// PXSourceListDataSource.h
// PXViewKit
//
// Created by Alex Rozanski on 17/10/2009.
// Copyright 2009-10 Alex Rozanski http://perspx.com
//
#import <Cocoa/Cocoa.h>
@class PXSourceList;
@protocol PXSourceListDataSource <NSObject>
@required
- (NSUInteger)sourceList:(PXSourceList*)sourceList numberOfChildrenOfItem:(id)item;
- (id)sourceList:(PXSourceList*)aSourceList child:(NSUInteger)index ofItem:(id)item;
- (id)sourceList:(PXSourceList*)aSourceList objectValueForItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList isItemExpandable:(id)item;
@optional
- (void)sourceList:(PXSourceList*)aSourceList setObjectValue:(id)object forItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList itemHasBadge:(id)item;
- (NSInteger)sourceList:(PXSourceList*)aSourceList badgeValueForItem:(id)item;
- (NSColor*)sourceList:(PXSourceList*)aSourceList badgeTextColorForItem:(id)item;
- (NSColor*)sourceList:(PXSourceList*)aSourceList badgeBackgroundColorForItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList itemHasIcon:(id)item;
- (NSImage*)sourceList:(PXSourceList*)aSourceList iconForItem:(id)item;
//The rest of these methods are basically "wrappers" for the NSOutlineViewDataSource methods
- (id)sourceList:(PXSourceList*)aSourceList itemForPersistentObject:(id)object;
- (id)sourceList:(PXSourceList*)aSourceList persistentObjectForItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList writeItems:(NSArray *)items toPasteboard:(NSPasteboard *)pboard;
- (NSDragOperation)sourceList:(PXSourceList*)sourceList validateDrop:(id < NSDraggingInfo >)info proposedItem:(id)item proposedChildIndex:(NSInteger)index;
- (BOOL)sourceList:(PXSourceList*)aSourceList acceptDrop:(id < NSDraggingInfo >)info item:(id)item childIndex:(NSInteger)index;
- (NSArray *)sourceList:(PXSourceList*)aSourceList namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination forDraggedItems:(NSArray *)items;
@end
//
// PXSourceListDelegate.h
// PXViewKit
//
// Created by Alex Rozanski on 17/10/2009.
// Copyright 2009-10 Alex Rozanski http://perspx.com
//
#import <Cocoa/Cocoa.h>
@class PXSourceList;
@protocol PXSourceListDelegate <NSObject>
@optional
//Extra methods
- (BOOL)sourceList:(PXSourceList*)aSourceList isGroupAlwaysExpanded:(id)group;
- (NSMenu*)sourceList:(PXSourceList*)aSourceList menuForEvent:(NSEvent*)theEvent item:(id)item;
//Basically NSOutlineViewDelegate wrapper methods
- (BOOL)sourceList:(PXSourceList*)aSourceList shouldSelectItem:(id)item;
- (NSIndexSet*)sourceList:(PXSourceList*)aSourceList selectionIndexesForProposedSelection:(NSIndexSet *)proposedSelectionIndexes;
- (BOOL)sourceList:(PXSourceList*)aSourceList shouldEditItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList shouldTrackCell:(NSCell *)cell forItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList shouldExpandItem:(id)item;
- (BOOL)sourceList:(PXSourceList*)aSourceList shouldCollapseItem:(id)item;
- (CGFloat)sourceList:(PXSourceList*)aSourceList heightOfRowByItem:(id)item;
- (NSCell*)sourceList:(PXSourceList*)aSourceList willDisplayCell:(id)cell forItem:(id)item;
- (NSCell*)sourceList:(PXSourceList*)aSourceList dataCellForItem:(id)item;
@end
@interface NSObject (PXSourceListNotifications)
//Selection
- (void)sourceListSelectionIsChanging:(NSNotification *)notification;
- (void)sourceListSelectionDidChange:(NSNotification *)notification;
//Item expanding/collapsing
- (void)sourceListItemWillExpand:(NSNotification *)notification;
- (void)sourceListItemDidExpand:(NSNotification *)notification;
- (void)sourceListItemWillCollapse:(NSNotification *)notification;
- (void)sourceListItemDidCollapse:(NSNotification *)notification;
- (void)sourceListDeleteKeyPressedOnRows:(NSNotification *)notification;
@end
//PXSourceList delegate notifications
extern NSString * const PXSLSelectionIsChangingNotification;
extern NSString * const PXSLSelectionDidChangeNotification;
extern NSString * const PXSLItemWillExpandNotification;
extern NSString * const PXSLItemDidExpandNotification;
extern NSString * const PXSLItemWillCollapseNotification;
extern NSString * const PXSLItemDidCollapseNotification;
extern NSString * const PXSLDeleteKeyPressedOnRowsNotification;
......@@ -50,7 +50,6 @@
IBOutlet id o_horizontal_split;
IBOutlet id o_vertical_split;
IBOutlet id o_videosubview;
IBOutlet id o_sidebar_list;
IBOutlet id o_view;
IBOutlet id o_background_view;
IBOutlet id o_searchfield;
......
......@@ -80,15 +80,6 @@
o_img_play = [NSImage imageNamed: @"play_embedded"];
o_img_pause = [NSImage imageNamed: @"pause_embedded"];
/* Set color of sidebar to Leopard's "Sidebar Blue" */
[o_sidebar_list setBackgroundColor: [NSColor colorWithCalibratedRed:0.820
green:0.843
blue:0.886
alpha:1.0]];
[self setMinSize:NSMakeSize([o_sidebar_list convertRect:[o_sidebar_list bounds]
toView: nil].size.width + 551., 114.)];
/* Useful to save o_view frame in fullscreen mode */
o_temp_view = [[NSView alloc] init];
[o_temp_view setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
......@@ -299,17 +290,12 @@
- (void)becomeMainWindow
{
[o_sidebar_list setBackgroundColor: [NSColor colorWithCalibratedRed:0.820
green:0.843
blue:0.886
alpha:1.0]];
[o_status becomeMainWindow];
[super becomeMainWindow];
}
- (void)resignMainWindow
{
[o_sidebar_list setBackgroundColor: [NSColor colorWithCalibratedWhite:0.91 alpha:1.0]];
[o_status resignMainWindow];
[super resignMainWindow];
}
......
......@@ -76,7 +76,6 @@
IBOutlet id o_btn_playlist;
IBOutlet id o_playlist_view;
IBOutlet id o_sidebar;
IBOutlet id o_search_field;
IBOutlet id o_search_field_other;
IBOutlet id o_mi_save_playlist;
......@@ -142,7 +141,6 @@
- (IBAction)sortNodeByAuthor:(id)sender;
- (IBAction)recursiveExpandNode:(id)sender;
- (void)playSidebarItem:(id)item;
- (id)playingItem;
- (void)appendArray:(NSArray*)o_array atPos:(int)i_position enqueue:(BOOL)b_enqueue;
......
......@@ -47,7 +47,6 @@
#import "playlist.h"
#import "controls.h"
#import "misc.h"
#import "sidebarview.h"
#include <vlc_keys.h>
#import <vlc_services_discovery.h>
......@@ -514,7 +513,6 @@
// TODO Find a way to keep the dict size to a minimum
//[o_outline_dict removeAllObjects];
[o_outline_view reloadData];
[o_sidebar updateSidebar:[self playingItem]];
[[[[VLCMain sharedInstance] wizard] playlistWizard] reloadOutlineView];
[[[[VLCMain sharedInstance] bookmarks] dataTable] reloadData];
......@@ -802,39 +800,6 @@
PL_UNLOCK;
}
- (void)playSidebarItem:(id)item
{
intf_thread_t * p_intf = VLCIntf;
playlist_t * p_playlist = pl_Get( p_intf );
playlist_item_t *p_item;
playlist_item_t *p_node = NULL;
p_item = [item pointerValue];
if( p_item )
{
if( p_item->i_children == -1 )
{
p_node = p_item->p_parent;
}
else
{
p_node = p_item;
if( p_node->i_children > 0 && p_node->pp_children[0]->i_children == -1 )
{
p_item = p_node->pp_children[0];
}
else
{
p_item = NULL;
}
}
playlist_Control( p_playlist, PLAYLIST_VIEWPLAY, pl_Unlocked, p_node, p_item );
}
}
- (IBAction)revealItemInFinder:(id)sender
{
playlist_item_t * p_item = [[o_outline_view itemAtRow:[o_outline_view selectedRow]] pointerValue];
......
/*****************************************************************************
* sidebarview.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2005-2008 the VideoLAN team
* $Id$
*
* Authors: Eric Dudiak <dudiak at gmail dot com>
* Colloquy <http://colloquy.info/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface sidebarview : NSSplitView
{
long _mainSubviewIndex;
}
@end
/*****************************************************************************
* VLCSidebar interface
*****************************************************************************/
@interface VLCSidebar : NSObject
{
IBOutlet id o_outline_view;
IBOutlet id o_playlist;
}
- (NSOutlineView *)outlineView;
- (void)updateSidebar:(id)item;
@end
\ No newline at end of file
/*****************************************************************************
* sidebarview.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2005-2008 the VideoLAN team
* $Id$
*
* Authors: Eric Dudiak <dudiak at gmail dot com>
* Colloquy <http://colloquy.info/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "sidebarview.h"
#import "intf.h"
#import "playlist.h"
@implementation sidebarview
- (void) resetCursorRects
{
if( ! [self isPaneSplitter] )
[super resetCursorRects];
}
- (id) initWithCoder:(NSCoder *) decoder {
if( ( self = [super initWithCoder:decoder] ) )
_mainSubviewIndex = 1;
return self;
}
- (CGFloat) dividerThickness
{
return 1.0;
}
- (BOOL) isVertical
{
return YES;
}
- (void) drawDividerInRect:(NSRect) rect
{
[[NSColor colorWithCalibratedWhite:0.65 alpha:1.] set];
NSRectFill( rect );
}
- (void) adjustSubviews
{
if( _mainSubviewIndex == -1 || [[self subviews] count] != 2 ) {
[super adjustSubviews];
return;
}
float dividerThickness = [self dividerThickness];
NSRect newFrame = [self frame];
NSView *mainView = [[self subviews] objectAtIndex:_mainSubviewIndex];
NSView *otherView = ( _mainSubviewIndex ? [[self subviews] objectAtIndex:0] : [[self subviews] objectAtIndex:1] );
NSRect mainFrame = [mainView frame];
NSRect otherFrame = [otherView frame];
mainFrame.size.width = NSWidth( newFrame ) - dividerThickness - NSWidth( otherFrame );
mainFrame.size.height = NSHeight( newFrame );
mainFrame.origin.x = ( _mainSubviewIndex ? NSWidth( otherFrame ) + dividerThickness : 0. );
mainFrame.origin.y = 0.;
otherFrame.size.width = NSWidth( otherFrame );
otherFrame.size.height = NSHeight( newFrame );
otherFrame.origin.x = ( _mainSubviewIndex ? 0. : NSWidth( mainFrame ) + dividerThickness );
otherFrame.origin.y = 0.;
[mainView setFrame:mainFrame];
[otherView setFrame:otherFrame];
[self setNeedsDisplay:YES];
}
@end
/*****************************************************************************
* VLCPlaylist implementation
*****************************************************************************/
@implementation VLCSidebar
- (void)awakeFromNib
{
[o_outline_view setTarget: self];
[o_outline_view setDelegate: self];
[o_outline_view setDataSource: self];
[o_outline_view setAllowsEmptySelection: NO];
}
- (NSOutlineView *)outlineView
{
return o_outline_view;
}
- (void)outlineView:(NSOutlineView *)outlineView
willDisplayCell:(id)cell
forTableColumn:(NSTableColumn *)tableColumn
item:(id)item
{
if ( ![outlineView isExpandable:item] )
{
[cell setFont: [NSFont systemFontOfSize: 12]];
[cell setTextColor:[NSColor blackColor]];
}
else
{
[cell setFont: [NSFont boldSystemFontOfSize: 10]];
[cell setTextColor:[NSColor colorWithCalibratedWhite:0.365 alpha:1.0]];
}
}
- (void)updateSidebar:(id)item
{
int i_row = -1;
[o_outline_view reloadData];
i_row = [o_outline_view rowForItem:item];
if( i_row > -1 )
{
[o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_row] byExtendingSelection:NO];
[o_outline_view scrollRowToVisible: i_row];
}
}
- (CGFloat)outlineView:(NSOutlineView *)outlineView heightOfRowByItem:(id)item
{
if( [outlineView isExpandable:item] )
return 12.;
else
return 20.;
}
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
if( [outlineView isExpandable:item] )
return NO;
else
{
if( ![[o_playlist playingItem] isEqual: item] )
[o_playlist playSidebarItem:item];
return YES;
}
}
- (void)outlineViewItemDidExpand:(NSNotification *)notification
{
int i_row = -1;
i_row = [o_outline_view rowForItem:[o_playlist playingItem]];
if( i_row > -1 )
{
[o_outline_view selectRowIndexes:[NSIndexSet indexSetWithIndex:i_row] byExtendingSelection:NO];
[o_outline_view scrollRowToVisible: i_row];
}
}
@end
@implementation VLCSidebar (NSOutlineViewDataSource)
/* return the number of children for Obj-C pointer item */ /* DONE */
- (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
{
return [o_playlist outlineView:outlineView numberOfChildrenOfItem:item];
}
/* return the child at index for the Obj-C pointer item */ /* DONE */
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{
return [o_playlist outlineView:outlineView child:index ofItem:item];
}
/* is the item expandable */
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
{
return [o_playlist outlineView:outlineView isItemExpandable:item];
}
/* retrieve the string values for the cells */
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)o_tc byItem:(id)item
{
if( [outlineView isExpandable:item] )
return [[o_playlist outlineView:outlineView objectValueForTableColumn:o_tc byItem:item] uppercaseString];
else
return [o_playlist outlineView:outlineView objectValueForTableColumn:o_tc byItem:item];
}
@end
/*****************************************************************************
* sidestatusview.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2005-2008 the VideoLAN team
* $Id$
*
* Authors: Eric Dudiak <dudiak at gmail dot com>
* Colloquy <http://colloquy.info/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
@interface sidestatusview : NSView {
IBOutlet NSSplitView *splitView;
float _clickOffset;
BOOL _insideResizeArea;
}
@end
/*****************************************************************************
* sidestatusview.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2005-2008 the VideoLAN team
* $Id$
*
* Authors: Eric Dudiak <dudiak at gmail dot com>
* Colloquy <http://colloquy.info/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "sidestatusview.h"
@implementation sidestatusview
-(void)resetCursorRects
{
[super resetCursorRects];
if( ! splitView ) return;
NSImage *resizeImage = [NSImage imageNamed:@"sidebarResizeWidget"];
NSRect location;
location.size = [resizeImage size];
location.origin = NSMakePoint( NSWidth( [self bounds] ) - [resizeImage size].width, 0. );
[self addCursorRect:location cursor:[NSCursor resizeLeftRightCursor]];
}
- (void)drawRect:(NSRect)rect
{
NSImage *backgroundImage = [NSImage imageNamed:@"sidebarStatusAreaBackground"];
[backgroundImage setSize:NSMakeSize(NSWidth( [self bounds] ), [backgroundImage size].height)];
[backgroundImage setScalesWhenResized:YES];
[backgroundImage compositeToPoint:NSMakePoint( 0., 0. ) operation:NSCompositeCopy];
if( splitView ) {
NSImage *resizeImage = [NSImage imageNamed:@"sidebarResizeWidget"];
[resizeImage compositeToPoint:NSMakePoint( NSWidth( [self bounds] ) - [resizeImage size].width, 0. ) operation:NSCompositeCopy];
}
}
- (void)mouseDown:(NSEvent *)event
{
if( ! splitView ) return;
NSPoint clickLocation = [self convertPoint:[event locationInWindow] fromView:nil];
NSImage *resizeImage = [NSImage imageNamed:@"sidebarResizeWidget"];
NSRect location;
location.size = [resizeImage size];
location.origin = NSMakePoint( NSWidth( [self bounds] ) - [resizeImage size].width, 0. );
_insideResizeArea = ( NSPointInRect( clickLocation, location ) );
if( ! _insideResizeArea ) return;
clickLocation = [self convertPoint:[event locationInWindow] fromView:[self superview]];
_clickOffset = NSWidth( [[self superview] frame] ) - clickLocation.x;
}
- (void)mouseDragged:(NSEvent *)event
{
if( ! splitView || ! _insideResizeArea ) return;
[[NSNotificationCenter defaultCenter] postNotificationName:NSSplitViewWillResizeSubviewsNotification object:splitView];
NSPoint clickLocation = [self convertPoint:[event locationInWindow] fromView:[self superview]];
NSRect newFrame = [[self superview] frame];
newFrame.size.width = clickLocation.x + _clickOffset;
id delegate = [splitView delegate];
if( delegate && [delegate respondsToSelector:@selector( splitView:constrainSplitPosition:ofSubviewAt: )] ) {
float new = [delegate splitView:splitView constrainSplitPosition:newFrame.size.width ofSubviewAt:0];
newFrame.size.width = new;
}
if( delegate && [delegate respondsToSelector:@selector( splitView:constrainMinCoordinate:ofSubviewAt: )] ) {
float min = [delegate splitView:splitView constrainMinCoordinate:0. ofSubviewAt:0];
newFrame.size.width = MAX( min, newFrame.size.width );
}
if( delegate && [delegate respondsToSelector:@selector( splitView:constrainMaxCoordinate:ofSubviewAt: )] ) {
float max = [delegate splitView:splitView constrainMaxCoordinate:0. ofSubviewAt:0];
newFrame.size.width = MIN( max, newFrame.size.width );
}
if( delegate ) {
[delegate setMinSize:NSMakeSize(newFrame.size.width + 551., 114.)];
}
[[self superview] setFrame:newFrame];
[splitView adjustSubviews];
[[NSNotificationCenter defaultCenter] postNotificationName:NSSplitViewDidResizeSubviewsNotification object:splitView];
}
@end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment