mirror of
https://github.com/darlinghq/darling-cocotron.git
synced 2024-11-24 04:29:44 +00:00
19 lines
487 B
Objective-C
19 lines
487 B
Objective-C
#import <AppKit/NSWindowScripting.h>
|
|
#import <AppKit/NSApplication.h>
|
|
|
|
@implementation NSWindow(scripting)
|
|
|
|
-(NSInteger)orderedIndex {
|
|
NSInteger result=[[NSApp orderedWindows] indexOfObjectIdenticalTo:self];
|
|
|
|
/* Documentation says orderedIndex is zero based, but tests say it is 1 based
|
|
Possible there is a window at 0 which is not in -[NSApp windows] ? Either way, available windows are 1 based.
|
|
*/
|
|
if(result!=NSNotFound)
|
|
result+=1;
|
|
|
|
return result;
|
|
}
|
|
|
|
@end
|