2020-04-23 04:43:15 +00:00
|
|
|
/* Implementation of class NSPathControl
|
|
|
|
Copyright (C) 2020 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
By: Gregory John Casamento
|
|
|
|
Date: Wed Apr 22 18:19:40 EDT 2020
|
|
|
|
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#import "AppKit/NSPathControl.h"
|
2020-04-27 03:42:44 +00:00
|
|
|
#import "AppKit/NSPathCell.h"
|
2020-04-27 18:37:22 +00:00
|
|
|
#import "AppKit/NSGraphics.h"
|
2020-04-23 04:43:15 +00:00
|
|
|
|
|
|
|
@implementation NSPathControl
|
|
|
|
|
2020-04-27 03:42:44 +00:00
|
|
|
+ (void) initialize
|
|
|
|
{
|
|
|
|
if (self == [NSPathControl class])
|
|
|
|
{
|
|
|
|
[self setVersion: 1.0];
|
|
|
|
[self setCellClass: [NSPathCell class]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-27 00:57:16 +00:00
|
|
|
- (void) setPathStyle: (NSPathStyle)style
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setPathStyle: style];
|
2020-04-27 18:37:22 +00:00
|
|
|
[self setNeedsDisplay];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSPathStyle) pathStyle
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell pathStyle];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSPathComponentCell *) clickedPathComponentCell
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell clickedPathComponentCell];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) pathComponentCells
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell pathComponentCells];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setPathComponentCells: (NSArray *)cells
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setPathComponentCells: cells];
|
2020-04-27 18:37:22 +00:00
|
|
|
[self setNeedsDisplay];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (SEL) doubleAction;
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell doubleAction];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDoubleAction: (SEL)doubleAction
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setDoubleAction: doubleAction];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSURL *) URL
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell URL];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setURL: (NSURL *)url
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setURL: url];
|
2020-04-27 18:37:22 +00:00
|
|
|
[self setNeedsDisplay];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (id<NSPathControlDelegate>) delegate
|
|
|
|
{
|
|
|
|
return _delegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDelegate: (id<NSPathControlDelegate>) delegate
|
|
|
|
{
|
|
|
|
_delegate = delegate;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setDraggingSourceOperationMask: (NSDragOperation)mask
|
|
|
|
forLocal: (BOOL)local
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSMenu *) menu
|
|
|
|
{
|
|
|
|
return [super menu];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setMenu: (NSMenu *)menu
|
|
|
|
{
|
|
|
|
[super setMenu: menu];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) allowedTypes;
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell allowedTypes];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setAllowedTypes: (NSArray *)allowedTypes
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setAllowedTypes: allowedTypes];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSPathControlItem *) clickedPathItem
|
|
|
|
{
|
|
|
|
return nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) pathItems
|
|
|
|
{
|
|
|
|
return _pathItems;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setPathItems: (NSArray *)items
|
|
|
|
{
|
|
|
|
ASSIGNCOPY(_pathItems, items);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSAttributedString *) placeholderAttributedString
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell placeholderAttributedString];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setPlaceholderAttributedString: (NSAttributedString *)string
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setPlaceholderAttributedString: string];
|
2020-04-27 18:37:22 +00:00
|
|
|
[self setNeedsDisplay];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSString *) placeholderString
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
return [_cell placeholderString];
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setPlaceholderString: (NSString *)string
|
|
|
|
{
|
2020-04-27 09:34:02 +00:00
|
|
|
[_cell setPlaceholderString: string];
|
2020-04-27 18:37:22 +00:00
|
|
|
[self setNeedsDisplay];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSColor *) backgroundColor
|
|
|
|
{
|
|
|
|
return _backgroundColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) setBackgroundColor: (NSColor *)color
|
|
|
|
{
|
|
|
|
ASSIGN(_backgroundColor, color);
|
|
|
|
[self setNeedsDisplay];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) drawRect: (NSRect)frame
|
|
|
|
{
|
|
|
|
[super drawRect: frame];
|
|
|
|
[_backgroundColor set];
|
|
|
|
NSRectFill(frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
- (instancetype) initWithCoder: (NSKeyedUnarchiver *)coder
|
|
|
|
{
|
|
|
|
self = [super initWithCoder: coder];
|
|
|
|
if (self != nil)
|
|
|
|
{
|
|
|
|
if ([coder allowsKeyedCoding])
|
|
|
|
{
|
|
|
|
_backgroundColor = [NSColor windowBackgroundColor];
|
|
|
|
if ([coder containsValueForKey: @"NSPathComponentCells"])
|
|
|
|
{
|
|
|
|
[self setPathComponentCells: [coder decodeObjectForKey: @"NSPathComponentCells"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ([coder containsValueForKey: @"NSPathStyle"])
|
|
|
|
{
|
|
|
|
[self setPathStyle: [coder decodeIntegerForKey: @"NSPathStyle"]];
|
|
|
|
}
|
|
|
|
|
|
|
|
if ([coder containsValueForKey: @"NSBackgroundColor"])
|
|
|
|
{
|
|
|
|
[self setBackgroundColor: [coder decodeObjectForKey: @"NSBackgroundColor"]];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return self;
|
2020-04-27 00:57:16 +00:00
|
|
|
}
|
2020-04-23 04:43:15 +00:00
|
|
|
@end
|
|
|
|
|