Commit 56bd830f authored by Vibhoothi's avatar Vibhoothi

macosx:Introduce VLCMainWindowCollectionViewItem cocoa class with XIB

This introduction is for making libraryView based on NSCollectionView by default for VLC 4.0
The following files are newly introduced
 - VLCMainWindowCollectionViewItem.xib : An Interface for showing collectionView items.
 - VLCMainWindowCollectionViewItem.h   : Header file for defining instance and instance variables
 - VLCMainWindowCollectionViewItem.m   : Cococa class which contains implementation of instance and representation of objects
-  Build VLCMainWindowCollectionViewItem files
parent 6b6879b5
......@@ -94,8 +94,8 @@ libmacosx_plugin_la_SOURCES = \
gui/macosx/VLCSliderCell.h gui/macosx/VLCSliderCell.m \
gui/macosx/VLCVolumeSlider.h gui/macosx/VLCVolumeSlider.m \
gui/macosx/VLCVolumeSliderCell.h gui/macosx/VLCVolumeSliderCell.m \
gui/macosx/VLCWrappableTextField.h gui/macosx/VLCWrappableTextField.m
gui/macosx/VLCWrappableTextField.h gui/macosx/VLCWrappableTextField.m \
gui/macosx/VLCMainWindowCollectionViewItem.h gui/macosx/VLCMainWindowCollectionViewItem.m
# User interface compilation
......@@ -126,7 +126,8 @@ nodist_libmacosx_plugin_la_SOURCES = \
gui/macosx/UI/TimeSelectionPanel.nib \
gui/macosx/UI/VideoEffects.nib \
gui/macosx/UI/VLCFullScreenPanel.nib \
gui/macosx/UI/VLCStatusBarIconMainMenu.nib
gui/macosx/UI/VLCStatusBarIconMainMenu.nib \
gui/macosx/UI/VLCMainWindowCollectionViewItem.nib
EXTRA_DIST += \
gui/macosx/UI/About.xib \
......@@ -155,7 +156,8 @@ EXTRA_DIST += \
gui/macosx/UI/TimeSelectionPanel.xib \
gui/macosx/UI/VideoEffects.xib \
gui/macosx/UI/VLCFullScreenPanel.xib \
gui/macosx/UI/VLCStatusBarIconMainMenu.xib
gui/macosx/UI/VLCStatusBarIconMainMenu.xib \
gui/macosx/UI/VLCMainWindowCollectionViewItem.xib
xib_verbose = $(xib_verbose_$(V))
xib_verbose_ = $(xib_verbose__$(AM_DEFAULT_VERBOSITY))
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="VLCMainWindowCollectionViewItem">
<connections>
<outlet property="VLCItemImageView" destination="LRe-wn-Y2z" id="HPo-O1-7R6"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY" userLabel="Library View">
<rect key="frame" x="0.0" y="0.0" width="171" height="193"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="LRe-wn-Y2z">
<rect key="frame" x="47" y="97" width="77" height="76"/>
<constraints>
<constraint firstAttribute="width" constant="77" id="6QU-dx-4YT"/>
<constraint firstAttribute="height" constant="76" id="VTi-R7-Kzg"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="VLC" id="szu-Su-VAK"/>
</imageView>
</subviews>
<constraints>
<constraint firstItem="LRe-wn-Y2z" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="47" id="YGY-ey-fbH"/>
<constraint firstItem="LRe-wn-Y2z" firstAttribute="centerY" secondItem="Hz6-mo-xeY" secondAttribute="centerY" constant="-38.5" id="hyO-mR-8Jc"/>
</constraints>
<point key="canvasLocation" x="-94.5" y="129.5"/>
</customView>
</objects>
<resources>
<image name="VLC" width="512" height="512"/>
</resources>
</document>
/*****************************************************************************
* VLCMainWindowCollectionView.h: MacOS X interface module
*****************************************************************************
* Copyright (C) 2018 VLC authors and VideoLAN
* $Id $
*
* Authors: Vibhoothi <vibhoothiiaanand -at- googlemail dot com>
*
* 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>
@interface VLCMainWindowCollectionViewItem : NSCollectionViewItem < NSCollectionViewDelegate>
@property (nonatomic,strong) IBOutlet NSImageView *VLCItemImageView;
@end
@interface libraryView : NSView
@end
/*****************************************************************************
* VLCMainWindowCollectionView.m: MacOS X interface module
*****************************************************************************
* Copyright (C) 2002-2018 VLC authors and VideoLAN
* $Id $
*
* Authors: Vibhoothi <vibhoothiiaanand -at- googlemail dot com>
*
* 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 "VLCMainWindowCollectionViewItem.h"
@interface VLCMainWindowCollectionViewItem ()
{
}
@end
@implementation VLCMainWindowCollectionViewItem
- (void)loadView {
self.view = [[libraryView alloc] init];
self.VLCItemImageView = [[NSImageView alloc] initWithFrame:self.view.bounds];
self.VLCItemImageView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable;
[self.view addSubview:self.VLCItemImageView];
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do view setup here.
[self.collectionView setDelegate:self];
}
-(void)setRepresentedObject:(id)representedObject{
[super setRepresentedObject:representedObject];
if (representedObject !=nil)
{
[self.imageView setImage:[[NSBundle mainBundle] imageForResource:[representedObject valueForKey:@"itemImage"]]];
}
}
- (void)setSelected:(BOOL)flag
{
[super setSelected:flag];
[self updateBackgroundColorForSelectionState:flag];
}
- (void) viewDidAppear
{
[self updateBackgroundColorForSelectionState:self.isSelected];
}
- (void)updateBackgroundColorForSelectionState:(BOOL)flag
{
if (flag)
{
self.view.layer.backgroundColor = [[NSColor alternateSelectedControlColor] CGColor];
}
else
{
self.view.layer.backgroundColor = [[NSColor clearColor] CGColor];
}
}
@end
@interface libraryView () {
}
@end
@implementation libraryView
@end
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