Initial skeletal implementation of NSPathControl

This commit is contained in:
Gregory John Casamento 2020-04-26 20:57:16 -04:00
parent a0aa55e1f1
commit c49fcc0e0b
3 changed files with 200 additions and 1 deletions

View file

@ -26,6 +26,7 @@
#define _NSPathControl_h_GNUSTEP_GUI_INCLUDE
#import <AppKit/NSControl.h>
#import <AppKit/NSDragging.h>
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
@ -33,7 +34,90 @@
extern "C" {
#endif
enum {
NSPathStyleStandard,
NSPathStyleNavigationBar, // deprecated
NSPathStylePopUp
};
typedef NSUInteger NSPathStyle;
@protocol NSPathControlDelegate;
@class NSColor, NSPathComponentCell, NSArray, NSURL, NSAttributedString, NSString,
NSMenu, NSPasteboard, NSOpenPanel, NSPathControlItem;
@interface NSPathControl : NSControl
{
NSPathStyle _pathStyle;
NSColor *_backgroundColor;
NSArray *_pathItems;
NSString *_placeholderString;
NSAttributedString *_placeholderAttributedString;
NSArray *_allowedTypes;
id<NSPathControlDelegate> _delegate;
NSURL *_url;
SEL _doubleAction;
}
- (void) setPathStyle: (NSPathStyle)style;
- (NSPathStyle) pathStyle;
- (NSPathComponentCell *) clickedPathComponentCell;
- (NSArray *) pathComponentCells;
- (void) setPathComponentCells: (NSArray *)cells;
- (SEL) doubleAction;
- (void) setDoubleAction: (SEL)doubleAction;
- (NSURL *) URL;
- (void) setURL: (NSURL *)url;
- (id<NSPathControlDelegate>) delegate;
- (void) setDelegate: (id<NSPathControlDelegate>) delegate;
- (void) setDraggingSourceOperationMask: (NSDragOperation)mask
forLocal: (BOOL)local;
- (NSMenu *) menu;
- (void) setMenu: (NSMenu *)menu;
- (NSArray *) allowedTypes;
- (void) setAllowedTypes: (NSArray *)allowedTypes;
- (NSPathControlItem *) clickedPathItem;
- (NSArray *) pathItems;
- (void) setPathItems: (NSArray *)items;
- (NSAttributedString *) placeholderAttributedString;
- (void) setPlaceholderAttributedString: (NSAttributedString *)string;
- (NSString *) placeholderString;
- (void) setPlaceholderString: (NSString *)string;
@end
@protocol NSPathControlDelegate
- (BOOL)pathControl:(NSPathControl *)pathControl
shouldDragPathComponentCell:(NSPathComponentCell *)pathComponentCell
withPasteboard:(NSPasteboard *)pasteboard;
- (NSDragOperation)pathControl:(NSPathControl *)pathControl
validateDrop:(id<NSDraggingInfo>)info;
- (BOOL)pathControl:(NSPathControl *)pathControl
acceptDrop:(id<NSDraggingInfo>)info;
- (void)pathControl:(NSPathControl *)pathControl
willDisplayOpenPanel:(NSOpenPanel *)openPanel;
- (void)pathControl:(NSPathControl *)pathControl
willPopUpMenu:(NSMenu *)menu;
- (BOOL)pathControl:(NSPathControl *)pathControl
shouldDragItem:(NSPathControlItem *)pathItem
withPasteboard:(NSPasteboard *)pasteboard;
@end

View file

@ -33,12 +33,14 @@
extern "C" {
#endif
@interface NSPathControlItem : NSObject
@end
#if defined(__cplusplus)
}
#endif
#endif /* GS_API_MACOSX */

View file

@ -26,5 +26,118 @@
@implementation NSPathControl
- (void) setPathStyle: (NSPathStyle)style
{
_pathStyle = style;
}
- (NSPathStyle) pathStyle
{
return _pathStyle;
}
- (NSPathComponentCell *) clickedPathComponentCell
{
return nil;
}
- (NSArray *) pathComponentCells
{
return nil;
}
- (void) setPathComponentCells: (NSArray *)cells
{
}
- (SEL) doubleAction;
{
return _doubleAction;
}
- (void) setDoubleAction: (SEL)doubleAction
{
_doubleAction = doubleAction;
}
- (NSURL *) URL
{
return _url;
}
- (void) setURL: (NSURL *)url
{
ASSIGNCOPY(_url, url);
}
- (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;
{
return _allowedTypes;
}
- (void) setAllowedTypes: (NSArray *)allowedTypes
{
ASSIGNCOPY(_allowedTypes, allowedTypes);
}
- (NSPathControlItem *) clickedPathItem
{
return nil;
}
- (NSArray *) pathItems
{
return _pathItems;
}
- (void) setPathItems: (NSArray *)items
{
ASSIGNCOPY(_pathItems, items);
}
- (NSAttributedString *) placeholderAttributedString
{
return _placeholderAttributedString;
}
- (void) setPlaceholderAttributedString: (NSAttributedString *)string
{
ASSIGNCOPY(_placeholderAttributedString, string);
}
- (NSString *) placeholderString
{
return _placeholderString;
}
- (void) setPlaceholderString: (NSString *)string
{
ASSIGNCOPY(_placeholderString, string);
}
@end