Browse Source

macosx: Add property to selectively apply internal padding within audio group table header view

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
pull/200/head
Claudio Cambra 6 months ago
committed by Felix Paul Kühne
parent
commit
bd886f12ac
  1. 1
      modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableHeaderView.h
  2. 13
      modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableHeaderView.m

1
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableHeaderView.h

@ -31,6 +31,7 @@ extern const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight;
@interface VLCLibraryAudioGroupTableHeaderView : NSTableHeaderView
@property (nullable, nonatomic) VLCLibraryRepresentedItem *representedItem;
@property (readwrite, nonatomic) BOOL internalPaddingAddedForContentView;
- (void)updateWithRepresentedItem:(nullable VLCLibraryRepresentedItem *)representedItem
fallbackTitle:(nullable NSString *)fallbackTitle

13
modules/gui/macosx/library/audio-library/VLCLibraryAudioGroupTableHeaderView.m

@ -28,6 +28,7 @@
#import "extensions/NSColor+VLCAdditions.h"
#import "extensions/NSFont+VLCAdditions.h"
#import "extensions/NSString+Helpers.h"
#import "extensions/NSView+VLCAdditions.h"
const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
@ -164,6 +165,10 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
- (void)updateBackgroundConstraints
{
if (!self.internalPaddingAddedForContentView) {
[self.backgroundView applyConstraintsToFillSuperview];
return;
}
[NSLayoutConstraint activateConstraints:@[
[self.backgroundView.topAnchor constraintEqualToAnchor:self.topAnchor constant:self.backgroundTopInset],
[self.backgroundView.leadingAnchor constraintEqualToAnchor:self.leadingAnchor],
@ -171,6 +176,14 @@ const CGFloat VLCLibraryAudioGroupTableHeaderViewHeight = 86.f;
[self.backgroundView.bottomAnchor constraintEqualToAnchor:self.bottomAnchor constant:-self.backgroundBottomInset],
]];
}
- (void)setInternalPaddingAddedForContentView:(BOOL)internalPaddingAddedForContentView
{
if (_internalPaddingAddedForContentView == internalPaddingAddedForContentView) return;
_internalPaddingAddedForContentView = internalPaddingAddedForContentView;
[self updateBackgroundConstraints];
}
- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary<NSKeyValueChangeKey,id> *)change

Loading…
Cancel
Save