More fixes and stubs for Xcode

This commit is contained in:
Ariel Abreu 2023-10-07 11:00:59 -04:00
parent ac4514c596
commit d7fc1ce4b7
No known key found for this signature in database
GPG Key ID: 5B88AAAF4280706F
19 changed files with 310 additions and 1 deletions

View File

@ -448,6 +448,7 @@ set(AppKit_sources
NSDataAsset.m
NSSwitch.m
NSTextFinder.m
NSScrubber.m
)
set_source_files_properties(${AppKit_sources} LANGUAGE C)

View File

@ -1525,6 +1525,10 @@ NSApplication *NSApp = nil;
[self unhide: nil];
}
+ (void) load {
// Xcode expects this method to exist for some reason?
}
@end
int NSApplicationMain(int argc, const char *argv[]) {

View File

@ -123,4 +123,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[_valueProxy revertToInitialValues];
}
+ (void) awakeAfterUsingCoder: (NSCoder *) coder {
NSUnimplementedMethod();
}
@end

View File

@ -61,7 +61,10 @@ static NSDocumentController *shared = nil;
+ sharedDocumentController {
if (shared == nil) {
shared = [[NSDocumentController alloc] init];
// NOTE: it is important that this is `self` and not `NSDocumentController` directly;
// Xcode subclasses NSDocumentController and invokes this class method on said subclass,
// expecting the shared controller to be allocated as that subclass instead of `NSDocumentController`.
shared = [[self alloc] init];
[shared _updateRecentDocumentsMenu];
}

View File

@ -1,4 +1,5 @@
#import <AppKit/NSPredicateEditor.h>
#import <Foundation/NSRaise.h>
@implementation NSPredicateEditor
@ -12,4 +13,14 @@
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
- (instancetype) initWithCoder: (NSCoder *) coder {
NSUnimplementedMethod();
return self;
}
- (BOOL) _forceUseDelegate {
NSUnimplementedMethod();
return NO;
}
@end

59
AppKit/NSScrubber.m Normal file
View File

@ -0,0 +1,59 @@
#import <AppKit/NSScrubber.h>
@implementation NSScrubber
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSScrubberFlowLayout
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSScrubberLayout
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSScrubberProportionalLayout
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end

View File

@ -19,6 +19,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSSlider.h>
@interface NSSliderAccessory : NSObject
@end
@interface NSSliderAccessoryBehavior : NSObject
@end
@implementation NSSlider
+ (Class) cellClass {
@ -139,3 +145,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
@end
@implementation NSSliderAccessory
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSSliderAccessoryBehavior
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end

View File

@ -32,6 +32,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#define PIXELINSET 8
#define TICKHEIGHT 8
@interface NSColorScaleSliderCell : NSSliderCell
@end
@implementation NSSliderCell
- (void) encodeWithCoder: (NSCoder *) coder {
@ -722,3 +725,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
}
@end
@implementation NSColorScaleSliderCell
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end

View File

@ -28,6 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSSplitView.h>
#import <AppKit/NSWindow.h>
#import <Foundation/NSKeyedArchiver.h>
#import <Foundation/NSRaise.h>
NSString *const NSSplitViewDidResizeSubviewsNotification =
@"NSSplitViewDidResizeSubviewsNotification";
@ -651,4 +652,13 @@ static CGFloat constrainTo(CGFloat value, CGFloat min, CGFloat max) {
[self setNeedsDisplay: YES];
}
- (void) _autosaveSubviewLayoutIfNecessary {
NSUnimplementedMethod();
}
- (BOOL) isOpaque {
NSUnimplementedMethod();
return YES;
}
@end

View File

@ -2078,6 +2078,14 @@ static CGFloat rowHeightAtIndex(NSTableView *self, NSInteger index) {
[self _moveUp: NO extend: YES];
}
- (void)_writePersistentTableColumns {
NSUnimplementedMethod();
}
- (void)_readPersistentTableColumns {
NSUnimplementedMethod();
}
@end
@implementation NSTableView (Bindings)

View File

@ -3953,4 +3953,9 @@ NSString *const NSAllRomanInputSourcesLocaleIdentifier =
}
}
- (id) replacementObjectForKeyedArchiver {
NSUnimplementedMethod();
return self;
}
@end

View File

@ -649,6 +649,11 @@ static BOOL isStandardItemIdentifier(NSString *identifier) {
object: self];
}
+ (BOOL) _shouldIgnoreItemIdentifier: (NSString *) identifier {
NSLog(@"STUB: %s", __PRETTY_FUNCTION__);
return NO;
}
@end
@implementation NSToolbar (NSToolbarCustomization)

View File

@ -18,6 +18,15 @@
*/
#import <AppKit/NSTouchBar.h>
#import <AppKit/NSView.h>
// i'm assuming this inherits from NSView (TODO: check this assumption)
@interface NSTouchBarView : NSView
@end
// again, i'm assuming this inherits from NSTouchBarView and this should be checked later
@interface NSTouchBarItemContainerView : NSTouchBarView
@end
@implementation NSTouchBar
@ -32,3 +41,31 @@
}
@end
@implementation NSTouchBarView
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSTouchBarItemContainerView
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end

View File

@ -27,6 +27,17 @@ NSTouchBarItemIdentifier const NSTouchBarItemIdentifierFlexibleSpace =
@"NSTouchBarItemIdentifierFlexibleSpace";
NSTouchBarItemIdentifier const NSTouchBarItemIdentifierOtherItemsProxy =
@"NSTouchBarItemIdentifierOtherItemsProxy";
NSTouchBarItemIdentifier const NSTouchBarItemIdentifierCharacterPicker =
@"NSTouchBarItemIdentifierCharacterPicker";
@interface NSColorPickerTouchBarItem : NSTouchBarItem
@end
@interface NSSharingServicePickerTouchBarItem : NSTouchBarItem
@end
@interface NSSliderTouchBarItem : NSTouchBarItem
@end
@implementation NSTouchBarItem
@ -41,3 +52,45 @@ NSTouchBarItemIdentifier const NSTouchBarItemIdentifierOtherItemsProxy =
}
@end
@implementation NSColorPickerTouchBarItem
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSSharingServicePickerTouchBarItem
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end
@implementation NSSliderTouchBarItem
- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
return [NSMethodSignature signatureWithObjCTypes: "v@:"];
}
- (void)forwardInvocation:(NSInvocation *)anInvocation
{
NSLog(@"Stub called: %@ in %@", NSStringFromSelector([anInvocation selector]), [self class]);
}
@end

View File

@ -46,6 +46,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <QuartzCore/CALayerContext.h>
#import <QuartzCore/CATransaction.h>
@class IBMetricsTable;
NSString *const NSViewFrameDidChangeNotification =
@"NSViewFrameDidChangeNotification";
NSString *const NSViewBoundsDidChangeNotification =
@ -2830,4 +2832,9 @@ static NSView *viewBeingPrinted = nil;
[self display];
}
+ (IBMetricsTable *) ibLayoutMetrics {
NSUnimplementedMethod();
return nil;
}
@end

View File

@ -140,6 +140,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <AppKit/NSScreen.h>
#import <AppKit/NSScrollView.h>
#import <AppKit/NSScroller.h>
#import <AppKit/NSScrubber.h>
#import <AppKit/NSSearchField.h>
#import <AppKit/NSSearchFieldCell.h>
#import <AppKit/NSSecureTextField.h>

View File

@ -0,0 +1,32 @@
/*
* This file is part of Darling.
*
* Copyright (C) 2023 Darling Developers
*
* Darling 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 3 of the License, or
* (at your option) any later version.
*
* Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>.
*/
#import <AppKit/NSView.h>
@interface NSScrubber : NSView
@end
@interface NSScrubberLayout : NSObject
@end
@interface NSScrubberFlowLayout : NSScrubberLayout
@end
@interface NSScrubberProportionalLayout : NSScrubberLayout
@end

View File

@ -21,6 +21,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#import <Foundation/NSException.h>
#import <Foundation/NSKeyedArchiver.h>
#import <Foundation/NSString.h>
#import <Foundation/NSRaise.h>
@implementation NSClassSwapper
@ -65,4 +66,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
[super dealloc];
}
- (void) encodeWithCoder: (NSCoder *) coder {
NSUnimplementedMethod();
}
@end

View File

@ -111,4 +111,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
return result;
}
- (Class) windowClassForNibInstantiate {
// this method requires that the window class is a subclass of NSWindow; otherwise, it returns nil.
Class theClass = NSClassFromString(_windowClass);
if ([theClass isSubclassOfClass: [NSWindow class]]) {
return theClass;
}
return nil;
}
- (void) setStyleMask: (NSUInteger) mask {
_windowStyleMask = mask;
}
@end