Permalink
Browse files

Renamed movePopover:toPoint: to movePopoverToPoint: and changed the e…

…xplicit window parameter to parentWindow
  • Loading branch information...
1 parent 90bd938 commit 366659925d204f05045e0072aad2599e1b6b6096 @sbooth committed Jul 18, 2011
Showing with 15 additions and 14 deletions.
  1. +1 −1 ExampleAppDelegate.m
  2. +2 −2 SFBPopoverWindowController.h
  3. +12 −11 SFBPopoverWindowController.m
View
@@ -139,7 +139,7 @@ - (void)windowDidResize:(NSNotification *)notification
where.x += [toggleButton frame].size.width / 2;
where.y += [toggleButton frame].size.height / 2;
- [_popoverController movePopover:[toggleButton window] toPoint:where];
+ [_popoverController movePopoverToPoint:where];
}
}
@@ -58,8 +58,8 @@
- (void) displayPopoverInWindow:(NSWindow *)window atPoint:(NSPoint)point chooseBestLocation:(BOOL)chooseBestLocation;
// ========================================
-// Move the popover to a new attachment point
-- (void) movePopover:(NSWindow *)window toPoint:(NSPoint)point;
+// Move the popover to a new attachment point (should be currently displayed)
+- (void) movePopoverToPoint:(NSPoint)point;
// ========================================
// Close the popover
@@ -216,6 +216,18 @@ - (void) displayPopoverInWindow:(NSWindow *)window atPoint:(NSPoint)point choose
[[[self window] animator] setAlphaValue:1];
}
+- (void) movePopoverToPoint:(NSPoint)point
+{
+ NSPoint attachmentPoint = [[[self popoverWindow] popoverWindowFrame] attachmentPoint];
+ NSWindow *window = [[self window] parentWindow];
+ NSPoint pointOnScreen = (nil != window) ? [window convertBaseToScreen:point] : point;
+
+ pointOnScreen.x -= attachmentPoint.x;
+ pointOnScreen.y -= attachmentPoint.y;
+
+ [[self window] setFrameOrigin:pointOnScreen];
+}
+
- (IBAction) closePopover:(id)sender
{
if(![[self window] isVisible])
@@ -272,15 +284,4 @@ - (void) applicationDidResignActive:(NSNotification *)notification
[self closePopover:notification];
}
-- (void) movePopover:(NSWindow *)window toPoint:(NSPoint)point
-{
- NSPoint attachmentPoint = [[[self popoverWindow] popoverWindowFrame] attachmentPoint];
- NSPoint pointOnScreen = (nil != window) ? [window convertBaseToScreen:point] : point;
-
- pointOnScreen.x -= attachmentPoint.x;
- pointOnScreen.y -= attachmentPoint.y;
-
- [[self window] setFrameOrigin:pointOnScreen];
-}
-
@end

0 comments on commit 3666599

Please sign in to comment.