Commit 5f194336 authored by David Fuhrmann's avatar David Fuhrmann

macosx: use VLCDropView for the controls bar drop area

This removes VLCThreeImageDropView and thus duplicated
D&D code.
parent b85e854c
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
@interface VLCControlsBarCommon : NSObject @interface VLCControlsBarCommon : NSObject
{ {
IBOutlet id o_bottombar_view; IBOutlet id o_bottombar_view;
IBOutlet VLCDragDropView *o_drop_view;
IBOutlet id o_play_btn; IBOutlet id o_play_btn;
IBOutlet id o_bwd_btn; IBOutlet id o_bwd_btn;
......
...@@ -50,6 +50,8 @@ ...@@ -50,6 +50,8 @@
b_nativeFullscreenMode = var_InheritBool(VLCIntf, "macosx-nativefullscreenmode"); b_nativeFullscreenMode = var_InheritBool(VLCIntf, "macosx-nativefullscreenmode");
#endif #endif
[o_drop_view setDrawBorder: NO];
[o_play_btn setToolTip: _NS("Play/Pause")]; [o_play_btn setToolTip: _NS("Play/Pause")];
[[o_play_btn cell] accessibilitySetOverrideValue:_NS("Click to play or pause the current media.") forAttribute:NSAccessibilityDescriptionAttribute]; [[o_play_btn cell] accessibilitySetOverrideValue:_NS("Click to play or pause the current media.") forAttribute:NSAccessibilityDescriptionAttribute];
[[o_play_btn cell] accessibilitySetOverrideValue:[o_play_btn toolTip] forAttribute:NSAccessibilityTitleAttribute]; [[o_play_btn cell] accessibilitySetOverrideValue:[o_play_btn toolTip] forAttribute:NSAccessibilityTitleAttribute];
......
...@@ -93,6 +93,8 @@ ...@@ -93,6 +93,8 @@
} }
@property (nonatomic, assign) id dropHandler; @property (nonatomic, assign) id dropHandler;
@property (nonatomic, assign) BOOL drawBorder;
- (void)enablePlaylistItems; - (void)enablePlaylistItems;
...@@ -212,12 +214,6 @@ ...@@ -212,12 +214,6 @@
- (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right; - (void)setImagesLeft:(NSImage *)left middle: (NSImage *)middle right:(NSImage *)right;
@end @end
/*****************************************************************************
* VLCThreePartDropView interface
*****************************************************************************/
@interface VLCThreePartDropView : VLCThreePartImageView
@end
/***************************************************************************** /*****************************************************************************
* PositionFormatter interface * PositionFormatter interface
......
...@@ -320,6 +320,18 @@ static bool b_old_spaces_style = YES; ...@@ -320,6 +320,18 @@ static bool b_old_spaces_style = YES;
@implementation VLCDragDropView @implementation VLCDragDropView
@synthesize dropHandler=_dropHandler; @synthesize dropHandler=_dropHandler;
@synthesize drawBorder;
- (id)initWithFrame:(NSRect)frame
{
self = [super initWithFrame:frame];
if (self) {
// default value
[self setDrawBorder:YES];
}
return self;
}
- (void)enablePlaylistItems - (void)enablePlaylistItems
{ {
...@@ -391,8 +403,7 @@ static bool b_old_spaces_style = YES; ...@@ -391,8 +403,7 @@ static bool b_old_spaces_style = YES;
- (void)drawRect:(NSRect)dirtyRect - (void)drawRect:(NSRect)dirtyRect
{ {
if ([self drawBorder] && b_activeDragAndDrop) {
if (b_activeDragAndDrop) {
NSRect frameRect = [self bounds]; NSRect frameRect = [self bounds];
[[NSColor selectedControlColor] set]; [[NSColor selectedControlColor] set];
...@@ -866,52 +877,6 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -866,52 +877,6 @@ void _drawFrameInRect(NSRect frameRect)
@end @end
@implementation VLCThreePartDropView
- (BOOL)mouseDownCanMoveWindow
{
return YES;
}
- (void)dealloc
{
[self unregisterDraggedTypes];
[super dealloc];
}
- (void)awakeFromNib
{
[self registerForDraggedTypes:[NSArray arrayWithObject:NSFilenamesPboardType]];
}
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
if ((NSDragOperationGeneric & [sender draggingSourceOperationMask]) == NSDragOperationGeneric)
return NSDragOperationGeneric;
return NSDragOperationNone;
}
- (BOOL)prepareForDragOperation:(id <NSDraggingInfo>)sender
{
return YES;
}
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
{
BOOL b_returned;
b_returned = [[VLCCoreInteraction sharedInstance] performDragOperation: sender];
[self setNeedsDisplay:YES];
return YES;
}
- (void)concludeDragOperation:(id <NSDraggingInfo>)sender
{
[self setNeedsDisplay:YES];
}
@end
@implementation PositionFormatter @implementation PositionFormatter
...@@ -957,7 +922,6 @@ void _drawFrameInRect(NSRect frameRect) ...@@ -957,7 +922,6 @@ void _drawFrameInRect(NSRect frameRect)
} }
} }
@end @end
@implementation NSView (EnableSubviews) @implementation NSView (EnableSubviews)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment