mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-23 04:00:00 +00:00
Add Some Missing APIs
Fix Syntax Fix Memory Leak Fix Block Syntax You would think this would be consistent. Co-authored-by: Sergey Bugaev <bugaevc@gmail.com>
This commit is contained in:
parent
6453711d11
commit
03024249b6
@ -19,7 +19,6 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/NSAlert.h>
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <AppKit/NSAttributedString.h>
|
||||
#import <AppKit/NSButton.h>
|
||||
#import <AppKit/NSFont.h>
|
||||
@ -31,8 +30,44 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSStringDrawer.h>
|
||||
#import <AppKit/NSTextField.h>
|
||||
#import <AppKit/NSWindow-Private.h>
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <Foundation/NSDictionary.h>
|
||||
|
||||
@interface _NSAlertCompletionHandler : NSObject {
|
||||
void (^completionHandler)(NSModalResponse returnCode);
|
||||
}
|
||||
|
||||
- (id) initWithBlock: (void (^)(NSModalResponse returnCode)) handler;
|
||||
|
||||
- (void) alertDidEnd: (NSAlert *) alert
|
||||
returnCode: (NSModalResponse) returnCode
|
||||
contextInfo: (void *) contextInfo;
|
||||
|
||||
@end
|
||||
|
||||
@implementation _NSAlertCompletionHandler
|
||||
|
||||
- (id) initWithBlock: (void (^)(NSModalResponse returnCode)) handler {
|
||||
self = [super init];
|
||||
completionHandler = [handler copy];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) alertDidEnd: (NSAlert *) alert
|
||||
returnCode: (NSModalResponse) returnCode
|
||||
contextInfo: (void *) contextInfo
|
||||
{
|
||||
completionHandler(returnCode);
|
||||
[self release];
|
||||
}
|
||||
|
||||
- (void) dealloc {
|
||||
[completionHandler release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation NSAlert
|
||||
|
||||
/*
|
||||
@ -537,6 +572,17 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
contextInfo: info];
|
||||
}
|
||||
|
||||
- (void) beginSheetModalForWindow: (NSWindow *) sheetWindow
|
||||
completionHandler:
|
||||
(void (^)(NSModalResponse returnCode)) handler
|
||||
{
|
||||
[self beginSheetModalForWindow: sheetWindow
|
||||
modalDelegate: [[_NSAlertCompletionHandler alloc]
|
||||
initWithBlock: handler]
|
||||
didEndSelector: @selector(sheetDidEnd:returnCode:contextInfo:)
|
||||
contextInfo: 0];
|
||||
}
|
||||
|
||||
- (NSInteger) runModal {
|
||||
[_window setLevel: NSModalPanelWindowLevel];
|
||||
[_window setStyleMask: NSTitledWindowMask];
|
||||
|
@ -152,6 +152,14 @@ static NSSavePanel *_newPanel = nil;
|
||||
_directory = directory;
|
||||
}
|
||||
|
||||
- (void) setDirectoryURL: (NSURL *) url {
|
||||
[self setDirectory: [url path]];
|
||||
}
|
||||
|
||||
- (NSURL *) directoryURL {
|
||||
return [NSURL fileURLWithPath: [self directory]];
|
||||
}
|
||||
|
||||
- (void) setRequiredFileType: (NSString *) type {
|
||||
@synchronized(self) {
|
||||
type = [type copy];
|
||||
|
@ -681,51 +681,51 @@ enum bidi_state // possible states
|
||||
|
||||
static int stateWeak[][10] = {
|
||||
// N, L, R, AN, EN, AL,NSM, CS, ES, ET,
|
||||
/*xa*/ ao, xl, xr, cn, cn, xa,
|
||||
xa, ao, ao, ao, /* arabic letter */
|
||||
/*xr*/ ro, xl, xr, ra, re, xa,
|
||||
xr, ro, ro, rt, /* right letter */
|
||||
/*xl*/ lo, xl, xr, la, le, xa,
|
||||
xl, lo, lo, lt, /* left letter */
|
||||
/*xa*/ ao, xl, xr, cn, cn,
|
||||
xa, xa, ao, ao, ao, /* arabic letter */
|
||||
/*xr*/ ro, xl, xr, ra, re,
|
||||
xa, xr, ro, ro, rt, /* right letter */
|
||||
/*xl*/ lo, xl, xr, la, le,
|
||||
xa, xl, lo, lo, lt, /* left letter */
|
||||
|
||||
/*ao*/ ao, xl, xr, cn, cn, xa,
|
||||
ao, ao, ao, ao, /* arabic lett. foll by ON*/
|
||||
/*ro*/ ro, xl, xr, ra, re, xa,
|
||||
ro, ro, ro, rt, /* right lett. foll by ON */
|
||||
/*lo*/ lo, xl, xr, la, le, xa,
|
||||
lo, lo, lo, lt, /* left lett. foll by ON */
|
||||
/*ao*/ ao, xl, xr, cn, cn,
|
||||
xa, ao, ao, ao, ao, /* arabic lett. foll by ON*/
|
||||
/*ro*/ ro, xl, xr, ra, re,
|
||||
xa, ro, ro, ro, rt, /* right lett. foll by ON */
|
||||
/*lo*/ lo, xl, xr, la, le,
|
||||
xa, lo, lo, lo, lt, /* left lett. foll by ON */
|
||||
|
||||
/*rt*/ ro, xl, xr, ra, re, xa,
|
||||
rt, ro, ro, rt, /* ET following R */
|
||||
/*lt*/ lo, xl, xr, la, le, xa,
|
||||
lt, lo, lo, lt, /* ET following L */
|
||||
/*rt*/ ro, xl, xr, ra, re,
|
||||
xa, rt, ro, ro, rt, /* ET following R */
|
||||
/*lt*/ lo, xl, xr, la, le,
|
||||
xa, lt, lo, lo, lt, /* ET following L */
|
||||
|
||||
/*cn*/ ao, xl, xr, cn, cn, xa,
|
||||
cn, ac, ao, ao, /* EN, AN following AL */
|
||||
/*ra*/ ro, xl, xr, ra, re, xa,
|
||||
ra, rc, ro, rt, /* arabic number foll R */
|
||||
/*re*/ ro, xl, xr, ra, re, xa,
|
||||
re, rs, rs, ret, /* european number foll R */
|
||||
/*la*/ lo, xl, xr, la, le, xa,
|
||||
la, lc, lo, lt, /* arabic number foll L */
|
||||
/*le*/ lo, xl, xr, la, le, xa,
|
||||
le, ls, ls, let, /* european number foll L */
|
||||
/*cn*/ ao, xl, xr, cn, cn,
|
||||
xa, cn, ac, ao, ao, /* EN, AN following AL */
|
||||
/*ra*/ ro, xl, xr, ra, re,
|
||||
xa, ra, rc, ro, rt, /* arabic number foll R */
|
||||
/*re*/ ro, xl, xr, ra, re,
|
||||
xa, re, rs, rs, ret, /* european number foll R */
|
||||
/*la*/ lo, xl, xr, la, le,
|
||||
xa, la, lc, lo, lt, /* arabic number foll L */
|
||||
/*le*/ lo, xl, xr, la, le,
|
||||
xa, le, ls, ls, let, /* european number foll L */
|
||||
|
||||
/*ac*/ ao, xl, xr, cn, cn, xa,
|
||||
ao, ao, ao, ao, /* CS following cn */
|
||||
/*rc*/ ro, xl, xr, ra, re, xa,
|
||||
ro, ro, ro, rt, /* CS following ra */
|
||||
/*rs*/ ro, xl, xr, ra, re, xa,
|
||||
ro, ro, ro, rt, /* CS,ES following re */
|
||||
/*lc*/ lo, xl, xr, la, le, xa,
|
||||
lo, lo, lo, lt, /* CS following la */
|
||||
/*ls*/ lo, xl, xr, la, le, xa,
|
||||
lo, lo, lo, lt, /* CS,ES following le */
|
||||
/*ac*/ ao, xl, xr, cn, cn,
|
||||
xa, ao, ao, ao, ao, /* CS following cn */
|
||||
/*rc*/ ro, xl, xr, ra, re,
|
||||
xa, ro, ro, ro, rt, /* CS following ra */
|
||||
/*rs*/ ro, xl, xr, ra, re,
|
||||
xa, ro, ro, ro, rt, /* CS,ES following re */
|
||||
/*lc*/ lo, xl, xr, la, le,
|
||||
xa, lo, lo, lo, lt, /* CS following la */
|
||||
/*ls*/ lo, xl, xr, la, le,
|
||||
xa, lo, lo, lo, lt, /* CS,ES following le */
|
||||
|
||||
/*ret*/ ro, xl, xr, ra, re, xa,
|
||||
ret, ro, ro, ret, /* ET following re */
|
||||
/*let*/ lo, xl, xr, la, le, xa,
|
||||
let, lo, lo, let, /* ET following le */
|
||||
/*ret*/ ro, xl, xr, ra, re,
|
||||
xa, ret, ro, ro, ret, /* ET following re */
|
||||
/*let*/ lo, xl, xr, la, le,
|
||||
xa, let, lo, lo, let, /* ET following le */
|
||||
|
||||
};
|
||||
|
||||
|
@ -474,11 +474,11 @@ static NSData *makeWindowIcon() {
|
||||
}
|
||||
|
||||
- (void) showWindowForAppActivation: (O2Rect) frame {
|
||||
NSUnimplementedMethod();
|
||||
[self showWindowWithoutActivation];
|
||||
}
|
||||
|
||||
- (void) hideWindowForAppDeactivation: (O2Rect) frame {
|
||||
NSUnimplementedMethod();
|
||||
/* Ignored */
|
||||
}
|
||||
|
||||
- (void) hideWindow {
|
||||
|
@ -33,6 +33,8 @@ enum {
|
||||
NSAlertThirdButtonReturn = 1002,
|
||||
};
|
||||
|
||||
typedef NSInteger NSModalResponse;
|
||||
|
||||
@interface NSAlert : NSObject {
|
||||
id _delegate;
|
||||
NSAlertStyle _style;
|
||||
@ -90,6 +92,9 @@ enum {
|
||||
modalDelegate: delegate
|
||||
didEndSelector: (SEL) selector
|
||||
contextInfo: (void *) info;
|
||||
- (void) beginSheetModalForWindow: (NSWindow *) sheetWindow
|
||||
completionHandler:
|
||||
(void (^)(NSModalResponse returnCode)) handler;
|
||||
- (NSInteger) runModal;
|
||||
|
||||
@end
|
||||
|
@ -21,6 +21,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
#import <AppKit/NSGraphics.h>
|
||||
#import <AppKit/NSResponder.h>
|
||||
#import <AppKit/NSRunningApplication.h>
|
||||
#import <AppKit/NSAlert.h>
|
||||
#import <Foundation/NSNotification.h>
|
||||
#import <Foundation/NSRunLoop.h>
|
||||
|
||||
@ -58,7 +59,6 @@ typedef double NSAppKitVersion;
|
||||
APPKIT_EXPORT const NSAppKitVersion NSAppKitVersionNumber;
|
||||
|
||||
typedef id NSModalSession;
|
||||
typedef NSInteger NSModalResponse;
|
||||
|
||||
enum {
|
||||
NSRunStoppedResponse = -1000,
|
||||
|
@ -19,6 +19,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
|
||||
#import <AppKit/NSNibLoading.h>
|
||||
#import <AppKit/NSPanel.h>
|
||||
#import <Foundation/NSURL.h>
|
||||
|
||||
@class NSView, NSOutlineView;
|
||||
|
||||
@ -63,6 +64,9 @@ enum {
|
||||
- (void) setRequiredFileType: (NSString *) type;
|
||||
- (void) setTreatsFilePackagesAsDirectories: (BOOL) flag;
|
||||
|
||||
- (void) setDirectoryURL: (NSURL *) url;
|
||||
- (NSURL *) directoryURL;
|
||||
|
||||
- (NSArray *) allowedFileTypes;
|
||||
|
||||
- (void) setAccessoryView: (NSView *) view;
|
||||
|
@ -217,8 +217,7 @@ typedef int stb_image_write_test[sizeof(stbiw_uint32) == 4 ? 1 : -1];
|
||||
(stbi__sbneedgrow(a, (n)) ? stbi__sbgrow(a, n) : 0)
|
||||
#define stbi__sbgrow(a, n) stbi__sbgrowf((void **) &(a), (n), sizeof(*(a)))
|
||||
|
||||
#define stbi__sbpush(a, v) \
|
||||
(stbi__sbmaybegrow(a, 1), (a)[stbi__sbn(a)++] = (v))
|
||||
#define stbi__sbpush(a, v) (stbi__sbmaybegrow(a, 1), (a)[stbi__sbn(a)++] = (v))
|
||||
#define stbi__sbcount(a) ((a) ? stbi__sbn(a) : 0)
|
||||
#define stbi__sbfree(a) ((a) ? free(stbi__sbraw(a)), 0 : 0)
|
||||
|
||||
|
@ -76,8 +76,7 @@
|
||||
#define CGContextAddArcToPoint O2ContextAddArcToPoint
|
||||
#define CGContextAddEllipseInRect O2ContextAddEllipseInRect
|
||||
#define CGContextAddPath O2ContextAddPath
|
||||
#define CGContextReplacePathWithStrokedPath \
|
||||
O2ContextReplacePathWithStrokedPath
|
||||
#define CGContextReplacePathWithStrokedPath O2ContextReplacePathWithStrokedPath
|
||||
#define CGContextSaveGState O2ContextSaveGState
|
||||
#define CGContextRestoreGState O2ContextRestoreGState
|
||||
#define CGContextGetUserSpaceToDeviceSpaceTransform \
|
||||
|
Loading…
Reference in New Issue
Block a user