PrintFil.sgm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <!-- $XConsortium: PrintFil.sgm /main/8 1996/08/31 14:58:50 rws $ -->
  2. <!-- (c) Copyright 1996 Digital Equipment Corporation. -->
  3. <!-- (c) Copyright 1996 Hewlett-Packard Company. -->
  4. <!-- (c) Copyright 1996 International Business Machines Corp. -->
  5. <!-- (c) Copyright 1996 Sun Microsystems, Inc. -->
  6. <!-- (c) Copyright 1996 Novell, Inc. -->
  7. <!-- (c) Copyright 1996 FUJITSU LIMITED. -->
  8. <!-- (c) Copyright 1996 Hitachi. -->
  9. <![ %CDE.C.CDE; [<refentry id="CDE.XPRINT.DtPrintFillSetupData">]]>
  10. <![ %CDE.C.XO; [<refentry id="XCSA.XPRINT.DtPrintFillSetupData">]]>
  11. <refmeta><refentrytitle>
  12. DtPrintFillSetupData
  13. </refentrytitle><manvolnum>library call</manvolnum></refmeta><refnamediv>
  14. <refname><function>DtPrintFillSetupData</function></refname><refpurpose>
  15. obtains X printer connection information
  16. </refpurpose></refnamediv><refsynopsisdiv>
  17. <funcsynopsis>
  18. <funcsynopsisinfo>#include &lt;Print.h></funcsynopsisinfo>
  19. <funcdef>XtEnum <function>DtPrintFillSetupData</function></funcdef>
  20. <paramdef>Widget <parameter>wid</parameter></paramdef>
  21. <paramdef>DtPrintSetupData* <parameter>print_data</parameter></paramdef>
  22. </funcsynopsis>
  23. </refsynopsisdiv><refsect1>
  24. <title>DESCRIPTION</title>
  25. <para>The <function>DtPrintFillSetupData</function> function
  26. obtains an X printer connection in order
  27. to initiate an X printing job in situations other than direct
  28. interaction with a <function>DtPrintSetupBox</function>. Examples
  29. of such situations include a "quick print" button on a
  30. toolbar and "GUI-less" printing. This X printer connection information
  31. can be obtained from an existing <function>DtPrintSetupBox</function>
  32. widget instance, or if a
  33. <function>DtPrintSetupBox</function> widget instance is
  34. unavailable, <function>DtPrintFillSetupData</function>
  35. will provide a new X printer connection.
  36. </para>
  37. <para>A print job is typically initiated when the user selects the "Print"
  38. button from within a <function>DtPrintSetupBox</function> widget instance.
  39. Applications may
  40. wish to provide additional avenues for the user to initiate a print job,
  41. namely a "Quick Print" toolbar button, or a command line parameter to
  42. allow "GUI-less" printing, such as from within a desktop action.
  43. <function>DtPrintFillSetupData</function> is designed to provide
  44. an X printer connection in a
  45. manner consistent with <function>DtPrintSetupBox</function>.
  46. </para>
  47. <para>For both the "Quick Print" and "GUI-less" cases, the caller may set the
  48. <symbol role="Variable">printer_name</symbol> element of the passed
  49. <symbol role="Variable">print_data</symbol>
  50. in order to specify the destination X printer.
  51. <function>DtPrintFillSetupData</function> will treat the passed
  52. <symbol role="Variable">printer_name</symbol> as if the user had
  53. typed the printer name into the Printer
  54. Name text field of the <function>DtPrintSetupBox</function>.
  55. The <symbol role="Variable">printer_name</symbol> will be
  56. verified, and an X printer connection will be established. The returned
  57. <symbol role="Variable">printer_name</symbol> may be a fully qualified
  58. version of the passed <symbol role="Variable">printer_name</symbol>
  59. as a result of the printer verification process. For a description of
  60. this process, see the <systemitem class="resource">DtNverifyPrinterProc</systemitem>
  61. resource description in &cdeman.DtPrintSetupBox;.
  62. If <function>DtPrintFillSetupData</function> returns a
  63. new printer_name, it will free the passed
  64. <symbol role="Variable">printer_name</symbol> by calling
  65. <function>XtFree</function>.
  66. </para>
  67. <para>For the "Quick Print" button case,
  68. <function>DtPrintFillSetupData</function> is intended to
  69. be used with an existing
  70. <function>DtPrintSetupBox</function> instance, so that the "Quick
  71. Print" button behaves as if the user had brought up a
  72. <function>DtPrintSetupBox</function>, selected a printer as
  73. indicated by <symbol role="Variable">printer_name</symbol>,
  74. and activated the "Print" button. The following conditions
  75. apply to this case:
  76. </para>
  77. <itemizedlist>
  78. <listitem>
  79. <para>The <symbol role="Variable">wid</symbol>
  80. parameter should be set to the widget ID of the
  81. <function>DtPrintSetupBox</function> instance.
  82. <function>DtPrintFillSetupData</function> will fill the passed
  83. <symbol role="Variable">print_data</symbol> structure
  84. similarly to how
  85. <function>DtPrintSetupBox</function> fills out the
  86. <symbol role="Variable">print_data</symbol> element of the
  87. <StructName Role="typedef">DtPrintSetupCallbackStruct</StructName>
  88. passed as call data to the
  89. <Symbol>DtNprintCallback</Symbol> list. The only exception is that when using
  90. <function>DtPrintFillSetupData</function> it is the caller's
  91. responsibility to free the
  92. allocated memory locations pointed to by the
  93. <symbol role="Variable">print_data</symbol> structure
  94. by calling <function>DtPrintFreeSetupData</function>.
  95. </para>
  96. </listitem>
  97. <listitem>
  98. <para>The X printer connection returned is managed by the
  99. <function>DtPrintSetupBox</function>. The caller should
  100. not destroy the print context, nor
  101. close the print display connection.
  102. </para>
  103. </listitem>
  104. <listitem>
  105. <para>The <function>DtPrintSetupBox</function> widget
  106. instance passed via <symbol role="Variable">wid</symbol>
  107. does not have to have been managed prior to calling
  108. <function>DtPrintFillSetupData</function>.
  109. </para>
  110. </listitem>
  111. <listitem>
  112. <para>If the passed <symbol role="Variable">printer_name</symbol>
  113. is NULL, the current printer as indicated by
  114. the <systemitem class="resource">DtNprinterName</systemitem>
  115. resource will be used, and returned in
  116. <symbol role="Variable">printer_name</symbol>.
  117. If the passed <symbol role="Variable">printer_name</symbol>
  118. is a different printer than indicated by the
  119. current value of
  120. the <systemitem class="resource">DtNprinterName</systemitem>
  121. resource, the resource will be
  122. updated.
  123. </para>
  124. </listitem>
  125. <listitem>
  126. <para>The
  127. <symbol role="Variable">destination</symbol> and
  128. <symbol role="Variable">dest_info</symbol>
  129. elements of the passed
  130. <symbol role="Variable">print_data</symbol>
  131. will be set according to the current state of the
  132. passed <function>DtPrintSetupBox</function>.
  133. If <symbol role="Variable">dest_info</symbol>
  134. is set when passed to
  135. <function>DtPrintFillSetupData</function>,
  136. <function>DtPrintFillSetupData</function> will free the memory
  137. by calling <function>XtFree</function> if it decides to update
  138. If <symbol role="Variable">dest_info</symbol>.
  139. </para>
  140. </listitem>
  141. <listitem>
  142. <para>If a connection cannot be established, the
  143. <function>DtPrintSetupBox</function> will
  144. automatically be managed, displaying an error message box. After
  145. dismissing the message box, the user can select a new printer and
  146. restart the print operation, if desired.
  147. </para>
  148. </listitem>
  149. </itemizedlist>
  150. <para>For the "GUI-less" case,
  151. <function>DtPrintFillSetupData</function> is intended to provide an
  152. X printer connection, in a manner consistent with an X printer
  153. connection established by <function>DtPrintSetupBox</function>,
  154. without actually creating a <function>DtPrintSetupBox</function>.
  155. The following conditions apply to this case:
  156. </para>
  157. <itemizedlist>
  158. <listitem>
  159. <para>The passed <symbol role="Variable">wid</symbol> must be set to NULL.
  160. </para>
  161. </listitem>
  162. <listitem>
  163. <para>The X printer connection returned is managed by the caller,
  164. which means that the caller must destroy the print context
  165. (via <function>XpDestroyContext</function>) and close the
  166. print display connection (via <function>XCloseDisplay</function>).
  167. </para>
  168. </listitem>
  169. <listitem>
  170. <para>If <symbol role="Variable">printer_name</symbol> is
  171. set to NULL, <function>DtPrintFillSetupData</function>
  172. will determine a default printer, using the same procedure
  173. as <function>DtPrintSetupBox</function>, and set
  174. the <symbol role="Variable">printer_name</symbol> field
  175. to this default printer name upon return.
  176. </para>
  177. </listitem>
  178. <listitem>
  179. <para>The <symbol role="Variable">destination</symbol> and
  180. <symbol role="Variable">dest_info</symbol> elements of
  181. the passed <StructName Role="typedef">print_data</StructName>
  182. structure will be ignored by
  183. <function>DtPrintFillSetupData</function>.
  184. </para>
  185. </listitem>
  186. <listitem>
  187. <para>The caller can free the allocated memory locations pointed to by the
  188. returned <StructName Role="typedef">print_data</StructName> structure
  189. by calling <function>DtPrintFreeSetupData</function>.
  190. </para>
  191. </listitem>
  192. </itemizedlist>
  193. </refsect1><refsect1>
  194. <title>ARGUMENTS</title>
  195. <variablelist>
  196. <varlistentry><term><symbol role="Variable">wid</symbol></term>
  197. <listitem>
  198. <para>The widget ID of a <function>DtPrintSetupBox</function>
  199. or NULL, if no <function>DtPrintSetupBox</function> is available.
  200. </para>
  201. </listitem>
  202. </varlistentry>
  203. <varlistentry><term><symbol role="Variable">print_data</symbol></term>
  204. <listitem>
  205. <para>A pointer to an existing <StructName Role="typedef">DtPrintSetupData</StructName>
  206. structure that <function>DtPrintFillSetupData</function>
  207. will update with valid X printer connection
  208. information. See &cdeman.DtPrintSetupBox;
  209. for the definition of the
  210. <StructName Role="typedef">DtPrintSetupData</StructName> structure.
  211. </para>
  212. </listitem>
  213. </varlistentry>
  214. </variablelist>
  215. </refsect1>
  216. <refsect1>
  217. <title>RETURN VALUE</title>
  218. <variablelist>
  219. <varlistentry><term><systemitem class="constant">DtPRINT_SUCCESS</systemitem></term>
  220. <listitem>
  221. <para>The X printer connection was successfully obtained.
  222. </para>
  223. </listitem>
  224. </varlistentry>
  225. <varlistentry><term><systemitem class="constant">DtPRINT_INVALID_DISPLAY</systemitem></term>
  226. <listitem>
  227. <para>The indicated X print server could not be found.
  228. </para>
  229. </listitem>
  230. </varlistentry>
  231. <varlistentry><term><systemitem class="constant">DtPRINT_NOT_XP_DISPLAY</systemitem></term>
  232. <listitem>
  233. <para>The indicated X server does not support the X Printing Extension.
  234. </para>
  235. </listitem>
  236. </varlistentry>
  237. <varlistentry><term><systemitem class="constant">DtPRINT_NO_PRINTER</systemitem></term>
  238. <listitem>
  239. <para>The indicated printer could not be found on the X print server, or a
  240. default printer could not be determined.
  241. </para>
  242. </listitem>
  243. </varlistentry>
  244. <varlistentry><term><systemitem class="constant">DtPRINT_BAD_PARM</systemitem></term>
  245. <listitem>
  246. <para>The value passed for <symbol role="Variable">print_data</symbol>
  247. is NULL, or the value of the
  248. <systemitem class="resource">DtNprintSetupMode</systemitem>
  249. resource for <symbol role="Variable">wid</symbol> is not
  250. <systemitem class="constant">DtPRINT_SETUP_XP</systemitem>.
  251. </para>
  252. </listitem>
  253. </varlistentry>
  254. </variablelist>
  255. </refsect1>
  256. <refsect1>
  257. <title>ENVIRONMENT VARIABLES</title>
  258. <para>None.
  259. </para>
  260. </refsect1><refsect1>
  261. <title>RESOURCES</title>
  262. <para>None.</para>
  263. </refsect1><refsect1>
  264. <title>ACTIONS/MESSAGES</title>
  265. <para>None.
  266. </para>
  267. </refsect1><refsect1>
  268. <title>ERRORS/WARNINGS</title>
  269. <para>None.</para>
  270. </refsect1><refsect1>
  271. <title>EXAMPLES</title>
  272. <para>None.
  273. </para>
  274. </refsect1><refsect1>
  275. <title>FILES</title>
  276. <para>None.
  277. </para>
  278. </refsect1><refsect1>
  279. <title>SEE ALSO</title>
  280. <para>&cdeman.DtPrintCopySetupData;,
  281. &cdeman.DtPrintSetupBox;,
  282. &cdeman.DtPrintFreeSetupData;</para>
  283. </refsect1></refentry>