libs-gui/Source/NSSplitViewItem.m

178 lines
3.8 KiB
Mathematica
Raw Normal View History

2020-07-20 05:02:22 +00:00
/* Implementation of class NSSplitViewItem
Copyright (C) 2020 Free Software Foundation, Inc.
By: Gregory John Casamento
Date: Mon 20 Jul 2020 12:56:20 AM EDT
This file is part of the GNUstep Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110 USA.
*/
2020-07-21 10:14:22 +00:00
#import <Foundation/NSArchiver.h>
2020-07-20 05:02:22 +00:00
#import "AppKit/NSSplitViewItem.h"
@implementation NSSplitViewItem
2020-07-20 09:33:40 +00:00
- (instancetype) initWithViewController: (NSViewController *)viewController
2020-07-20 08:47:19 +00:00
{
2020-07-20 09:33:40 +00:00
self = [super init];
if (self != nil)
{
ASSIGN(_viewController, viewController);
}
return self;
2020-07-20 08:47:19 +00:00
}
2020-07-20 05:02:22 +00:00
2020-07-20 09:33:40 +00:00
+ (instancetype) contentListWithViewController: (NSViewController *)viewController
2020-07-20 08:47:19 +00:00
{
2020-07-25 13:58:06 +00:00
return AUTORELEASE([[NSSplitViewItem alloc] initWithViewController: viewController]);
2020-07-20 08:47:19 +00:00
}
2020-07-20 09:33:40 +00:00
+ (instancetype) sidebarWithViewController: (NSViewController *)viewController
2020-07-20 08:47:19 +00:00
{
2020-07-25 13:58:06 +00:00
return AUTORELEASE([[NSSplitViewItem alloc] initWithViewController: viewController]);
2020-07-20 09:33:40 +00:00
}
+ (instancetype) splitViewItemWithViewController: (NSViewController *)viewController
{
2020-07-25 13:58:06 +00:00
return AUTORELEASE([[NSSplitViewItem alloc] initWithViewController: viewController]);
2020-07-20 08:47:19 +00:00
}
- (CGFloat) automaticMaximumThickness
{
return _automaticMaximumThickness;
2020-07-20 08:47:19 +00:00
}
- (void) setAutomaticMaximumThickness: (CGFloat)f
{
_automaticMaximumThickness = f;
2020-07-20 08:47:19 +00:00
}
- (CGFloat) preferredThicknessFraction
{
return _preferredThicknessFraction;
2020-07-20 08:47:19 +00:00
}
- (void) setPreferredThicknessFraction: (CGFloat)f
{
_preferredThicknessFraction = f;
2020-07-20 08:47:19 +00:00
}
- (CGFloat) minimumThickness
{
return _minimumThickness;
2020-07-20 08:47:19 +00:00
}
- (void) setMinimumThickness: (CGFloat)f
{
_minimumThickness = f;
2020-07-20 08:47:19 +00:00
}
- (CGFloat) maximumThickness
{
return _maximumThickness;
2020-07-20 08:47:19 +00:00
}
- (void) setMaximumThickness: (CGFloat)f
{
_maximumThickness = f;
2020-07-20 08:47:19 +00:00
}
- (/* NSLayoutPriority */ CGFloat) holdingPriority
{
return _holdingPriority;
2020-07-20 08:47:19 +00:00
}
2020-07-20 05:02:22 +00:00
2020-07-20 08:47:19 +00:00
- (void) setHoldingPriority: (/*NSLayoutPriority*/ CGFloat)hp
{
_holdingPriority = hp;
2020-07-20 08:47:19 +00:00
}
- (BOOL) canCollapse
{
return _canCollapse;
2020-07-20 08:47:19 +00:00
}
- (NSSplitViewItemCollapseBehavior) collapseBehavior
{
return _collapseBehavior;
2020-07-20 08:47:19 +00:00
}
- (BOOL) isSpringLoaded
{
return _springLoaded;
2020-07-20 08:47:19 +00:00
}
- (void) setSpringLoaded: (BOOL)flag
{
_springLoaded = flag;
2020-07-20 08:47:19 +00:00
}
- (BOOL) allowsFullHeightLayout
{
return _allowsFullHeightLayout;
2020-07-20 08:47:19 +00:00
}
- (void) setAllowsFullHeightLayout: (BOOL)flag
{
_allowsFullHeightLayout = flag;
2020-07-20 08:47:19 +00:00
}
- (NSTitlebarSeparatorStyle) titlebarSeparatorStyle
{
return _titlebarSeparatorStyle;
2020-07-20 08:47:19 +00:00
}
- (void) setTitlebarSeparatorStyle: (NSTitlebarSeparatorStyle)style
{
_titlebarSeparatorStyle = style;
2020-07-20 08:47:19 +00:00
}
- (NSViewController *) viewController
{
return _viewController;
}
2020-07-20 09:33:40 +00:00
2020-07-22 06:19:35 +00:00
- (void) setViewController: (NSViewController *)vc
{
_viewController = vc;
}
2020-07-20 09:33:40 +00:00
// NSCoding
- (instancetype) initWithCoder: (NSCoder *)coder
{
2020-07-21 10:14:22 +00:00
self = [super init];
if ([coder allowsKeyedCoding])
{
if ([coder containsValueForKey: @"NSSplitViewItemViewController"])
{
_viewController = [coder decodeObjectForKey: @"NSSplitViewItemViewController"];
}
}
2020-07-20 09:33:40 +00:00
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
2020-07-21 10:14:22 +00:00
if ([coder allowsKeyedCoding])
{
[coder encodeObject: _viewController
forKey: @"NSSplitViewItemViewController"];
}
2020-07-20 09:33:40 +00:00
}
2020-07-20 08:47:19 +00:00
@end