You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by tr...@apache.org on 2015/11/26 07:52:52 UTC
mac commit: CB-10087 OSX: facilitate easy preferences menu item
handling
Repository: cordova-osx
Updated Branches:
refs/heads/master 59b56cb7b -> a4e66ddff
CB-10087 OSX: facilitate easy preferences menu item handling
Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/a4e66ddf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/a4e66ddf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/a4e66ddf
Branch: refs/heads/master
Commit: a4e66ddff525ac9c8927349701eb2e35d44937d2
Parents: 59b56cb
Author: Tobias Bocanegra <tr...@adobe.com>
Authored: Wed Nov 25 22:52:28 2015 -0800
Committer: Tobias Bocanegra <tr...@adobe.com>
Committed: Wed Nov 25 22:52:28 2015 -0800
----------------------------------------------------------------------
.../CordovaLib/Classes/CDVViewController.h | 15 +++++++++++++-
.../CordovaLib/Classes/CDVViewController.m | 19 +++++++++++-------
.../__PROJECT_NAME__/MainViewController.xib | 21 ++++++++++++--------
3 files changed, 39 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a4e66ddf/CordovaLib/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/CDVViewController.h b/CordovaLib/CordovaLib/Classes/CDVViewController.h
index 9315f72..13ee341 100644
--- a/CordovaLib/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/CordovaLib/Classes/CDVViewController.h
@@ -53,7 +53,20 @@
- (id)getCommandInstance:(NSString*)pluginName;
-- (IBAction) toggleFullScreen:(id) sender;
+/**
+ * Action that toggles the fullscreen.
+ * This is an action target of the MainMenu -> Fullscreen menu item.
+ */
+- (IBAction) onFullscreen:(id) sender;
+
+/**
+ * Action that invokes the application's preferences.
+ * This is an action target of the MainMenu -> Preferences menu item.
+ *
+ * The default implementation doesn't do much yet and implementations would need to override
+ * this method on the {@link MainViewController} or adjust the menu items `target` property.
+ */
+- (IBAction) onPreferences:(id) sender;
- (void)registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className;
- (void)registerPlugin:(CDVPlugin*)plugin withPluginName:(NSString*)pluginName;
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a4e66ddf/CordovaLib/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/CordovaLib/Classes/CDVViewController.m b/CordovaLib/CordovaLib/Classes/CDVViewController.m
index 35f86b2..90a76c6 100644
--- a/CordovaLib/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/CordovaLib/Classes/CDVViewController.m
@@ -301,13 +301,6 @@
return obj;
}
-/**
- * Implement our own fullscreen logic
- */
-- (IBAction) toggleFullScreen:(id)sender {
- [CDVWindowSizeCommand toggleFullScreen:self.window];
-}
-
- (void) onAppDidFinishLaunching:(NSNotification*) notification {
if (_cfgFullScreen) {
[CDVWindowSizeCommand makeFullScreen:self.window];
@@ -328,4 +321,16 @@
{
}
+#pragma mark Menu Action Handlers
+/**
+ * Implement our own fullscreen logic
+ */
+- (IBAction) onFullscreen:(id)sender {
+ [CDVWindowSizeCommand toggleFullScreen:self.window];
+}
+
+- (IBAction) onPreferences:(id) sender {
+ // override or tweak menu item in plugin
+}
+
@end
http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/a4e66ddf/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
----------------------------------------------------------------------
diff --git a/bin/templates/project/__PROJECT_NAME__/MainViewController.xib b/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
index 91382ed..0863013 100644
--- a/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
+++ b/bin/templates/project/__PROJECT_NAME__/MainViewController.xib
@@ -19,11 +19,11 @@
# under the License.
#
-->
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13C64" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment version="1070" identifier="macosx"/>
- <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
- <plugIn identifier="com.apple.WebKitIBPlugin" version="5056"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
+ <plugIn identifier="com.apple.WebKitIBPlugin" version="9060"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication" colorLabel="IBBuiltInLabel-Green">
@@ -32,7 +32,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
- <customObject id="-3" userLabel="Application"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
<menu title="AMainMenu" systemMenu="main" id="29">
<items>
<menuItem title="__PROJECT_NAME__" id="56">
@@ -47,7 +47,11 @@
<menuItem isSeparatorItem="YES" id="236">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
- <menuItem title="Preferences…" keyEquivalent="," id="129"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="129">
+ <connections>
+ <action selector="onPreferences:" target="732" id="vnu-8N-0ci"/>
+ </connections>
+ </menuItem>
<menuItem isSeparatorItem="YES" id="143">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>
@@ -76,7 +80,7 @@
<menuItem title="Toggle Full Screen" keyEquivalent="f" id="afF-KY-ioe">
<modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
<connections>
- <action selector="toggleFullScreen:" target="732" id="nPq-se-igd"/>
+ <action selector="onFullscreen:" target="732" id="nPq-se-igd"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="149">
@@ -108,7 +112,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<rect key="contentRect" x="335" y="299" width="640" height="480"/>
- <rect key="screenRect" x="0.0" y="0.0" width="2560" height="1418"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
<value key="minSize" type="size" width="640" height="480"/>
<view key="contentView" horizontalHuggingPriority="1000" verticalHuggingPriority="1000" horizontalCompressionResistancePriority="1" verticalCompressionResistancePriority="1" id="372" userLabel="Content View">
<rect key="frame" x="0.0" y="0.0" width="640" height="480"/>
@@ -116,7 +120,7 @@
<subviews>
<webView horizontalHuggingPriority="1" verticalHuggingPriority="1" horizontalCompressionResistancePriority="1" verticalCompressionResistancePriority="1" translatesAutoresizingMaskIntoConstraints="NO" id="536">
<rect key="frame" x="0.0" y="0.0" width="640" height="480"/>
- <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
<webPreferences key="preferences" defaultFontSize="12" defaultFixedFontSize="12" plugInsEnabled="NO" javaEnabled="NO">
<nil key="identifier"/>
</webPreferences>
@@ -134,6 +138,7 @@
<constraint firstItem="536" firstAttribute="leading" secondItem="372" secondAttribute="leading" id="726"/>
<constraint firstItem="536" firstAttribute="top" secondItem="372" secondAttribute="top" id="727"/>
</constraints>
+ <animations/>
</view>
<connections>
<outlet property="delegate" destination="-2" id="743"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org