Add skeleton code for NSPathCell

This commit is contained in:
Gregory John Casamento 2020-04-27 01:33:49 -04:00
parent f07ed1351d
commit 699bffe59c
3 changed files with 231 additions and 7 deletions

View file

@ -33,7 +33,96 @@
extern "C" {
#endif
Class pathComponentCellClass;
enum {
NSPathStyleStandard,
NSPathStyleNavigationBar, // deprecated
NSPathStylePopUp
};
typedef NSUInteger NSPathStyle;
@protocol NSPathCellDelegate;
@class NSEvent, NSView, NSArray, NSString, NSAttributeString, NSColor, NSPathComponentCell, NSOpenPanel, NSURL;
@interface NSPathCell : NSActionCell
{
NSPathStyle _pathStyle;
NSColor *_backgroundColor;
NSArray *_pathItems;
NSString *_placeholderString;
NSAttributedString *_placeholderAttributedString;
NSArray *_allowedTypes;
id<NSPathCellDelegate> _delegate;
NSURL *_url;
SEL _doubleAction;
NSArray *_pathComponentCells;
NSPathComponentCell *_clickedPathComponentCell;
id _objectValue;
NSControlSize _controlSize;
}
- (void)mouseEntered:(NSEvent *)event
withFrame:(NSRect)frame
inView:(NSView *)view;
- (void)mouseExited:(NSEvent *)event
withFrame:(NSRect)frame
inView:(NSView *)view;
- (void) setAllowedTypes: (NSArray *)types;
- (NSArray *) allowedTypes;
- (NSPathStyle) pathStyle;
- (void) setPathStyle: (NSPathStyle)pathStyle;
- (void) setControlSize: (NSControlSize)size;
- (void) setObjectValue: (id)obj;
- (NSAttributedString *) placeholderAttributedString;
- (void) setPlaceholderAttributedString: (NSAttributedString *)string;
- (NSString *) placeholderString;
- (void) setPlaceholderString: (NSString *)string;
- (NSColor *) backgroundColor;
- (void) setBackgroundColor: (NSColor *)color;
+ (Class) pathComponentCellClass;
+ (void) setPathComponentCellClass: (Class)clz;
- (NSRect)rectOfPathComponentCell:(NSPathComponentCell *)cell
withFrame:(NSRect)frame
inView:(NSView *)view;
- (NSPathComponentCell *)pathComponentCellAtPoint:(NSPoint)point
withFrame:(NSRect)frame
inView:(NSView *)view;
- (NSPathComponentCell *) clickedPathComponentCell;
- (NSArray *) pathComponentCells;
- (void) setPathComponentCells: (NSArray *)cells;
- (SEL) doubleAction;
- (void) setDoubleAction: (SEL)action;
- (NSURL *) URL;
- (void) setURL: (NSURL *)url;
- (id<NSPathCellDelegate>) delegate;
- (void) setDelegate: (id<NSPathCellDelegate>)delegate;
@end
@protocol NSPathCellDelegate
- (void)pathCell:(NSPathCell *)pathCell
willDisplayOpenPanel:(NSOpenPanel *)openPanel;
- (void)pathCell:(NSPathCell *)pathCell
willPopUpMenu:(NSMenu *)menu;
@end

View file

@ -27,6 +27,7 @@
#import <AppKit/NSControl.h>
#import <AppKit/NSDragging.h>
#import <AppKit/NSPathCell.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
@ -34,13 +35,6 @@
extern "C" {
#endif
enum {
NSPathStyleStandard,
NSPathStyleNavigationBar, // deprecated
NSPathStylePopUp
};
typedef NSUInteger NSPathStyle;
@protocol NSPathControlDelegate;
@class NSColor, NSPathComponentCell, NSArray, NSURL, NSAttributedString, NSString,

View file

@ -26,5 +26,146 @@
@implementation NSPathCell
- (void)mouseEntered:(NSEvent *)event
withFrame:(NSRect)frame
inView:(NSView *)view
{
}
- (void)mouseExited:(NSEvent *)event
withFrame:(NSRect)frame
inView:(NSView *)view
{
}
- (void) setAllowedTypes: (NSArray *)types
{
ASSIGNCOPY(_allowedTypes, types);
}
- (NSArray *) allowedTypes
{
return _allowedTypes;
}
- (NSPathStyle) pathStyle
{
return _pathStyle;
}
- (void) setPathStyle: (NSPathStyle)pathStyle
{
_pathStyle = pathStyle;
}
- (void) setControlSize: (NSControlSize)size
{
_controlSize = size;
}
- (void) setObjectValue: (id)obj
{
ASSIGN(_objectValue, obj);
}
- (NSAttributedString *) placeholderAttributedString
{
return _placeholderAttributedString;
}
- (void) setPlaceholderAttributedString: (NSAttributedString *)string
{
ASSIGNCOPY(_placeholderAttributedString, string);
}
- (NSString *) placeholderString
{
return _placeholderString;
}
- (void) setPlaceholderString: (NSString *)string
{
ASSIGNCOPY(_placeholderString, string);
}
- (NSColor *) backgroundColor
{
return _backgroundColor;
}
- (void) setBackgroundColor: (NSColor *)color
{
ASSIGNCOPY(_backgroundColor, color);
}
+ (Class) pathComponentCellClass
{
return pathComponentCellClass;
}
+ (void) setPathComponentCellClass: (Class)clz
{
pathComponentCellClass = clz;
}
- (NSRect)rectOfPathComponentCell:(NSPathComponentCell *)cell
withFrame:(NSRect)frame
inView:(NSView *)view
{
return NSZeroRect;
}
- (NSPathComponentCell *)pathComponentCellAtPoint:(NSPoint)point
withFrame:(NSRect)frame
inView:(NSView *)view
{
return nil;
}
- (NSPathComponentCell *) clickedPathComponentCell
{
return nil;
}
- (NSArray *) pathComponentCells
{
return _pathComponentCells;
}
- (void) setPathComponentCells: (NSArray *)cells
{
ASSIGNCOPY(_pathComponentCells, cells);
}
- (SEL) doubleAction
{
return _doubleAction;
}
- (void) setDoubleAction: (SEL)action
{
_doubleAction = action;
}
- (NSURL *) URL
{
return _url;
}
- (void) setURL: (NSURL *)url
{
ASSIGNCOPY(_url, url);
}
- (id<NSPathCellDelegate>) delegate
{
return _delegate;
}
- (void) setDelegate: (id<NSPathCellDelegate>)delegate
{
_delegate = delegate;
}
@end