vlc | branch: master | Cameron Mozie <[email protected]> | Sun Feb 26 
14:54:59 2017 +0100| [6b11e86356e1c5d75fffba6680a7e2b11556eac5] | committer: 
Marvin Scholz

macOS: Add image button classes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6b11e86356e1c5d75fffba6680a7e2b11556eac5
---

 .../package/macosx/VLC.xcodeproj/project.pbxproj   | 16 +++++++--
 modules/gui/macosx/Makefile.am                     |  4 ++-
 modules/gui/macosx/UI/VLCFullScreenPanel.xib       | 18 +++++-----
 modules/gui/macosx/VLCFSPanelController.m          |  4 ---
 modules/gui/macosx/VLCHUDImageButton.h             | 28 ++++++++++++++++
 modules/gui/macosx/VLCHUDImageButton.m             | 38 ++++++++++++++++++++++
 modules/gui/macosx/VLCHUDToggleButton.h            | 28 ++++++++++++++++
 modules/gui/macosx/VLCHUDToggleButton.m            | 38 ++++++++++++++++++++++
 8 files changed, 158 insertions(+), 16 deletions(-)

diff --git a/extras/package/macosx/VLC.xcodeproj/project.pbxproj 
b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
index 6384f73..9250957 100644
--- a/extras/package/macosx/VLC.xcodeproj/project.pbxproj
+++ b/extras/package/macosx/VLC.xcodeproj/project.pbxproj
@@ -165,6 +165,8 @@
                1C3114281E508D1B00D4DD76 /* VLCFullScreenPanel.xib in Sources 
*/ = {isa = PBXBuildFile; fileRef = 6B8224181E4D2A9000833BE1 /* 
VLCFullScreenPanel.xib */; };
                1C3114291E508D1B00D4DD76 /* VLCRendererDialog.xib in Sources */ 
= {isa = PBXBuildFile; fileRef = 6B8224191E4D2A9000833BE1 /* 
VLCRendererDialog.xib */; };
                1C31142A1E508D1B00D4DD76 /* VLCStatusBarIconMainMenu.xib in 
Sources */ = {isa = PBXBuildFile; fileRef = 6B82241A1E4D2A9000833BE1 /* 
VLCStatusBarIconMainMenu.xib */; };
+               6B3BE42C1E6217CB008D098A /* VLCHUDImageButton.m in Sources */ = 
{isa = PBXBuildFile; fileRef = 6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m 
*/; };
+               6B3BE4321E621F24008D098A /* VLCHUDToggleButton.m in Sources */ 
= {isa = PBXBuildFile; fileRef = 6B3BE4311E621F24008D098A /* 
VLCHUDToggleButton.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -195,6 +197,10 @@
                633121CB1B51122700E636DA /* VLCResumeDialogController.m */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = VLCResumeDialogController.m; sourceTree = "<group>"; 
};
                6B13E2A61BC67678001AD24A /* VLCScrollingClipView.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCScrollingClipView.h; sourceTree = "<group>"; };
                6B13E2A71BC67678001AD24A /* VLCScrollingClipView.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= VLCScrollingClipView.m; sourceTree = "<group>"; };
+               6B3BE42A1E6217CB008D098A /* VLCHUDImageButton.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCHUDImageButton.h; sourceTree = "<group>"; };
+               6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= VLCHUDImageButton.m; sourceTree = "<group>"; };
+               6B3BE4301E621F24008D098A /* VLCHUDToggleButton.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCHUDToggleButton.h; sourceTree = "<group>"; };
+               6B3BE4311E621F24008D098A /* VLCHUDToggleButton.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= VLCHUDToggleButton.m; sourceTree = "<group>"; };
                6B6A499A1DFD9B23009128AC /* VLCDefaultValueSlider.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
VLCDefaultValueSlider.h; sourceTree = "<group>"; };
                6B6A499B1DFD9B23009128AC /* VLCDefaultValueSlider.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= VLCDefaultValueSlider.m; sourceTree = "<group>"; };
                6B6A499C1DFD9B23009128AC /* VLCDefaultValueSliderCell.h */ = 
{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; 
path = VLCDefaultValueSliderCell.h; sourceTree = "<group>"; };
@@ -922,6 +928,10 @@
                08FB77AFFE84173DC02AAC07 /* Classes */ = {
                        isa = PBXGroup;
                        children = (
+                               6B3BE42A1E6217CB008D098A /* VLCHUDImageButton.h 
*/,
+                               6B3BE42B1E6217CB008D098A /* VLCHUDImageButton.m 
*/,
+                               6B3BE4301E621F24008D098A /* 
VLCHUDToggleButton.h */,
+                               6B3BE4311E621F24008D098A /* 
VLCHUDToggleButton.m */,
                                1C67C8A61D58C0A40079E1C1 /* 
VLCAboutWindowController.h */,
                                1C67C8A71D58C0A40079E1C1 /* 
VLCAboutWindowController.m */,
                                1C67C8A31D58C0980079E1C1 /* 
VLCHelpWindowController.h */,
@@ -1879,7 +1889,7 @@
                                        };
                                };
                        };
-                       buildConfigurationList = C2F2A6EA09588F1B00018C74 /* 
Build configuration list for PBXProject "vlc" */;
+                       buildConfigurationList = C2F2A6EA09588F1B00018C74 /* 
Build configuration list for PBXProject "VLC" */;
                        compatibilityVersion = "Xcode 3.2";
                        developmentRegion = English;
                        hasScannedForEncodings = 1;
@@ -1905,6 +1915,7 @@
                        buildActionMask = 2147483647;
                        files = (
                                1C31140E1E508D1B00D4DD76 /* About.xib in 
Sources */,
+                               6B3BE42C1E6217CB008D098A /* VLCHUDImageButton.m 
in Sources */,
                                1C31140F1E508D1B00D4DD76 /* AddonManager.xib in 
Sources */,
                                1C3114101E508D1B00D4DD76 /* AudioEffects.xib in 
Sources */,
                                1C3114111E508D1B00D4DD76 /* Bookmarks.xib in 
Sources */,
@@ -1954,6 +1965,7 @@
                                1C3113F01E508C7600D4DD76 /* VLCRendererItem.h 
in Sources */,
                                1C3113F11E508C7600D4DD76 /* VLCRendererItem.m 
in Sources */,
                                1C3113F21E508C7600D4DD76 /* VLCRendererDialog.h 
in Sources */,
+                               6B3BE4321E621F24008D098A /* 
VLCHUDToggleButton.m in Sources */,
                                1C3113F31E508C7600D4DD76 /* VLCRendererDialog.m 
in Sources */,
                                1C3113F41E508C7600D4DD76 /* 
VLCHUDTextFieldCell.h in Sources */,
                                1C3113F51E508C7600D4DD76 /* 
VLCHUDTextFieldCell.m in Sources */,
@@ -2218,7 +2230,7 @@
                        defaultConfigurationIsVisible = 0;
                        defaultConfigurationName = Default;
                };
-               C2F2A6EA09588F1B00018C74 /* Build configuration list for 
PBXProject "vlc" */ = {
+               C2F2A6EA09588F1B00018C74 /* Build configuration list for 
PBXProject "VLC" */ = {
                        isa = XCConfigurationList;
                        buildConfigurations = (
                                C2F2A6EB09588F1B00018C74 /* Development */,
diff --git a/modules/gui/macosx/Makefile.am b/modules/gui/macosx/Makefile.am
index 809034a..15569bb 100644
--- a/modules/gui/macosx/Makefile.am
+++ b/modules/gui/macosx/Makefile.am
@@ -92,7 +92,9 @@ libmacosx_plugin_la_SOURCES = \
        VLCFSPanelController.h VLCFSPanelController.m \
        VLCFSPanelDraggableView.h VLCFSPanelDraggableView.m \
        VLCDefaultValueSlider.h VLCDefaultValueSlider.m \
-       VLCDefaultValueSliderCell.h VLCDefaultValueSliderCell.m
+       VLCDefaultValueSliderCell.h VLCDefaultValueSliderCell.m \
+       VLCHUDImageButton.h VLCHUDImageButton.m \
+       VLCHUDToggleButton.h VLCHUDToggleButton.m
 
 nobase_libmacosx_plugin_la_DATA = \
        UI/About.nib \
diff --git a/modules/gui/macosx/UI/VLCFullScreenPanel.xib 
b/modules/gui/macosx/UI/VLCFullScreenPanel.xib
index 6f7c9a4..3152cfc 100644
--- a/modules/gui/macosx/UI/VLCFullScreenPanel.xib
+++ b/modules/gui/macosx/UI/VLCFullScreenPanel.xib
@@ -1,9 +1,9 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" 
toolsVersion="11542" systemVersion="15G1217" targetRuntime="MacOSX.Cocoa" 
propertyAccessControl="none" useAutolayout="YES" 
customObjectInstantitationMethod="direct">
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" 
toolsVersion="12100" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" 
propertyAccessControl="none" useAutolayout="YES" 
customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
         <development version="7000" identifier="xcode"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" 
version="11542"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" 
version="12100"/>
         <capability name="Aspect ratio constraints" minToolsVersion="5.1"/>
         <capability name="system font weights other than Regular or Bold" 
minToolsVersion="7.0"/>
     </dependencies>
@@ -42,7 +42,7 @@
                     <customView translatesAutoresizingMaskIntoConstraints="NO" 
id="VLH-qy-cwr">
                         <rect key="frame" x="0.0" y="0.0" width="480" 
height="42"/>
                         <subviews>
-                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="YSL-bH-k6U">
+                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="YSL-bH-k6U" 
customClass="VLCHUDToggleButton">
                                 <rect key="frame" x="226" y="7" width="35" 
height="29"/>
                                 <constraints>
                                     <constraint firstAttribute="width" 
secondItem="YSL-bH-k6U" secondAttribute="height" multiplier="1:1" constant="6" 
id="2if-S8-t0u"/>
@@ -55,7 +55,7 @@
                                     <action selector="togglePlayPause:" 
target="-2" id="9os-DP-jAN"/>
                                 </connections>
                             </button>
-                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="jSN-hV-r5D">
+                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="jSN-hV-r5D" 
customClass="VLCHUDImageButton">
                                 <rect key="frame" x="263" y="7" width="34" 
height="29"/>
                                 <constraints>
                                     <constraint firstAttribute="width" 
secondItem="jSN-hV-r5D" secondAttribute="height" multiplier="19:16" 
id="m1w-9i-bkp"/>
@@ -68,7 +68,7 @@
                                     <action selector="jumpForward:" 
target="-2" id="bjn-qc-BJ7"/>
                                 </connections>
                             </button>
-                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="7QH-jb-QdM">
+                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="7QH-jb-QdM" 
customClass="VLCHUDImageButton">
                                 <rect key="frame" x="189" y="7" width="35" 
height="29"/>
                                 <constraints>
                                     <constraint firstAttribute="width" 
secondItem="7QH-jb-QdM" secondAttribute="height" multiplier="19:16" 
id="isk-o2-kZY"/>
@@ -93,7 +93,7 @@
                                     <action selector="volumeSliderUpdate:" 
target="-2" id="doI-qM-Pde"/>
                                 </connections>
                             </slider>
-                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="2ai-dB-Wpq">
+                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="2ai-dB-Wpq" 
customClass="VLCHUDImageButton">
                                 <rect key="frame" x="299" y="7" width="34" 
height="29"/>
                                 <constraints>
                                     <constraint firstAttribute="width" 
secondItem="2ai-dB-Wpq" secondAttribute="height" multiplier="19:16" 
id="Itj-7f-YDa"/>
@@ -106,7 +106,7 @@
                                     <action selector="gotoNext:" target="-2" 
id="flJ-52-Pcb"/>
                                 </connections>
                             </button>
-                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="TVM-DT-2yo">
+                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="TVM-DT-2yo" 
customClass="VLCHUDImageButton">
                                 <rect key="frame" x="153" y="7" width="34" 
height="29"/>
                                 <constraints>
                                     <constraint firstAttribute="width" 
secondItem="TVM-DT-2yo" secondAttribute="height" multiplier="19:16" 
id="oKb-iw-6S1"/>
@@ -130,7 +130,7 @@
                                     <font key="font" metaFont="system"/>
                                 </buttonCell>
                             </button>
-                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="C5K-aX-3aJ">
+                            <button 
translatesAutoresizingMaskIntoConstraints="NO" id="C5K-aX-3aJ" 
customClass="VLCHUDImageButton">
                                 <rect key="frame" x="438" y="10" width="22" 
height="22"/>
                                 <constraints>
                                     <constraint firstAttribute="width" 
secondItem="C5K-aX-3aJ" secondAttribute="height" multiplier="1:1" 
id="VWl-0x-p1I"/>
diff --git a/modules/gui/macosx/VLCFSPanelController.m 
b/modules/gui/macosx/VLCFSPanelController.m
index 0b4f499..e3ed64f 100644
--- a/modules/gui/macosx/VLCFSPanelController.m
+++ b/modules/gui/macosx/VLCFSPanelController.m
@@ -92,10 +92,6 @@ static NSString *kAssociatedFullscreenRect = 
@"VLCFullscreenAssociatedWindowRect
     [self injectBackgroundView];
 #endif
 
-    /* TODO: Write custom Image-only button subclass to behave properly */
-    [(NSButtonCell*)[_playPauseButton cell] setHighlightsBy:NSPushInCellMask];
-    [(NSButtonCell*)[_playPauseButton cell] 
setShowsStateBy:NSContentsCellMask];
-
     [self setupControls];
 }
 
diff --git a/modules/gui/macosx/VLCHUDImageButton.h 
b/modules/gui/macosx/VLCHUDImageButton.h
new file mode 100644
index 0000000..93a53c3
--- /dev/null
+++ b/modules/gui/macosx/VLCHUDImageButton.h
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * VLCHUDImageButton.h
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Cameron Mozie <[email protected]>
+ *
+ * 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 VLCHUDImageButton : NSButton
+
+@end
diff --git a/modules/gui/macosx/VLCHUDImageButton.m 
b/modules/gui/macosx/VLCHUDImageButton.m
new file mode 100644
index 0000000..49ea850
--- /dev/null
+++ b/modules/gui/macosx/VLCHUDImageButton.m
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * VLCHUDImageButton.m
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Cameron Mozie <[email protected]>
+ *
+ * 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 "VLCHUDImageButton.h"
+
+@implementation VLCHUDImageButton
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+    self =  [super initWithCoder:coder];
+    if (self) {
+        [(NSButtonCell*)[self cell] setHighlightsBy:NSPushInCellMask];
+        [(NSButtonCell*)[self cell] setShowsStateBy:NSNoCellMask];
+    }
+    return self;
+}
+
+@end
diff --git a/modules/gui/macosx/VLCHUDToggleButton.h 
b/modules/gui/macosx/VLCHUDToggleButton.h
new file mode 100644
index 0000000..449eccb
--- /dev/null
+++ b/modules/gui/macosx/VLCHUDToggleButton.h
@@ -0,0 +1,28 @@
+/*****************************************************************************
+ * VLCHUDToggleButton.h
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Cameron Mozie <[email protected]>
+ *
+ * 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 "VLCHUDImageButton.h"
+
+@interface VLCHUDToggleButton : VLCHUDImageButton
+
+@end
diff --git a/modules/gui/macosx/VLCHUDToggleButton.m 
b/modules/gui/macosx/VLCHUDToggleButton.m
new file mode 100644
index 0000000..bc26fa6
--- /dev/null
+++ b/modules/gui/macosx/VLCHUDToggleButton.m
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * VLCHUDToggleButton.h
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ * $Id$
+ *
+ * Authors: Cameron Mozie <[email protected]>
+ *
+ * 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 "VLCHUDToggleButton.h"
+
+@implementation VLCHUDToggleButton
+
+- (instancetype)initWithCoder:(NSCoder *)coder
+{
+    self =  [super initWithCoder:coder];
+    if (self) {
+        [(NSButtonCell*)[self cell] setHighlightsBy:NSPushInCellMask];
+        [(NSButtonCell*)[self cell] setShowsStateBy:NSContentsCellMask];
+    }
+    return self;
+}
+
+@end

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to