Skip to content
Newer
Older
100644 55 lines (45 sloc) 1.56 KB
dc5be1c Initial check-in.
uli authored Jul 4, 2009
1 //
2 // NSApplicationWindowAtPoint.m
3 // UKDockableWindow
4 //
5 // Created by Uli Kusterer on Wed Feb 04 2004.
720b0e7 @uliwitness Added licensing information to the source files.
authored Mar 4, 2010
6 // Copyright (c) 2004 M. Uli Kusterer.
7 //
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
dc5be1c Initial check-in.
uli authored Jul 4, 2009
26 //
27
28 #import "NSApplicationWindowAtPoint.h"
29
30
31 @implementation NSApplication (WindowAtPoint)
32
33 -(NSWindow*) windowAtPoint: (NSPoint)pos ignoreWindow: (NSWindow*)ignorew
34 {
35 NSArray* winArray = [self windows];
36 NSEnumerator* enny = [winArray objectEnumerator];
37 NSWindow* theWin = nil;
38
39 while( theWin = [enny nextObject] )
40 {
41 if( theWin == ignorew ) // Skip the window to ignore.
42 continue;
43
44 if( ![theWin isVisible] ) // Skip invisible windows.
45 continue;
46
47 if( NSPointInRect( pos, [theWin frame] ) )
48 return theWin;
49 }
50
51 return nil;
52 }
53
54 @end
Something went wrong with that request. Please try again.