Commit 4a9a7e4b authored by Felix Paul Kühne's avatar Felix Paul Kühne

macosx/NSView category: split to a file of its own

parent 32c57ced
......@@ -108,6 +108,7 @@
7D2E0EDB20CD204D0033A221 /* VLCWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0ED920CD204D0033A221 /* VLCWindow.m */; };
7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */; };
7D2FFA40227B8A5B0085D649 /* VLCLinearProgressIndicator.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D2FFA3F227B8A5B0085D649 /* VLCLinearProgressIndicator.m */; };
7D404ABF2281892C00B28EF4 /* NSView+VLCAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */; };
7D445D812202524000263D34 /* VLCPlaylistController.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D802202524000263D34 /* VLCPlaylistController.m */; };
7D445D842202524D00263D34 /* VLCPlaylistItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D832202524D00263D34 /* VLCPlaylistItem.m */; };
7D445D872202574B00263D34 /* VLCPlaylistModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7D445D862202574B00263D34 /* VLCPlaylistModel.m */; };
......@@ -463,6 +464,8 @@
7D2E0EDD20CD206F0033A221 /* VLCVideoWindowCommon.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = VLCVideoWindowCommon.m; sourceTree = "<group>"; };
7D2FFA3E227B8A5B0085D649 /* VLCLinearProgressIndicator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCLinearProgressIndicator.h; sourceTree = "<group>"; };
7D2FFA3F227B8A5B0085D649 /* VLCLinearProgressIndicator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCLinearProgressIndicator.m; sourceTree = "<group>"; };
7D404ABD2281892C00B28EF4 /* NSView+VLCAdditions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSView+VLCAdditions.h"; sourceTree = "<group>"; };
7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSView+VLCAdditions.m"; sourceTree = "<group>"; };
7D445D7F2202524000263D34 /* VLCPlaylistController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistController.h; sourceTree = "<group>"; };
7D445D802202524000263D34 /* VLCPlaylistController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = VLCPlaylistController.m; sourceTree = "<group>"; };
7D445D822202524D00263D34 /* VLCPlaylistItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = VLCPlaylistItem.h; sourceTree = "<group>"; };
......@@ -956,6 +959,8 @@
7D28E6352275B4820098D30E /* NSColor+VLCAdditions.m */,
7D28E6372275B7340098D30E /* NSFont+VLCAdditions.h */,
7D28E6382275B7340098D30E /* NSFont+VLCAdditions.m */,
7D404ABD2281892C00B28EF4 /* NSView+VLCAdditions.h */,
7D404ABE2281892C00B28EF4 /* NSView+VLCAdditions.m */,
);
path = extensions;
sourceTree = "<group>";
......@@ -1645,6 +1650,7 @@
1C3113901E508C6900D4DD76 /* VLCHelpWindowController.m in Sources */,
1C3113921E508C6900D4DD76 /* VLCAddonListItem.m in Sources */,
7DFBDCB7226CDFD600B700A5 /* VLCImageView.m in Sources */,
7D404ABF2281892C00B28EF4 /* NSView+VLCAdditions.m in Sources */,
7DE9C7DD220728420089108F /* VLCPlayerController.m in Sources */,
1C3113941E508C6900D4DD76 /* VLCAddonsWindowController.m in Sources */,
7D2E0EDE20CD206F0033A221 /* VLCVideoWindowCommon.m in Sources */,
......
......@@ -40,6 +40,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/extensions/NSSound+VLCAdditions.m \
gui/macosx/extensions/NSString+Helpers.h \
gui/macosx/extensions/NSString+Helpers.m \
gui/macosx/extensions/NSView+VLCAdditions.h \
gui/macosx/extensions/NSView+VLCAdditions.m \
gui/macosx/extensions/VLCHexNumberFormatter.h \
gui/macosx/extensions/VLCHexNumberFormatter.m \
gui/macosx/extensions/misc.h \
......
/*****************************************************************************
* NSView+VLCAdditions.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2013-2019 VLC authors and VideoLAN
*
* Authors: David Fuhrmann <dfuhrmann # videolan.org>
* Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSView (VLCAdditions)
- (void)enableSubviews:(BOOL)enabled;
@end
NS_ASSUME_NONNULL_END
/*****************************************************************************
* NSView+VLCAdditions.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2013-2019 VLC authors and VideoLAN
*
* Authors: David Fuhrmann <dfuhrmann # videolan.org>
* Felix Paul Kühne <fkuehne at videolan dot org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#import "NSView+VLCAdditions.h"
@implementation NSView (VLCAdditions)
- (void)enableSubviews:(BOOL)enabled
{
for (NSView *view in [self subviews]) {
[view enableSubviews:enabled];
// enable NSControl
if ([view respondsToSelector:@selector(setEnabled:)]) {
[(NSControl *)view setEnabled:enabled];
}
// also "enable / disable" text views
if ([view respondsToSelector:@selector(setTextColor:)]) {
if (enabled == NO) {
[(NSTextField *)view setTextColor:[NSColor disabledControlTextColor]];
} else {
[(NSTextField *)view setTextColor:[NSColor controlTextColor]];
}
}
}
}
@end
......@@ -67,14 +67,6 @@
@end
/*****************************************************************************
* NSView addition
*****************************************************************************/
@interface NSView (EnableSubviews)
- (void)enableSubviews:(BOOL)b_enable;
@end
/*****************************************************************************
* VLCByteCountFormatter addition
*****************************************************************************/
......
......@@ -195,31 +195,6 @@
@end
@implementation NSView (EnableSubviews)
- (void)enableSubviews:(BOOL)b_enable
{
for (NSView *o_view in [self subviews]) {
[o_view enableSubviews:b_enable];
// enable NSControl
if ([o_view respondsToSelector:@selector(setEnabled:)]) {
[(NSControl *)o_view setEnabled:b_enable];
}
// also "enable / disable" text views
if ([o_view respondsToSelector:@selector(setTextColor:)]) {
if (b_enable == NO) {
[(NSTextField *)o_view setTextColor:[NSColor disabledControlTextColor]];
} else {
[(NSTextField *)o_view setTextColor:[NSColor controlTextColor]];
}
}
}
}
@end
/*****************************************************************************
* VLCByteCountFormatter addition
*****************************************************************************/
......
......@@ -34,6 +34,7 @@
#import "../../../audio_filter/equalizer_presets.h"
#import "extensions/NSString+Helpers.h"
#import "extensions/NSView+VLCAdditions.h"
#import "main/VLCMain.h"
#import "main/CompatibilityFixes.h"
#import "panels/dialogs/VLCPopupPanelController.h"
......
......@@ -22,7 +22,7 @@
#import "VLCConvertAndSaveWindowController.h"
#import "extensions/misc.h"
#import "extensions/NSView+VLCAdditions.h"
#import "main/VLCMain.h"
#import "panels/dialogs/VLCPopupPanelController.h"
#import "panels/dialogs/VLCTextfieldPanelController.h"
......
......@@ -462,6 +462,8 @@ modules/gui/macosx/extensions/NSSound+VLCAdditions.h
modules/gui/macosx/extensions/NSSound+VLCAdditions.m
modules/gui/macosx/extensions/NSString+Helpers.h
modules/gui/macosx/extensions/NSString+Helpers.m
modules/gui/macosx/extensions/NSView+VLCAdditions.h
modules/gui/macosx/extensions/NSView+VLCAdditions.m
modules/gui/macosx/extensions/VLCHexNumberFormatter.h
modules/gui/macosx/extensions/VLCHexNumberFormatter.m
modules/gui/macosx/extensions/misc.h
......
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