yes, here is an example of such: > var windowToolkitKind = WindowToolkitKind.Darwin > >> {.passL: "-framework AppKit".} >> >> type NSOpenPanel {.importobjc: "NSOpenPanel*", header: "<AppKit/AppKit.h>", >> incompleteStruct.} = object >> >> proc newOpenPanel: NSOpenPanel {.importobjc: "NSOpenPanel openPanel", >> nodecl.} >> >> template wrapObjModalCode(body: untyped) = >> {.emit: """ NSAutoreleasePool* pool = [NSAutoreleasePool new]; NSWindow* >> keyWindow = [NSApp keyWindow]; NSOpenGLContext* glCtx = [[NSOpenGLContext >> currentContext] retain]; """.} body {.emit: """ [pool drain]; [glCtx >> makeCurrentContext]; [glCtx release]; [keyWindow makeKeyAndOrderFront: nil]; >> """.} >> >> proc callDialogFileOpen*(title: string, buttons: seq[DialogButtonInfo] = >> @[]): string = >> >> >> wrapObjModalCode: >> let dialog = newOpenPanel() let ctitle : cstring = title var cres: >> cstring {.emit: """ [`dialog` setCanChooseFiles:YES]; `dialog`.title = >> [NSString stringWithUTF8String: `ctitle`]; >> >> if ([`dialog` runModal] == NSOKButton && `dialog`.URLs.count > 0) { >> `cres` = [`dialog`.URLs objectAtIndex: 0].path.UTF8String; >> >> } """.} >> >> if not cres.isNil: >> result = $cres
unfortunately it is only for this panel...