timthedevguy / BGHUDAppKit

* BGHUDAPPKIT is no longer under development by me, I hope that the community will keep it alive and going as I no longer have time to dedicate to the project** The missing HUD controls. Please scroll down to read the readme file for an important notice concerning the future of BGHUDAppKit. Note that there are multiple versions available, 10.5+, 10.6.7, and now 10.7. As soon as I learn how I'll make these all one code base if possible.
http://www.binarymethod.com/
312 stars 57 forks source link

BGHUDStepperCell missing draw implementation #22

Closed adib closed 14 years ago

adib commented 14 years ago

Apparently the drawWithFrame: method of BGHUDStepperCell isn't implemented yet -- currently it only draws a red rectangle instead of a black stepper cell.

Is there any workaround?

Thanks.

timthedevguy commented 14 years ago

Currently there is no work around, this was a skeleton of my work in getting BGHUDStepperCell to work, but ran into some issues subclassing it, namely detecting up/down clicks in the cell.

adib commented 14 years ago

Thanks

tylerstillwater commented 14 years ago

I think you may need to override these methods:

- (BOOL)trackMouse:(id)fp8 inRect:(struct _NSRect)fp12 ofView:(id)fp28 untilMouseUp:(BOOL)fp32;
- (BOOL)startTrackingAt:(struct _NSPoint)fp8 inView:(id)fp16;
- (BOOL)continueTracking:(struct _NSPoint)fp8 at:(struct _NSPoint)fp16 inView:(id)fp24;
- (void)stopTracking:(struct _NSPoint)fp8 at:(struct _NSPoint)fp16 inView:(id)fp24 mouseIsUp:(BOOL)fp28;

You could use these to track where the mouse started and ended, thus detecting when it is down/out/in/up, etc.

tylerstillwater commented 14 years ago
 -(BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
  NSLog(@"start at: %@",NSStringFromPoint(startPoint));
  return [super startTrackingAt:startPoint inView:controlView];
}
-(BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
{
  NSLog(@"continue at:%@ new: %@",NSStringFromPoint(lastPoint),NSStringFromPoint(currentPoint));
  return [super continueTracking:lastPoint at:currentPoint inView:controlView];
}
-(void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag
{
  NSLog(@"stop with last: %@, stopPoint: %@",NSStringFromPoint(lastPoint),NSStringFromPoint(stopPoint));
  [super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag];
}

These all work. They track properly. It should be trivial to change the image based on the position of the point inside the view. All you should need to do is the drawing. The superclass should handle all the rest for you just fine.

timthedevguy commented 14 years ago

Thanks to Sastira BGHUDAppKit now has a working StepperCell!