/src/wrappers/gtk/library/gtk_print_unix_dialog.e

http://github.com/tybor/Liberty · Specman e · 190 lines · 82 code · 25 blank · 83 comment · 4 complexity · a62e6da8bbdbec3cebcff30e4c75af40 MD5 · raw file

  1. indexing
  2. description: "GtkPrintUnixDialog -- A print dialog."
  3. copyright: "[
  4. Copyright (C) 2007 Paolo Redaelli, GTK+ team
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public License
  7. as published by the Free Software Foundation; either version 2.1 of
  8. the License, or (at your option) any later version.
  9. This library is distributed in the hopeOA that it will be useful, but
  10. WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General Public
  14. License along with this library; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  16. 02110-1301 USA
  17. ]"
  18. wrapped_version: "2.10.6"
  19. class GTK_PRINT_UNIX_DIALOG
  20. -- GtkPrintUnixDialog implements a print dialog for platforms which don't
  21. -- provide a native print dialog, like Unix. It can be used very much like
  22. -- any other GTK+ dialog, at the cost of the portability offered by the
  23. -- high-level printing API
  24. -- In order to print something with GtkPrintUnixDialog, you need to use
  25. -- gtk_print_unix_dialog_get_selected_printer() to obtain a GtkPrinter object
  26. -- and use it to construct a GtkPrintJob using gtk_print_job_new().
  27. -- GtkPrintUnixDialog uses the following response values:
  28. -- GTK_RESPONSE_OK for the "Print" button
  29. -- GTK_RESPONSE_APPLY for the "Preview" button
  30. -- GTK_RESPONSE_CANCEL for the "Cancel" button
  31. -- Printing support was added in GTK+ 2.10.
  32. inherit
  33. GTK_DIALOG
  34. rename
  35. make as dialog_make
  36. undefine
  37. struct_size
  38. end
  39. -- TODO: GtkPrintUnixDialog implements AtkImplementorIface.
  40. insert
  41. GTK_PRINT_UNIX_DIALOG_EXTERNALS
  42. GTK_PRINT_CAPABILITIES
  43. creation make, from_external_pointer
  44. feature {} -- Creation
  45. make (a_title: STRING; a_parent: GTK_WINDOW) is
  46. -- Creates a new GtkPrintUnixDialog with `a_title' and `a_parent' as
  47. -- the transient parent of the dialog. Both `a_title' and `a_parent'
  48. -- can be Void.
  49. local tp, pp: POINTER
  50. do
  51. if a_title/=Void then tp:=a_title.to_external end
  52. if a_parent/=Void then pp:=a_parent.handle end
  53. from_external_pointer(gtk_print_unix_dialog_new(tp,pp))
  54. end
  55. feature
  56. set_page_setup (a_setup: GTK_PAGE_SETUP) is
  57. -- Sets the page setup of the GtkPrintUnixDialog.
  58. require setup_not_void: a_setup/=Void
  59. do
  60. gtk_print_unix_dialog_set_page_setup(handle,a_setup.handle)
  61. end
  62. page_setup: GTK_PAGE_SETUP is
  63. -- the page setup of dialog.
  64. do
  65. create Result.from_external_pointer(gtk_print_unix_dialog_get_page_setup(handle))
  66. end
  67. set_current_page (a_page: INTEGER) is
  68. -- Sets the current page number. If `a_page' is not -1, this enables
  69. -- the current page choice for the range of pages to print.
  70. do
  71. gtk_print_unix_dialog_set_current_page(handle,a_page)
  72. end
  73. current_page: INTEGER is
  74. -- the current page of dialog
  75. do
  76. Result:=gtk_print_unix_dialog_get_current_page(handle)
  77. end
  78. set_settings (some_settings: GTK_PRINT_SETTINGS) is
  79. -- Sets the GtkPrintSettings for the GtkPrintUnixDialog to
  80. -- `some_settings' that can be Void. Typically, this is used to restore
  81. -- saved print settings from a previous print operation before the
  82. -- print dialog is shown.
  83. do
  84. gtk_print_unix_dialog_set_settings(handle,null_or(some_settings))
  85. end
  86. settings: GTK_PRINT_SETTINGS is
  87. -- a new GtkPrintSettings object that represents the current values in
  88. -- the print dialog.
  89. do
  90. create Result.from_external_pointer(gtk_print_unix_dialog_get_settings(handle))
  91. -- Note: the original C documantation says "Note that this creates a
  92. -- new object, and you need to unref it if don't want to keep
  93. -- it". Since GTK_PRINT_SETTINGS is a G_OBJECT that ref the underlying
  94. -- C structure during `from_external_pointer' we can safely unref it
  95. -- here and let the Garbage Collector handle it nicely.
  96. Result.unref
  97. ensure not_void: Result/=Void
  98. end
  99. selected_printer: GTK_PRINTER is
  100. -- the currently selected printer
  101. do
  102. create Result.from_external_pointer(handle)
  103. ensure not_void: Result/=Void
  104. end
  105. add_custom_tab (a_tab, a_label: GTK_WIDGET) is
  106. -- Adds `a_tab' to the print dialog as a custom tab using `a_label'.
  107. do
  108. gtk_print_unix_dialog_add_custom_tab(handle,a_tab.handle,a_label.handle)
  109. end
  110. set_manual_capabilities (some_capabilities: INTEGER) is
  111. -- Specify the printing capabilities your application
  112. -- supports. For instance, if you can handle scaling the
  113. -- output then you pass `gtk_print_capability_scale'. If you
  114. -- don't pass that, then the dialog will only let you select
  115. -- the scale if the printing system automatically handles
  116. -- scaling.
  117. require valid_capabilities: are_valid_print_capabilities(some_capabilities)
  118. do
  119. gtk_print_unix_dialog_set_manual_capabilities(handle,some_capabilities)
  120. end
  121. feature -- TODO: Properties
  122. -- "current-page" gint : Read / Write
  123. -- "page-setup" GtkPageSetup : Read / Write
  124. -- "print-settings" GtkPrintSettings : Read / Write
  125. -- "selected-printer" GtkPrinter : Read
  126. --Property Details
  127. --
  128. -- The "current-page" property
  129. --
  130. -- "current-page" gint : Read / Write
  131. --
  132. -- The current page in the document.
  133. --
  134. -- Allowed values: >= -1
  135. --
  136. -- Default value: -1
  137. --
  138. -- --------------------------------------------------------------------------
  139. --
  140. -- The "page-setup" property
  141. --
  142. -- "page-setup" GtkPageSetup : Read / Write
  143. --
  144. -- The GtkPageSetup to use.
  145. --
  146. -- --------------------------------------------------------------------------
  147. --
  148. -- The "print-settings" property
  149. --
  150. -- "print-settings" GtkPrintSettings : Read / Write
  151. --
  152. -- The GtkPrintSettings used for initializing the dialog.
  153. --
  154. -- --------------------------------------------------------------------------
  155. --
  156. -- The "selected-printer" property
  157. --
  158. -- "selected-printer" GtkPrinter : Read
  159. --
  160. -- The GtkPrinter which is selected.
  161. --
  162. --See Also
  163. --
  164. -- GtkPageSetupUnixDialog, GtkPrinter, GtkPrintJob
  165. end -- class GTK_PRINT_UNIX_DIALOG