[vlc-commits] [Git][videolan/vlc][master] macosx: Add context menu to library hero view
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Mon Jul 1 09:54:37 UTC 2024
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
644dd7f6 by Claudio Cambra at 2024-07-01T09:41:19+00:00
macosx: Add context menu to library hero view
Signed-off-by: Claudio Cambra <developer at claudiocambra.com>
- - - - -
1 changed file:
- modules/gui/macosx/library/VLCLibraryHeroView.m
Changes:
=====================================
modules/gui/macosx/library/VLCLibraryHeroView.m
=====================================
@@ -28,6 +28,7 @@
#import "library/VLCLibraryController.h"
#import "library/VLCLibraryDataTypes.h"
#import "library/VLCLibraryImageCache.h"
+#import "library/VLCLibraryMenuController.h"
#import "library/VLCLibraryModel.h"
#import "library/VLCLibraryRepresentedItem.h"
@@ -35,6 +36,12 @@
#import "views/VLCImageView.h"
+ at interface VLCLibraryHeroView ()
+
+ at property (readonly) VLCLibraryMenuController *menuController;
+
+ at end
+
@implementation VLCLibraryHeroView
+ (instancetype)fromNibWithOwner:(id)owner
@@ -207,4 +214,29 @@
[self setOptimalRepresentedItem];
}
+- (void)openContextMenu:(NSEvent *)event
+{
+ if (self.menuController == nil) {
+ _menuController = [[VLCLibraryMenuController alloc] init];
+ }
+
+ self.menuController.representedItems = @[self.representedItem];
+ [self.menuController popupMenuWithEvent:event forView:self];
+}
+
+- (void)mouseDown:(NSEvent *)event
+{
+ if (event.modifierFlags & NSEventModifierFlagControl) {
+ [self openContextMenu:event];
+ }
+
+ [super mouseDown:event];
+}
+
+- (void)rightMouseDown:(NSEvent *)event
+{
+ [self openContextMenu:event];
+ [super rightMouseDown:event];
+}
+
@end
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/644dd7f62cedabcfceb4bce1d5cc1ade350d838c
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/644dd7f62cedabcfceb4bce1d5cc1ade350d838c
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list