Skip to content

Commit

Permalink
- Fleshing out -mouseEvent:onSubview: stubs in TUIView+Event
Browse files Browse the repository at this point in the history
- More scroll indicator visibility updates
  • Loading branch information
Brian William Wolter committed Aug 20, 2011
1 parent 92a2abf commit 05955ec
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
4 changes: 4 additions & 0 deletions lib/UIKit/TUIScrollKnob.m
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,16 @@ - (void)mouseEntered:(NSEvent *)event
{
_scrollKnobFlags.hover = 1;
[self _updateKnobColor:0.08];
// make sure we propagate mouse events
[super mouseEntered:event];
}

- (void)mouseExited:(NSEvent *)event
{
_scrollKnobFlags.hover = 0;
[self _updateKnobColor:0.25];
// make sure we propagate mouse events
[super mouseExited:event];
}

- (void)mouseDown:(NSEvent *)event
Expand Down
8 changes: 4 additions & 4 deletions lib/UIKit/TUIScrollView.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ typedef enum {

@interface TUIScrollView : TUIView
{
CGPoint _unroundedContentOffset;
CGSize _contentSize;
CGSize resizeKnobSize;
TUIEdgeInsets _contentInset;
CGPoint _unroundedContentOffset;
CGSize _contentSize;
CGSize resizeKnobSize;
TUIEdgeInsets _contentInset;

id _delegate;
TUIScrollKnob *_verticalScrollKnob;
Expand Down
4 changes: 2 additions & 2 deletions lib/UIKit/TUIScrollView.m
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ - (void)scrollWheel:(NSEvent *)event

-(void)mouseEntered:(NSEvent *)event onSubview:(TUIView *)subview {
[super mouseEntered:event onSubview:subview];
if(++_mouseInside == 1){
if(_mouseInside++ < 1){
[self _updateScrollKnobs];
}
}
Expand All @@ -942,7 +942,7 @@ - (BOOL)performKeyAction:(NSEvent *)event
case 63275: // end
[self scrollToBottomAnimated:YES];
return YES;
case 32:
case 32: // spacebar
if([NSEvent modifierFlags] & NSShiftKeyMask)
[self pageUp:nil];
else
Expand Down
2 changes: 2 additions & 0 deletions lib/UIKit/TUITableViewCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ - (void)mouseDown:(NSEvent *)event
* @brief The table cell was dragged
*/
-(void)mouseDragged:(NSEvent *)event {
// propagate the event
[super mouseDragged:event];
// notify our table view of the event
[self.tableView __mouseDraggedCell:self offset:_mouseOffset event:event];
}
Expand Down
24 changes: 15 additions & 9 deletions lib/UIKit/TUIView+Event.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ - (void)mouseDown:(NSEvent *)event
_viewFlags.dragDistanceLock = 1;
_viewFlags.didStartMovingByDragging = 0;
_viewFlags.didStartResizeByDragging = 0;

if(self.superview != nil){
[self.superview mouseDown:event onSubview:self];
}

}

- (void)mouseUp:(NSEvent *)event
Expand Down Expand Up @@ -138,6 +143,11 @@ - (void)mouseDragged:(NSEvent *)event
if(!_currentTextRenderer && _viewFlags.pasteboardDraggingEnabled)
[self pasteboardDragMouseDragged:event];
}

if(self.superview != nil){
[self.superview mouseDragged:event onSubview:self];
}

}

- (BOOL)didDrag
Expand Down Expand Up @@ -192,12 +202,12 @@ - (void)viewDidEndLiveResize

- (void)mouseDown:(NSEvent *)event onSubview:(TUIView *)subview
{
[self.superview mouseDown:event onSubview:subview];
}

- (void)mouseDragged:(NSEvent *)event onSubview:(TUIView *)subview
{
[self.superview mouseDragged:event onSubview:subview];
}

- (void)mouseUp:(NSEvent *)event fromSubview:(TUIView *)subview
Expand All @@ -210,7 +220,7 @@ - (void)mouseUp:(NSEvent *)event fromSubview:(TUIView *)subview

- (void)rightMouseDown:(NSEvent *)event onSubview:(TUIView *)subview
{
[self.superview rightMouseDown:event onSubview:subview];
}

- (void)rightMouseUp:(NSEvent *)event fromSubview:(TUIView *)subview
Expand All @@ -221,16 +231,12 @@ - (void)rightMouseUp:(NSEvent *)event fromSubview:(TUIView *)subview

- (void)mouseEntered:(NSEvent *)event onSubview:(TUIView *)subview
{
if(self.superview != nil){
[self.superview mouseEntered:event onSubview:subview];
}
[self.superview mouseEntered:event onSubview:subview];
}

- (void)mouseExited:(NSEvent *)event fromSubview:(TUIView *)subview
{
if(self.superview != nil){
[self.superview mouseExited:event fromSubview:subview];
}
[self.superview mouseExited:event fromSubview:subview];
}

@end

0 comments on commit 05955ec

Please sign in to comment.