Additionnal event for imagegadget?
Posted: Fri Jan 31, 2014 12:39 am
I need to move some imagegadgets around my window by dragging them with the mouse. Granted Canvasgadget would be much more adapted for that kind of work, but I need some transparency too...
Do you know how to get an event for mouse left button down from an imagegadget?
Edit:
the objective C version of what I need (I guess)
Do you know how to get an event for mouse left button down from an imagegadget?
Edit:
Code: Select all
// -------------------- MOUSE EVENTS ------------------- \\
- (BOOL) acceptsFirstMouse:(NSEvent *)theEvent
{
return YES;
}
- (void)mouseDown:(NSEvent *)theEvent
{
lastDragLocation = [theEvent locationInWindow];
}
- (void)mouseDragged:(NSEvent *)theEvent
{
NSPoint newDragLocation = [theEvent locationInWindow];
NSPoint thisOrigin = [self frame].origin;
thisOrigin.x += (-lastDragLocation.x + newDragLocation.x);
thisOrigin.y += (-lastDragLocation.y + newDragLocation.y);
[self setFrameOrigin:thisOrigin];
lastDragLocation = newDragLocation;
}