only show the media drag handle when moused over.

This commit is contained in:
Kelvin Sherlock 2020-09-06 11:25:59 -04:00
parent 4b34ff977d
commit f45db5383d
3 changed files with 26 additions and 7 deletions

View File

@ -17,7 +17,7 @@
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="20" horizontalPageScroll="10" verticalLineScroll="20" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" id="nVT-kT-bWl">
<rect key="frame" x="0.0" y="0.0" width="306" height="363"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<clipView key="contentView" autoresizesSubviews="NO" copiesOnScroll="NO" id="IBD-wb-pch">
<clipView key="contentView" autoresizesSubviews="NO" focusRingType="none" copiesOnScroll="NO" id="IBD-wb-pch">
<rect key="frame" x="0.0" y="0.0" width="306" height="363"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@ -81,7 +81,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<pathControl focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="f7R-TO-fmF">
<rect key="frame" x="41" y="1" width="207" height="22"/>
<rect key="frame" x="25" y="1" width="223" height="22"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<pathCell key="cell" controlSize="small" selectable="YES" editable="YES" focusRingType="none" alignment="left" pathStyle="popUp" id="dcz-8y-tKb">
<font key="font" metaFont="smallSystem"/>
@ -101,13 +101,14 @@
<action selector="ejectAction:" target="-2" id="XAl-eQ-nUj"/>
</connections>
</button>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="6g1-NT-J1w">
<rect key="frame" x="3" y="3" width="33" height="20"/>
<imageView hidden="YES" horizontalHuggingPriority="251" verticalHuggingPriority="251" id="6g1-NT-J1w">
<rect key="frame" x="0.0" y="3" width="20" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSListViewTemplate" id="x7F-qD-5y9"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageAlignment="left" image="NSListViewTemplate" id="x7F-qD-5y9"/>
</imageView>
</subviews>
<connections>
<outlet property="dragHandle" destination="6g1-NT-J1w" id="odc-Sw-3WS"/>
<outlet property="ejectButton" destination="zNo-ij-mUl" id="uzY-tA-5Wf"/>
<outlet property="pathControl" destination="f7R-TO-fmF" id="oH7-N3-JC7"/>
</connections>

View File

@ -29,7 +29,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface TablePathView : NSTableCellView
@property (weak) IBOutlet NSPathControl *pathControl;
@property (weak) IBOutlet NSButton *ejectButton;
@property (weak) IBOutlet NSImageView *dragHandle;
@end
NS_ASSUME_NONNULL_END

View File

@ -9,7 +9,25 @@
#import "MediaViewController.h"
@implementation TablePathView
@implementation TablePathView {
NSTrackingRectTag _trackingRect;
}
-(void)viewDidMoveToSuperview {
if (_trackingRect) {
[self removeTrackingRect: _trackingRect];
}
NSRect rect = [_dragHandle frame];
_trackingRect = [self addTrackingRect: rect owner: self userData: NULL assumeInside:NO];
}
-(void)mouseEntered:(NSEvent *)event {
[_dragHandle setHidden: NO];
}
-(void)mouseExited:(NSEvent *)event {
[_dragHandle setHidden: YES];
}
@end