Back to index

lightning-sunbird  0.9+nobinonly
PDECustom.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2002
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Conrad Carlen <ccarlen@netscape.com>
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either the GNU General Public License Version 2 or later (the "GPL"), or
00027  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef __PDECUSTOM__
00040 #define __PDECUSTOM__
00041 
00042 #ifndef nsPDECommon_h___
00043 #include "nsPDECommon.h"
00044 #endif
00045 
00046 /*
00047 --------------------------------------------------------------------------------
00048 **  kMyBundleIdentifier
00049 **  
00050 **  The identifier that's also used as the CFBundleIdentifier entry in the
00051 **  property list. This ID should always be a unique string in Java-style
00052 **  package format (substitute your vendor domain for "com.appvendor").
00053 **  
00054 --------------------------------------------------------------------------------
00055 */
00056 
00057 #define  kMyBundleIdentifier \
00058             CFSTR("org.mozilla.pde." kMozPDESignature)
00059 
00060 /*
00061 --------------------------------------------------------------------------------
00062 **  kMyPaneKindID
00063 **  
00064 **  For application-hosted PDEs, this unique Java-style package name is used
00065 **  to identify your custom pane. Here we simply use the bundle identifier.
00066 **  
00067 **  For printer module-hosted PDEs, a unique Java-style package name is
00068 **  recommended too, unless you are overriding a standard (Apple-supplied)
00069 **  pane -- then you should use the appropriate kind ID constant from
00070 **  PMPrintingDialogExtensions.h.
00071 **
00072 --------------------------------------------------------------------------------
00073 */
00074 
00075 #define  kMyPaneKindID  kMyBundleIdentifier
00076 
00077 
00078 /*
00079 --------------------------------------------------------------------------------
00080 **  kMyNibFile
00081 **  
00082 **  The name of your nib file (without the ".nib" extension).
00083 **  
00084 --------------------------------------------------------------------------------
00085 */
00086 
00087 #define  kMyNibFile  CFSTR("PrintPDE")
00088 
00089 /*
00090 --------------------------------------------------------------------------------
00091 **  kMyNibWindow
00092 **  
00093 **  The name of the Carbon window created from the nib interface.
00094 **  
00095 --------------------------------------------------------------------------------
00096 */
00097 
00098 #define  kMyNibWindow  CFSTR("PrintPDE")
00099 
00100 
00101 /*
00102 --------------------------------------------------------------------------------
00103 **  kMyAppPrintSettingsKey
00104 **  
00105 **  In order to use the print settings ticket, your application-hosted PDE
00106 **  needs to define a ticket data storage and retrieval key by concatenating
00107 **  this standard prefix with its unique 4-byte signature.
00108 **  
00109 --------------------------------------------------------------------------------
00110 */
00111 
00112 #define  kMyAppPrintSettingsKey \
00113             CFSTR("com.apple.print.PrintSettingsTicket." kMozPDESignature)
00114 
00115 /*
00116 --------------------------------------------------------------------------------
00117 **  kMyAppPageFormatKey
00118 **  
00119 **  In order to use the page format ticket, your application-hosted PDE
00120 **  needs to define a ticket data storage and retrieval key by concatenating
00121 **  this standard prefix with its unique 4-byte signature.
00122 **
00123 --------------------------------------------------------------------------------
00124 */
00125 
00126 #define  kMyAppPageFormatKey \
00127             CFSTR("com.apple.print.PageFormatTicket." kMozPDESignature)
00128 
00129 
00130 /*
00131 --------------------------------------------------------------------------------
00132     If you provide user assistance using Help Viewer, define these two
00133     constants. Otherwise, comment them out.
00134 --------------------------------------------------------------------------------
00135 */
00136 
00137 //#define  kMyHelpFolder  CFSTR("Help")
00138 //#define  kMyHelpFile    CFSTR("help.html")
00139 
00140 
00141 /*
00142 --------------------------------------------------------------------------------
00143     vertical and horizontal extent in pixels needed to display your
00144     custom interface
00145 --------------------------------------------------------------------------------
00146 */
00147 
00148 enum {
00149     kMyMaxV = 292,
00150     kMyMaxH = 478
00151 };
00152 
00153 /*
00154 --------------------------------------------------------------------------------
00155     Indexes of radio buttons in our radio group control
00156 --------------------------------------------------------------------------------
00157 */
00158 
00159 enum {
00160     kFramesAsLaidOutIndex = 1,
00161     kFramesSelectedIndex,
00162     kFramesEachSeparatelyIndex,
00163 };
00164 
00165 /*
00166 --------------------------------------------------------------------------------
00167     data types for a context that represents the state of the controls
00168     in an instance of your custom interface
00169 --------------------------------------------------------------------------------
00170 */
00171 
00172 typedef struct {
00173     ControlRef frameRadioGroup;
00174     ControlRef printSelCheck;
00175     ControlRef shrinkToFitCheck;
00176     ControlRef printBGColorsCheck;
00177     ControlRef printBGImagesCheck;
00178     ControlRef headerLeftPopup;
00179     ControlRef headerCenterPopup;
00180     ControlRef headerRightPopup;
00181     ControlRef footerLeftPopup;
00182     ControlRef footerCenterPopup;
00183     ControlRef footerRightPopup;
00184 } MyControls;
00185 
00186 typedef struct {
00187   // State info supplied by printing app
00188   Boolean mHaveSelection;
00189   Boolean mHaveFrames;
00190   Boolean mHaveFrameSelected;
00191   // The UI of the PDE allows control of these
00192   Boolean mPrintFrameAsIs;
00193   Boolean mPrintSelectedFrame;
00194   Boolean mPrintFramesSeparately;
00195   Boolean mPrintSelection;
00196   Boolean mShrinkToFit;
00197   Boolean mPrintBGColors;
00198   Boolean mPrintBGImages;
00199   CFStringRef mHeaderLeft, mHeaderCenter, mHeaderRight;
00200   CFStringRef mFooterLeft, mFooterCenter, mFooterRight;
00201 } MySettings;
00202 
00203 typedef struct {
00204     MyControls controls;
00205     MySettings settings;
00206 } MyCustomContextBlock;
00207 
00208 typedef MyCustomContextBlock *MyCustomContext;
00209 
00210 
00211 /*
00212 --------------------------------------------------------------------------------
00213     functions you need to implement in your custom code
00214 --------------------------------------------------------------------------------
00215 */
00216 
00217 /*
00218     Sometime after calling MyGetCustomTitle (TRUE) to get the localized title
00219     of your custom pane, we call MyGetCustomTitle (FALSE) to release the copy.
00220 */
00221 
00222 extern CFStringRef  MyGetCustomTitle (Boolean stillNeeded);
00223 
00224 extern MyCustomContext  MyCreateCustomContext();
00225 extern void             MyReleaseCustomContext (MyCustomContext);
00226 
00227 extern OSStatus  MyEmbedCustomControls  (MyCustomContext, WindowRef, ControlRef);
00228 extern OSStatus  MyGetSummaryText       (MyCustomContext, CFMutableArrayRef, CFMutableArrayRef);
00229 extern OSStatus  MySyncPaneFromTicket   (MyCustomContext, PMPrintSession);
00230 extern OSStatus  MySyncTicketFromPane   (MyCustomContext, PMPrintSession);
00231 
00232 
00233 #endif