Permalink
Browse files

Clicking on the indicator starts/stops/resets.

- Mouse up on the window, if a drag didn't happen, will
  start/stop/reset.
  • Loading branch information...
1 parent b47d368 commit 3bf46a981f8ac9bd1ad42532f54e2e02049a1ecc @kamitchell kamitchell committed Oct 15, 2010
Showing with 14 additions and 0 deletions.
  1. +2 −0 CustomWindow.h
  2. +12 −0 CustomWindow.m
View
@@ -50,8 +50,10 @@
@interface CustomWindow : NSWindow {
// This point is used in dragging to mark the initial click location
NSPoint initialLocation;
+ bool didDrag;
}
@property (assign) NSPoint initialLocation;
+@property (assign) bool didDrag;
@end
View
@@ -51,6 +51,7 @@ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
@implementation CustomWindow
@synthesize initialLocation;
+@synthesize didDrag;
/*
In Interface Builder, the class for the window is set to this subclass. Overriding the initializer provides a mechanism for controlling how objects of this class are created.
@@ -108,6 +109,17 @@ - (void)mouseDragged:(NSEvent *)theEvent {
// Move the window to the new location
[self setFrameOrigin:newOrigin];
+
+ self.didDrag = true;
+}
+
+- (void) mouseUp:(NSEvent *)theEvent
+{
+ if (!self.didDrag)
+ {
+ [NSApp sendAction:@selector(startStopReset:) to:nil from:self];
+ }
+ self.didDrag = false;
}
@end

0 comments on commit 3bf46a9

Please sign in to comment.