Skip to content

PrintCore macOS xcode14.0 beta1

Manuel de la Pena edited this page Aug 5, 2022 · 2 revisions

#PrintCore.framework ##mandel

diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PDEPluginInterface.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PDEPluginInterface.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PDEPluginInterface.h	2022-02-12 07:03:36.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PDEPluginInterface.h	2022-05-31 15:04:19.000000000 -0400
@@ -17,44 +17,50 @@
 #ifndef __PDEPLUGININTERFACE__
 #define __PDEPLUGININTERFACE__
 
-
+#ifdef __OBJC__
 
 #import <cups/cups.h>
 #import <cups/ppd.h>
 #import <Foundation/Foundation.h>
-#import <AppKit/AppKit.h>
-
-NS_ASSUME_NONNULL_BEGIN
+#import <PrintCore/PMDefinitions.h>
 
 @class NSView;
+@protocol PDEPanel;
+@protocol PDEPlugInCallbackProtocol;
+
+NS_ASSUME_NONNULL_BEGIN
 
 /*!
  * @name	PDEPlugIn
- * @abstract	An instance implementing methods in the PDEPlugIn informal protocol protocol
+ * @abstract	An instance implementing methods in the PDEPlugIn protocol
  *				acts as a factory for PDEPanels. The factory is provided with the type
  *				of printer panel needed (page setup or print dialog) as well as
  *				the current printer. It can use this information to determine which
  *				PDEPanels should be created.
  *
  */
-@interface NSObject(PDEPlugIn)
+@protocol PDEPlugIn <NSObject>
 
 /*!
  * @method		initWithBundle:
- * @abstract	Called once when the PDE plug-in is loaded. When using a sandbox
- *				application, if the PDE plug-in does not declare itself sandbox-compatible, 
- *				the PDE is loaded to get its name and is then unloaded. The PDE is reloaded when 
- *				it is selected in the PDE menu or when the user selects the print button.
+ * @abstract	Called to instantiate the principal class of the PDE plug-in.
+ *
+ * @discussion	Prior to macOS 13, PDE plug-ins were instantiated with -init, and after
+ *				that -initWithBundle: was called expecting a BOOL return. In macOS 13
+ *				and later, PDE plug-ins that conform to the PDEPlugIn protocol will be
+ *				instantiated with -initWithBundle: as the sole initializer method, returning
+ *				the usual instancetype. PDE plug-ins that do not conform to PDEPlugIn
+ *				will be instantiated in the old two step way.
  *
  * @param theBundle		The plug-in's bundle.
  *
- * @result	Returns YES if initialization succeeded and NO otherwise.
+ * @result	Return a valid instance if initialization succeeded and nil otherwise.
  */
-- (BOOL)initWithBundle:(NSBundle*)theBundle;
+- (nullable instancetype)initWithBundle:(NSBundle*)theBundle; /* NS_DESIGNATED_INITIALIZER */
 
 /*!
  * @method		PDEPanelsForType:withHostInfo:
- * @abstract	Returns an array of instances conforming to the PDEPanel informal protocol.
+ * @abstract	Returns an array of instances conforming to the PDEPanel protocol.
  *
  * @param		pdeType	The type of print panels that should be returned. These kinds are
  *				defined in PMPrintingDialogExtensions.h and include:
@@ -63,16 +69,16 @@
  *					kGeneralPrintDialogTypeIDStr
  *						- Panels that should be shown in the print dialog.
  *
- * @param	host	A print system provided instance that implements methods from the informal protocol
+ * @param	host	A print system provided instance that implements methods from the protocol
  *					PDEPlugInCallbackProtocol. The PDEPlugIn can use this parameter to
  *					obtain the current printer or print setting in order to filter the
  *					available panels if there are printer specific PDEPanels in the PDEPlugIn.	
  *
- * @result	An array of instances implementing methods from the PDEPanel informal protocol.
+ * @result	An array of instances implementing methods from the PDEPanel protocol.
  *			Each instance represents a panel that will be shown in the printer dialog.
  *			The method may return either nil or an empty array if no panels should be used.
  */
-- (nullable NSArray*)PDEPanelsForType:(NSString*)pdeType withHostInfo:(id)host;
+- (nullable NSArray<id<PDEPanel>>*)PDEPanelsForType:(NSString*)pdeType withHostInfo:(id<PDEPlugInCallbackProtocol>)host;
 
 @end
 
@@ -80,11 +86,13 @@
 /*!
  * @name	PDEPanel
  * @abstract	A print dialog plugin should have an instance implementing methods
- *				from the PDEPanel informal protocol. Each such instance handles a single
+ *				from the PDEPanel protocol. Each such instance handles a single
  *				print dialog panel.
  *
  */
-@interface NSObject(PDEPanel)
+@protocol PDEPanel <NSObject>
+
+@required
 
 /*!
  * @method		willShow
@@ -145,6 +153,8 @@
  */
 - (BOOL)restoreValuesAndReturnError:(NSError**)error;
 
+@optional
+
 /*!
  * @method		supportedPPDOptionKeys
  * @abstract	The panel takes responsability for displaying user interface elements for the
@@ -153,7 +163,9 @@
  * @discussion	Any PPD option keys not claimed by a PDEPanel are provided with a dynamically built
  *				user interface in the Printer Features panel.
  */
-- (nullable NSArray*)supportedPPDOptionKeys;
+- (nullable NSArray<NSString *>*)supportedPPDOptionKeys;
+
+@required
 
 /*!
  * @method		PPDOptionKeyValueDidChange
@@ -223,7 +235,9 @@
  *				current user. For example a key in the dictionary for the copies and
  *				pages panel might have the key 'Page Range' and the value 'All'.
  */
-- (NSDictionary * _Nullable)summaryInfo;
+- (NSDictionary<NSString *, NSString *> * _Nullable)summaryInfo;
+
+@optional
 
 /*!
  * @method		shouldShowHelp
@@ -288,11 +302,11 @@
 
 /*!
  * @name	PDEPlugInCallbackProtocol
- * @abstract	An informal protocol implemented by the print system so
+ * @abstract	A protocol implemented by the print system so
  *				that printing dialog extensions can obtain information
  *				about the current printer and print job.
  *
- * @discussion	An print system created instance implementing the informal protocol,
+ * @discussion	An print system created instance implementing the protocol,
  *				PDEPlugInCallbackProtocol, is passed to PDEPlugin as part of the PDEPlugIn's
  *				PDEPanelsForType:withHostInfo: message. The PDEPlugIn is expected to
  *				hold on to the passed in instance and to use this PDEPlugInCallbackProtocol
@@ -300,7 +314,7 @@
  *				pass the instance implementing PDEPlugInCallbackProtocol to PDEPanels
  *				as needed.
  */
-@interface NSObject(PDEPlugInCallbackProtocol)
+@protocol PDEPlugInCallbackProtocol
 
 /*!
  * @method		printSession
@@ -387,5 +401,7 @@
 
 NS_ASSUME_NONNULL_END
 
+#endif /* __OBJC__ */
+
 #endif /* __PDEPLUGININTERFACE__ */
 
diff -ruN /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PrintCore.h /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PrintCore.h
--- /Applications/Xcode_13.3.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PrintCore.h	2022-02-12 07:03:36.000000000 -0500
+++ /Applications/Xcode_14.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/PrintCore.framework/Headers/PrintCore.h	2022-05-21 08:18:25.000000000 -0400
@@ -22,6 +22,10 @@
 #include <ColorSync/ColorSync.h>
 #endif
 
+#ifndef __PDEPLUGININTERFACE__
+#include <PrintCore/PDEPluginInterface.h>
+#endif
+
 #ifndef __PMDEFINITIONS__
 #include <PrintCore/PMDefinitions.h>
 #endif
@@ -34,6 +38,10 @@
 #include <PrintCore/PMPrintAETypes.h>
 #endif
 
+#ifndef __PMPRINTINGDIALOGEXTENSIONS__
+#include <PrintCore/PMPrintingDialogExtensions.h>
+#endif
+
 #ifndef __PMPRINTSETTINGSKEYS__
 #include <PrintCore/PMPrintSettingsKeys.h>
 #endif
Clone this wiki locally