PageRenderTime 83ms CodeModel.GetById 57ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 1ms

/src/wrappers/gtk/library/gtk_print_operation.e

http://github.com/tybor/Liberty
Specman e | 1059 lines | 164 code | 71 blank | 824 comment | 5 complexity | 39dbfb4de6893e254835d71582c897a6 MD5 | raw file
   1indexing
   2	description: "GtkPrintOperation: High-level Printing API."
   3	copyright: "[
   4					Copyright (C) 2007 Paolo Redaelli, GTK+ team
   5					
   6					This library is free software; you can redistribute it and/or
   7					modify it under the terms of the GNU Lesser General Public License
   8					as published by the Free Software Foundation; either version 2.1 of
   9					the License, or (at your option) any later version.
  10					
  11					This library is distributed in the hopeOA that it will be useful, but
  12					WITHOUT ANY WARRANTY; without even the implied warranty of
  13					MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14					Lesser General Public License for more details.
  15
  16					You should have received a copy of the GNU Lesser General Public
  17					License along with this library; if not, write to the Free Software
  18					Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  19					02110-1301 USA
  20			]"
  21
  22	wrapped_version: "2.10.6"
  23
  24class GTK_PRINT_OPERATION
  25	-- GTK_PRINT_OPERATION is the high-level, portable printing API. It
  26	-- looks a bit different than other GTK+ dialogs such as the
  27	-- GtkFileChooser, since some platforms don't expose enough
  28	-- infrastructure to implement a good print dialog. On such
  29	-- platforms, GtkPrintOperation uses the native print dialog.  On
  30	-- platforms which do not provide a native print dialog, GTK+ uses
  31	-- its own, see GtkPrintUnixDialog.
  32	
  33	-- The typical way to use the high-level printing API is to create
  34	-- a GtkPrintOperation object with `make' when the user selects to
  35	-- print. Then you set some properties on it, e.g. the page size,
  36	-- any GtkPrintSettings from previous print operations, the number
  37	-- of pages, the current page, etc.
  38
  39	-- Then you start the print operation by calling `run'.  It will
  40	-- then show a dialog, let the user select a printer and options.
  41	-- When the user finished the dialog various signals will be
  42	-- emitted on the GtkPrintOperation, the main one being
  43	-- ::draw-page, which you are supposed to catch and render the page
  44	-- on the provided GtkPrintContext using Cairo.
  45
  46	-- TODO: Eiffellize this C Example: The high-level printing API
  47
  48	-- static GtkPrintSettings *settings = NULL;
  49	--
  50	-- static void
  51	-- do_print (void)
  52	-- {
  53	--   GtkPrintOperation *print;
  54	--   GtkPrintOperationResult res;
  55	--
  56	--   print = gtk_print_operation_new ();
  57	--
  58	--   if (settings != NULL)
  59	--     gtk_print_operation_set_print_settings (print, settings);
  60	--
  61	--   g_signal_connect (print, "begin_print", G_CALLBACK (begin_print), NULL);
  62	--   g_signal_connect (print, "draw_page", G_CALLBACK (draw_page), NULL);
  63	--
  64	--   res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
  65	--                                  GTK_WINDOW (main_window), NULL);
  66	--
  67	--   if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
  68	--     {
  69	--       if (settings != NULL)
  70	--         g_object_unref (settings);
  71	--       settings = g_object_ref (gtk_print_operation_get_print_settings (print));
  72	--     }
  73	--
  74	--   g_object_unref (print);
  75	-- }
  76
  77	--   By default GtkPrintOperation uses an external application to do print
  78	--   preview. To implement a custom print preview, an application must connect
  79	--   to the preview signal. The functions
  80	--   GTK_PRINT_OPERATION_PRINT_preview_render_page(),
  81	--   gtk_print_operation_preview_end_preview() and
  82	--   gtk_print_operation_preview_is_selected() are useful when implementing a
  83	--   print preview.
  84
  85	--   Printing support was added in GTK+ 2.10.
  86
  87inherit 
  88	G_OBJECT
  89	GTK_PRINT_OPERATION_PREVIEW
  90		redefine
  91			struct_size
  92		end
  93	
  94insert
  95	GTK_PRINT_OPERATION_EXTERNALS
  96	GTK_PRINT_OPERATION_ACTIONS
  97	G_OBJECT_FACTORY[GTK_PAGE_SETUP]
  98		-- SHARED_G_ERROR
  99	GTK -- to get error
 100	
 101creation make, from_external_pointer
 102
 103feature {} -- Creation
 104	make is 
 105			-- Creates a new GtkPrintOperation.
 106		do
 107			from_external_pointer(gtk_print_operation_new)
 108		end
 109
 110feature -- Setters
 111	set_allow_async (a_setting: BOOLEAN) is
 112			-- Sets whether the `run' feature may return before the print
 113			-- operation is completed. Note that some platforms may not
 114			-- allow asynchronous operation. Make `a_setting' True to
 115			-- allow asynchronous operation.
 116		do
 117			gtk_print_operation_set_allow_async(handle, a_setting.to_integer) 
 118		ensure set: a_setting = async_allowed
 119		end
 120
 121	set_default_page_setup (a_default_page_setup: GTK_PAGE_SETUP) is
 122			-- Makes `a_default_page_setup' the default page setup.
 123			
 124			-- This page setup will be used by gtk_print_operation_run(),
 125			-- but it can be overridden on a per-page basis by connecting
 126			-- to the ::request-page-setup signal.
 127
 128			-- `a_default_page_setup' can be Void. TODO: what's the 
 129			-- meaning of a Void page setup?
 130
 131		do
 132			gtk_print_operation_set_default_page_setup
 133			(handle, null_or(a_default_page_setup))
 134		end
 135
 136	set_print_settings (some_print_settings: GTK_PRINT_SETTINGS) is
 137			-- Sets the print settings. This is typically used to
 138			-- re-establish print settings from a previous print
 139			-- operation, see `run'.
 140			
 141			-- `some_print_settings' can be Void.
 142		do
 143			gtk_print_operation_set_print_settings
 144			(handle, null_or(some_print_settings))
 145		end
 146
 147	set_job_name (a_job_name: STRING) is
 148			-- Sets the name of the print job. The name is used to
 149			-- identify the job (e.g.  in monitoring applications like
 150			-- eggcups). If you don't set a job name, GTK+ picks a
 151			-- default one by numbering successive print jobs.
 152		require name_not_void: a_job_name /= Void
 153		do
 154			gtk_print_operation_set_job_name(handle,a_job_name.to_external)
 155		end
 156
 157	set_n_pages (a_number: INTEGER) is
 158			-- Sets the number of pages in the document.
 159
 160			-- This must be set to a positive number before the rendering
 161			-- starts. It may be set in a ::begin-print signal hander.
 162	
 163			-- Note that the page numbers passed to the
 164			-- ::request-page-setup and ::draw-page signals are 0-based,
 165			-- i.e. if the user chooses to print all pages, the last
 166			-- ::draw-page signal will be for page n_pages - 1.  
 167		require non_negative: a_number>=0
 168		do
 169			gtk_print_operation_set_n_pages (handle, a_number)
 170		end
 171
 172	set_current_page (a_current_page_number: INTEGER) is
 173			-- Sets the current page; `a_current_page_number'
 174		
 175			-- If this is called before `run', the user will be able to
 176			-- select to print only the current page.
 177		
 178			-- Note that this only makes sense for pre-paginated documents.
 179		do
 180			gtk_print_operation_set_current_page(handle,a_current_page_number)
 181		end
 182
 183	set_use_full_page (a_setting: BOOLEAN) is
 184			-- If `a_setting' is True, the transformation for the cairo
 185			-- context obtained from GTK_PRINT_CONTEXT puts the origin at
 186			-- the top left corner of the page (which may not be the top
 187			-- left corner of the sheet, depending on page orientation
 188			-- and the number of pages per sheet). Otherwise, the origin
 189			-- is at the top left corner of the imageable area
 190			-- (i.e. inside the margins).
 191		do
 192			gtk_print_operation_set_use_full_page(handle, a_setting.to_integer)
 193		end
 194
 195	set_unit (a_unit: INTEGER) is
 196			-- Sets up the transformation for the cairo context obtained
 197			-- from GtkPrintContext in such a way that distances are
 198			-- measured in `a_unit'.
 199		require valid_unit: is_valid_gtk_unit(a_unit)
 200		do
 201			gtk_print_operation_set_unit (handle, a_unit)
 202		end
 203
 204	set_export_filename (a_file_name: STRING) is
 205			-- Sets up the GtkPrintOperation to generate a file instead
 206			-- of showing the print dialog. The indended use of this
 207			-- function is for implementing "Export to PDF"
 208			-- actions. Currently, PDF is the only supported format.
 209			
 210			-- "Print to PDF" support is independent of this and is done
 211			-- by letting the user pick the "Print to PDF" item from the
 212			-- list of printers in the print dialog.
 213		require name_not_void: a_file_name/=Void
 214		do
 215			gtk_print_operation_set_export_filename(handle,
 216																 a_file_name.to_external)
 217		end
 218
 219	set_show_progress (a_setting: BOOLEAN) is
 220			-- If `a_setting' is True, the print operation will show a
 221			-- progress dialog during the print operation.
 222		do
 223			gtk_print_operation_set_show_progress(handle,a_setting.to_integer)
 224		end
 225	
 226	set_track_print_status (a_setting: BOOLEAN) is
 227			-- If `a_setting' is True, the print operation will try to
 228			-- continue report on the status of the print job in the
 229			-- printer queues and printer. This can allow your
 230			-- application to show things like "out of paper" issues, and
 231			-- when the print job actually reaches the printer.
 232
 233			-- This feature is often implemented using some form of
 234			-- polling, so it should not be enabled unless needed.
 235		do
 236			gtk_print_operation_set_track_print_status
 237			(handle,a_setting.to_integer)
 238		end
 239
 240	set_custom_tab_label (a_label: STRING) is
 241			-- Sets the label for the tab holding custom widgets to 
 242			-- `a_label'; if Void the default label is used
 243		do
 244			if a_label=Void then
 245				gtk_print_operation_set_custom_tab_label(handle,default_pointer)
 246			else
 247				gtk_print_operation_set_custom_tab_label(handle,a_label.to_external)
 248			end
 249		end
 250	
 251feature -- Getters
 252	-- TODO: void        gtk_print_operation_get_error   (GtkPrintOperation *op,
 253	--                                              GError **error);
 254	
 255	--   Call this when the result of a print operation is
 256	--   GTK_PRINT_OPERATION_RESULT_ERROR, either as returned by
 257	--   gtk_print_operation_run(), or in the ::done signal handler. The returned
 258	--   GError will contain more details on what went wrong.
 259	--
 260	--   op :    a GtkPrintOperation
 261	--   error : return location for the error
 262	--
 263
 264	default_page_setup: GTK_PAGE_SETUP is
 265			-- The default page setup. Can be Void
 266		local ptr: POINTER; r: G_OBJECT_EXPANDED_FACTORY[GTK_PAGE_SETUP]
 267		do
 268			ptr:=gtk_print_operation_get_default_page_setup(handle)
 269			if ptr.is_not_null then
 270				Result := existant_wrapper(ptr)
 271				if Result=Void then
 272					create Result.from_external_pointer(ptr)
 273				end    				
 274			end
 275		end
 276
 277	settings: GTK_PRINT_SETTINGS is
 278			-- The current print settings. Void until either
 279			-- `set_print_settings' or `run' have been called.
 280		local factory: G_OBJECT_EXPANDED_FACTORY[GTK_PRINT_SETTINGS]
 281		do
 282			Result := factory.wrapper_or_void (gtk_print_operation_get_print_settings(handle))
 283		end
 284
 285	operation_result: INTEGER
 286			-- The result of the last `run' call.
 287		
 288	run (an_action: INTEGER; a_parent: GTK_WINDOW) is
 289			-- Runs the print operation, by first letting the user modify
 290			-- print settings in the print dialog, and then print the
 291			-- document.
 292
 293			-- Normally that this function does not return until the
 294			-- rendering of all pages is complete. You can connect to the
 295			-- ::status-changed signal on op to obtain some information
 296			-- about the progress of the print operation.
 297
 298			-- Furthermore, it may use a recursive mainloop to show the
 299			-- print dialog.
 300			
 301			-- If you call `set_allow_async' (which changes the
 302			-- allow-async property) the operation will run asyncronously
 303			-- if this is supported on the platform. The ::done signal
 304			-- will be emitted with the operation results when the
 305			-- operation is done (i.e. when the dialog is canceled, or
 306			-- when the print succeeds or fails).
 307
 308			--   parent :  Transient parent of the dialog, or NULL
 309			--   error :   Return location for errors, or NULL
 310
 311			-- `status' will be the result of the print operation. A
 312			-- return value of `gtk_print_operation_result_apply'
 313			-- indicates that the printing was completed successfully. In
 314			-- this case, it is a good idea to store the used print
 315			-- settings (the `settings' feature) reuse with the next
 316			-- print operation. A value of
 317			-- `gtk_print_operation_result_in_progress' means the
 318			-- operation is running asynchronously, and will emit the
 319			-- ::done signal when done.
 320
 321			-- TODO: Eiffellize the following example:
 322		
 323			-- if (settings != NULL)
 324			--   gtk_print_operation_set_print_settings (print, settings);
 325			--
 326			-- if (page_setup != NULL)
 327			--   gtk_print_operation_set_default_page_setup (print, page_setup);
 328			--
 329			-- g_signal_connect (print, "begin-print",
 330			--                   G_CALLBACK (begin_print), &data);
 331			-- g_signal_connect (print, "draw-page",
 332			--                   G_CALLBACK (draw_page), &data);
 333			--
 334			-- res = gtk_print_operation_run (print, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG, parent, &error);
 335			--
 336			-- if (res == GTK_PRINT_OPERATION_RESULT_ERROR)
 337			--  {
 338			--    error_dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
 339			--                                              GTK_DIALOG_DESTROY_WITH_PARENT,
 340			--                                              GTK_MESSAGE_ERROR,
 341			--                                              GTK_BUTTONS_CLOSE,
 342			--                                              "Error printing file:\ns",
 343			--                                              error->message);
 344			--    g_signal_connect (error_dialog, "response",
 345			--                      G_CALLBACK (gtk_widget_destroy), NULL);
 346			--    gtk_widget_show (error_dialog);
 347			--    g_error_free (error);
 348			--  }
 349			-- else if (res == GTK_PRINT_OPERATION_RESULT_APPLY)
 350			--  {
 351			--    if (settings != NULL)
 352			-- g_object_unref (settings);
 353			--    settings = g_object_ref (gtk_print_operation_get_print_settings (print));
 354			--  }
 355			--
 356		do
 357			operation_result:=gtk_print_operation_run(handle, an_action,
 358												  null_or(a_parent),
 359												  address_of(gtk.error.handle))
 360		ensure valid_result: is_valid_gtk_print_operation_result (operation_result)
 361		end
 362
 363	cancel is
 364			-- Cancels a running print operation. This feature may be
 365			-- called from a begin-print, paginate or draw-page signal
 366			-- handler to stop the currently running print operation.
 367		do
 368			gtk_print_operation_cancel(handle)
 369		end
 370
 371	status: INTEGER is
 372			-- the status of the print operation. Also see
 373			-- `status_string'.
 374		do
 375			Result:=gtk_print_operation_get_status(handle)
 376		ensure valid: is_valid_gtk_print_status(Result)
 377		end
 378	
 379	status_string: CONST_STRING is
 380			-- a string representation of the status of the print
 381			-- operation. The string is translated and suitable for
 382			-- displaying the print status e.g. in a GtkStatusbar.
 383		
 384			-- Use `status' to obtain a status value that is suitable for
 385			-- programmatic use.
 386		do
 387			create Result.from_external(gtk_print_operation_get_status_string(handle))
 388		end
 389
 390	is_finished: BOOLEAN is
 391			-- Is the print operation finished?
 392		
 393			-- This is a convenience feature to find out if the print
 394			-- operation is finished, either successfully
 395			-- (`gtk_print_status_finished') or unsuccessfully
 396			-- (`gtk_print_status_finished_aborted').
 397		
 398			-- Note: when you enable print status tracking the print
 399			-- operation can be in a non-finished state even after done
 400			-- has been called, as the operation status then tracks the
 401			-- print job status on the printer.
 402		do
 403			Result:=gtk_print_operation_is_finished(handle).to_boolean
 404		end
 405
 406	error: G_ERROR is
 407			-- Detailed error description of what went wrong, useful when
 408			-- the result of a print operation is
 409			-- `gtk_print_operation_result_error', either as returned by
 410			-- `run', or in the ::done signal handler.
 411		do
 412			create Result.empty
 413			gtk_print_operation_get_error(handle, address_of(error.handle))
 414		end
 415
 416	-- TODO: GtkPageSetup* gtk_print_run_page_setup_dialog
 417	--                                             (GtkWindow *parent,
 418	--                                              GtkPageSetup *page_setup,
 419	--                                              GtkPrintSettings *settings);
 420	--
 421	--   Runs a page setup dialog, letting the user modify the values from
 422	--   page_setup. If the user cancels the dialog, the returned GtkPageSetup is
 423	--   identical to the passed in page_setup, otherwise it contains the
 424	--   modifications done in the dialog.
 425	--
 426	--   Note that this function may use a recursive mainloop to show the page
 427	--   setup dialog. See gtk_print_run_page_setup_dialog_async() if this is a
 428	--   problem.
 429	--
 430	--   parent :     transient parent, or NULL
 431	--   page_setup : an existing GtkPageSetup, or NULL
 432	--   settings :   a GtkPrintSettings
 433	--   Returns :    a new GtkPageSetup
 434	--
 435	--   Since 2.10
 436	--
 437	--   --------------------------------------------------------------------------
 438	--
 439	--  GtkPageSetupDoneFunc ()
 440	--
 441	-- void        (*GtkPageSetupDoneFunc)         (GtkPageSetup *page_setup,
 442	--                                              gpointer data);
 443	--
 444	--   The type of function that is passed to
 445	--   gtk_print_run_page_setup_dialog_async(). This function will be called when
 446	--   the page setup dialog is dismissed, and also serves as destroy notify for
 447	--   data.
 448	--
 449	--   page_setup : the GtkPageSetup that has been
 450	--   data :       user data that has been passed to
 451	--                gtk_print_run_page_setup_dialog_async().
 452	--
 453	--   --------------------------------------------------------------------------
 454	--
 455	--  gtk_print_run_page_setup_dialog_async ()
 456	--
 457	-- void        gtk_print_run_page_setup_dialog_async
 458	--                                             (GtkWindow *parent,
 459	--                                              GtkPageSetup *page_setup,
 460	--                                              GtkPrintSettings *settings,
 461	--                                              GtkPageSetupDoneFunc done_cb,
 462	--                                              gpointer data);
 463	--
 464	--   Runs a page setup dialog, letting the user modify the values from
 465	--   page_setup.
 466	--
 467	--   In contrast to gtk_print_run_page_setup_dialog(), this function returns
 468	--   after showing the page setup dialog on platforms that support this, and
 469	--   calls done_cb from a signal handler for the ::response signal of the
 470	--   dialog.
 471	--
 472	--   parent :     transient parent, or NULL
 473	--   page_setup : an existing GtkPageSetup, or NULL
 474	--   settings :   a GtkPrintSettings
 475	--   done_cb :    a function to call when the user saves the modified page
 476	--                setup
 477	--   data :       user data to pass to done_cb
 478	--
 479	--   Since 2.10
 480	--
 481	--   --------------------------------------------------------------------------
 482	--
 483	--
 484feature -- Property Details
 485--Properties
 486	--
 487	--
 488	--   "allow-async"          gboolean              : Read / Write
 489	--   "current-page"         gint                  : Read / Write
 490	--   "custom-tab-label"     gchararray            : Read / Write
 491	--   "default-page-setup"   GtkPageSetup          : Read / Write
 492	--   "export-filename"      gchararray            : Read / Write
 493	--   "job-name"             gchararray            : Read / Write
 494	--   "n-pages"              gint                  : Read / Write
 495	--   "print-settings"       GtkPrintSettings      : Read / Write
 496	--   "show-progress"        gboolean              : Read / Write
 497	--   "status"               GtkPrintStatus        : Read
 498	--   "status-string"        gchararray            : Read
 499	--   "track-print-status"   gboolean              : Read / Write
 500	--   "unit"                 GtkUnit               : Read / Write
 501	--   "use-full-page"        gboolean              : Read / Write
 502	--
 503
 504	async_allowed: BOOLEAN is
 505			-- May the print operation run asynchronously?
 506
 507			-- Wraps the "allow-async" property
 508
 509			--  "allow-async" gboolean : Read / Write
 510
 511			-- Some systems don't support asynchronous printing, but
 512			-- those that do will return
 513			-- `gtk_print_operation_result_in_progress' as the status,
 514			-- and emit the done signal when the operation is actually
 515			-- done.
 516
 517			-- The Windows port does not support asynchronous operation
 518			-- at all (this is unlikely to change). On other platforms,
 519			-- all actions except for GTK_PRINT_OPERATION_ACTION_EXPORT
 520			-- support asynchronous operation.
 521
 522			--   Default value: FALSE
 523		do
 524			Result:=boolean_property_from_pspec(allow_async_property_spec)
 525		end
 526		
 527	--
 528	--  The "current-page" property
 529	--
 530	--   "current-page"         gint                  : Read / Write
 531	--
 532	--   The current page in the document.
 533	--
 534	--   If this is set before gtk_print_operation_run(), the user will be able to
 535	--   select to print only the current page.
 536	--
 537	--   Note that this only makes sense for pre-paginated documents.
 538	--
 539	--   Allowed values: >= -1
 540	--
 541	--   Default value: -1
 542	--
 543	--   Since 2.10
 544	--
 545	--   --------------------------------------------------------------------------
 546	--
 547	--  The "custom-tab-label" property
 548	--
 549	--   "custom-tab-label"     gchararray            : Read / Write
 550	--
 551	--   Used as the label of the tab containing custom widgets. Note that this
 552	--   property may be ignored on some platforms.
 553	--
 554	--   If this is NULL, GTK+ uses a default label.
 555	--
 556	--   Default value: NULL
 557	--
 558	--   Since 2.10
 559	--
 560	--   --------------------------------------------------------------------------
 561	--
 562	--  The "default-page-setup" property
 563	--
 564	--   "default-page-setup"   GtkPageSetup          : Read / Write
 565	--
 566	--   The GtkPageSetup used by default.
 567	--
 568	--   This page setup will be used by gtk_print_operation_run(), but it can be
 569	--   overridden on a per-page basis by connecting to the ::request-page-setup
 570	--   signal.
 571	--
 572	--   Since 2.10
 573	--
 574	--   --------------------------------------------------------------------------
 575	--
 576	--  The "export-filename" property
 577	--
 578	--   "export-filename"      gchararray            : Read / Write
 579	--
 580	--   The name of a file file to generate instead of showing the print dialog.
 581	--   Currently, PDF is the only supported format.
 582	--
 583	--   The intended use of this property is for implementing "Export to PDF"
 584	--   actions.
 585	--
 586	--   "Print to PDF" support is independent of this and is done by letting the
 587	--   user pick the "Print to PDF" item from the list of printers in the print
 588	--   dialog.
 589	--
 590	--   Default value: NULL
 591	--
 592	--   Since 2.10
 593	--
 594	--   --------------------------------------------------------------------------
 595	--
 596	--  The "job-name" property
 597	--
 598	--   "job-name"             gchararray            : Read / Write
 599	--
 600	--   A string used to identify the job (e.g. in monitoring applications like
 601	--   eggcups).
 602	--
 603	--   If you don't set a job name, GTK+ picks a default one by numbering
 604	--   successive print jobs.
 605	--
 606	--   Default value: ""
 607	--
 608	--   Since 2.10
 609	--
 610	--   --------------------------------------------------------------------------
 611	--
 612	--  The "n-pages" property
 613	--
 614	--   "n-pages"              gint                  : Read / Write
 615	--
 616	--   The number of pages in the document.
 617	--
 618	--   This must be set to a positive number before the rendering starts. It may
 619	--   be set in a ::begin-print signal hander.
 620	--
 621	--   Note that the page numbers passed to the ::request-page-setup and
 622	--   ::draw-page signals are 0-based, i.e. if the user chooses to print all
 623	--   pages, the last ::draw-page signal will be for page n_pages - 1.
 624	--
 625	--   Allowed values: >= -1
 626	--
 627	--   Default value: -1
 628	--
 629	--   Since 2.10
 630	--
 631	--   --------------------------------------------------------------------------
 632	--
 633	--  The "print-settings" property
 634	--
 635	--   "print-settings"       GtkPrintSettings      : Read / Write
 636	--
 637	--   The GtkPrintSettings used for initializing the dialog.
 638	--
 639	--   Setting this property is typically used to re-establish print settings
 640	--   from a previous print operation, see gtk_print_operation_run().
 641	--
 642	--   Since 2.10
 643	--
 644	--   --------------------------------------------------------------------------
 645	--
 646	--  The "show-progress" property
 647	--
 648	--   "show-progress"        gboolean              : Read / Write
 649	--
 650	--   Determines whether to show a progress dialog during the print operation.
 651	--
 652	--   Default value: FALSE
 653	--
 654	--   Since 2.10
 655	--
 656	--   --------------------------------------------------------------------------
 657	--
 658	--  The "status" property
 659	--
 660	--   "status"               GtkPrintStatus        : Read
 661	--
 662	--   The status of the print operation.
 663	--
 664	--   Default value: GTK_PRINT_STATUS_INITIAL
 665	--
 666	--   Since 2.10
 667	--
 668	--   --------------------------------------------------------------------------
 669	--
 670	--  The "status-string" property
 671	--
 672	--   "status-string"        gchararray            : Read
 673	--
 674	--   A string representation of the status of the print operation. The string
 675	--   is translated and suitable for displaying the print status e.g. in a
 676	--   GtkStatusbar.
 677	--
 678	--   See the ::status property for a status value that is suitable for
 679	--   programmatic use.
 680	--
 681	--   Default value: ""
 682	--
 683	--   Since 2.10
 684	--
 685	--   --------------------------------------------------------------------------
 686	--
 687	--  The "track-print-status" property
 688	--
 689	--   "track-print-status"   gboolean              : Read / Write
 690	--
 691	--   If TRUE, the print operation will try to continue report on the status of
 692	--   the print job in the printer queues and printer. This can allow your
 693	--   application to show things like "out of paper" issues, and when the print
 694	--   job actually reaches the printer. However, this is often implemented using
 695	--   polling, and should not be enabled unless needed.
 696	--
 697	--   Default value: FALSE
 698	--
 699	--   Since 2.10
 700	--
 701	--   --------------------------------------------------------------------------
 702	--
 703	--  The "unit" property
 704	--
 705	--   "unit"                 GtkUnit               : Read / Write
 706	--
 707	--   The transformation for the cairo context obtained from GtkPrintContext is
 708	--   set up in such a way that distances are measured in units of unit.
 709	--
 710	--   Default value: GTK_UNIT_PIXEL
 711	--
 712	--   Since 2.10
 713	--
 714	--   --------------------------------------------------------------------------
 715	--
 716	--  The "use-full-page" property
 717	--
 718	--   "use-full-page"        gboolean              : Read / Write
 719	--
 720	--   If TRUE, the transformation for the cairo context obtained from
 721	--   GtkPrintContext puts the origin at the top left corner of the page (which
 722	--   may not be the top left corner of the sheet, depending on page orientation
 723	--   and the number of pages per sheet). Otherwise, the origin is at the top
 724	--   left corner of the imageable area (i.e. inside the margins).
 725	--
 726	--   Default value: FALSE
 727	--
 728	--   Since 2.10
 729	--
 730feature -- TODO: Signal Details
 731		--Signals
 732	--
 733	--
 734	-- "begin-print"
 735	--             void        user_function      (GtkPrintOperation *operation,
 736	--                                             GtkPrintContext   *context,
 737	--                                             gpointer           user_data)      : Run last
 738	-- "create-custom-widget"
 739	--             GObject*    user_function      (GtkPrintOperation *operation,
 740	--                                             gpointer           user_data)      : Run last
 741	-- "custom-widget-apply"
 742	--             void        user_function      (GtkPrintOperation *operation,
 743	--                                             GtkWidget         *widget,
 744	--                                             gpointer           user_data)      : Run last
 745	-- "done"      void        user_function      (GtkPrintOperation      *operation,
 746	--                                             GtkPrintOperationResult result,
 747	--                                             gpointer                user_data)      : Run last
 748	-- "draw-page" void        user_function      (GtkPrintOperation *operation,
 749	--                                             GtkPrintContext   *context,
 750	--                                             gint               page_nr,
 751	--                                             gpointer           user_data)      : Run last
 752	-- "end-print" void        user_function      (GtkPrintOperation *operation,
 753	--                                             GtkPrintContext   *context,
 754	--                                             gpointer           user_data)      : Run last
 755	-- "paginate"  gboolean    user_function      (GtkPrintOperation *operation,
 756	--                                             GtkPrintContext   *context,
 757	--                                             gpointer           user_data)      : Run last
 758	-- "preview"   gboolean    user_function      (GtkPrintOperation        *operation,
 759	--                                             GtkPrintOperationPreview *preview,
 760	--                                             GtkPrintContext          *context,
 761	--                                             GtkWindow                *parent,
 762	--                                             gpointer                  user_data)      : Run last
 763	-- "request-page-setup"
 764	--             void        user_function      (GtkPrintOperation *operation,
 765	--                                             GtkPrintContext   *context,
 766	--                                             gint               page_nr,
 767	--                                             GtkPageSetup      *setup,
 768	--                                             gpointer           user_data)      : Run last
 769	-- "status-changed"
 770	--             void        user_function      (GtkPrintOperation *operation,
 771	--                                             gpointer           user_data)      : Run last
 772	--
 773	--
 774	--  The "begin-print" signal
 775	--
 776	-- void        user_function                  (GtkPrintOperation *operation,
 777	--                                             GtkPrintContext   *context,
 778	--                                             gpointer           user_data)      : Run last
 779	--
 780	--   Emitted after the user has finished changing print settings in the dialog,
 781	--   before the actual rendering starts.
 782	--
 783	--   A typical use for this signal is to use the parameters from the
 784	--   GtkPrintContext and paginate the document accordingly, and then set the
 785	--   number of pages with gtk_print_operation_set_n_pages().
 786	--
 787	--   operation : the GtkPrintOperation on which the signal was emitted
 788	--   context :   the GtkPrintContext for the current operation
 789	--   user_data : user data set when the signal handler was connected.
 790	--
 791	--   Since 2.10
 792	--
 793	--   --------------------------------------------------------------------------
 794	--
 795	--  The "create-custom-widget" signal
 796	--
 797	-- GObject*    user_function                  (GtkPrintOperation *operation,
 798	--                                             gpointer           user_data)      : Run last
 799	--
 800	--   Emitted when displaying the print dialog. If you return a widget in a
 801	--   handler for this signal it will be added to a custom tab in the print
 802	--   dialog. You typically return a container widget with multiple widgets in
 803	--   it.
 804	--
 805	--   The print dialog owns the returned widget, and its lifetime isn't
 806	--   controlled by the app. However, the widget is guaranteed to stay around
 807	--   until the custom-widget-apply signal is emitted on the operation. Then you
 808	--   can read out any information you need from the widgets.
 809	--
 810	--   operation : the GtkPrintOperation on which the signal was emitted
 811	--   user_data : user data set when the signal handler was connected.
 812	--   Returns :   A custom widget that gets embedded in the print dialog, or
 813	--               NULL
 814	--
 815	--   Since 2.10
 816	--
 817	--   --------------------------------------------------------------------------
 818	--
 819	--  The "custom-widget-apply" signal
 820	--
 821	-- void        user_function                  (GtkPrintOperation *operation,
 822	--                                             GtkWidget         *widget,
 823	--                                             gpointer           user_data)      : Run last
 824	--
 825	--   Emitted right before begin-print if you added a custom widget in the
 826	--   create-custom-widget handler. When you get this signal you should read the
 827	--   information from the custom widgets, as the widgets are not guaraneed to
 828	--   be around at a later time.
 829	--
 830	--   operation : the GtkPrintOperation on which the signal was emitted
 831	--   widget :    the custom widget added in create-custom-widget
 832	--   user_data : user data set when the signal handler was connected.
 833	--
 834	--   Since 2.10
 835	--
 836	--   --------------------------------------------------------------------------
 837	--
 838	--  The "done" signal
 839	--
 840	-- void        user_function                  (GtkPrintOperation      *operation,
 841	--                                             GtkPrintOperationResult result,
 842	--                                             gpointer                user_data)      : Run last
 843	--
 844	--   Emitted when the print operation run has finished doing everything
 845	--   required for printing. result gives you information about what happened
 846	--   during the run. If result is GTK_PRINT_OPERATION_RESULT_ERROR then you can
 847	--   call gtk_print_operation_get_error() for more information.
 848	--
 849	--   If you enabled print status tracking then
 850	--   gtk_print_operation_is_finished() may still return FALSE after this was
 851	--   emitted.
 852	--
 853	--   operation : the GtkPrintOperation on which the signal was emitted
 854	--   result :    the result of the print operation
 855	--   user_data : user data set when the signal handler was connected.
 856	--
 857	--   Since 2.10
 858	--
 859	--   --------------------------------------------------------------------------
 860	--
 861	--  The "draw-page" signal
 862	--
 863	-- void        user_function                  (GtkPrintOperation *operation,
 864	--                                             GtkPrintContext   *context,
 865	--                                             gint               page_nr,
 866	--                                             gpointer           user_data)      : Run last
 867	--
 868	--   Emitted for every page that is printed. The signal handler must render the
 869	--   page_nr's page onto the cairo context obtained from context using
 870	--   gtk_print_context_get_cairo_context().
 871	--
 872	-- static void
 873	-- draw_page (GtkPrintOperation *operation,
 874	--            GtkPrintContext   *context,
 875	--            gint               page_nr,
 876	--            gpointer           user_data)
 877	-- {
 878	--   cairo_t *cr;
 879	--   PangoLayout *layout;
 880	--   gdouble width, text_height;
 881	--   gint layout_height;
 882	--   PangoFontDescription *desc;
 883	--
 884	--   cr = gtk_print_context_get_cairo_context (context);
 885	--   width = gtk_print_context_get_width (context);
 886	--
 887	--   cairo_rectangle (cr, 0, 0, width, HEADER_HEIGHT);
 888	--
 889	--   cairo_set_source_rgb (cr, 0.8, 0.8, 0.8);
 890	--   cairo_fill (cr);
 891	--
 892	--   layout = gtk_print_context_create_pango_layout (context);
 893	--
 894	--   desc = pango_font_description_from_string ("sans 14");
 895	--   pango_layout_set_font_description (layout, desc);
 896	--   pango_font_description_free (desc);
 897	--
 898	--   pango_layout_set_text (layout, "some text", -1);
 899	--   pango_layout_set_width (layout, width);
 900	--   pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
 901	--
 902	--   pango_layout_get_size (layout, NULL, &layout_height);
 903	--   text_height = (gdouble)layout_height / PANGO_SCALE;
 904	--
 905	--   cairo_move_to (cr, width / 2,  (HEADER_HEIGHT - text_height) / 2);
 906	--   pango_cairo_show_layout (cr, layout);
 907	--
 908	--   g_object_unref (layout);
 909	-- }
 910	--
 911	--   Use gtk_print_operation_set_use_full_page() and
 912	--   gtk_print_operation_set_unit() before starting the print operation to set
 913	--   up the transformation of the cairo context according to your needs.
 914	--
 915	--   operation : the GtkPrintOperation on which the signal was emitted
 916	--   context :   the GtkPrintContext for the current operation
 917	--   page_nr :   the number of the currently printed page
 918	--   user_data : user data set when the signal handler was connected.
 919	--
 920	--   Since 2.10
 921	--
 922	--   --------------------------------------------------------------------------
 923	--
 924	--  The "end-print" signal
 925	--
 926	-- void        user_function                  (GtkPrintOperation *operation,
 927	--                                             GtkPrintContext   *context,
 928	--                                             gpointer           user_data)      : Run last
 929	--
 930	--   Emitted after all pages have been rendered. A handler for this signal can
 931	--   clean up any resources that have been allocated in the ::begin-print
 932	--   handler.
 933	--
 934	--   operation : the GtkPrintOperation on which the signal was emitted
 935	--   context :   the GtkPrintContext for the current operation
 936	--   user_data : user data set when the signal handler was connected.
 937	--
 938	--   Since 2.10
 939	--
 940	--   --------------------------------------------------------------------------
 941	--
 942	--  The "paginate" signal
 943	--
 944	-- gboolean    user_function                  (GtkPrintOperation *operation,
 945	--                                             GtkPrintContext   *context,
 946	--                                             gpointer           user_data)      : Run last
 947	--
 948	--   Emitted after the begin-print signal, but before the actual rendering
 949	--   starts. It keeps getting emitted until it returns FALSE.
 950	--
 951	--   This signal is intended to be used for paginating the document in small
 952	--   chunks, to avoid blocking the user interface for a long time. The signal
 953	--   handler should update the number of pages using
 954	--   gtk_print_operation_set_n_pages(), and return TRUE if the document has
 955	--   been completely paginated.
 956	--
 957	--   If you don't need to do pagination in chunks, you can simply do it all in
 958	--   the begin-print handler, and set the number of pages from there.
 959	--
 960	--   operation : the GtkPrintOperation on which the signal was emitted
 961	--   context :   the GtkPrintContext for the current operation
 962	--   user_data : user data set when the signal handler was connected.
 963	--   Returns :   TRUE if pagination is complete
 964	--
 965	--   Since 2.10
 966	--
 967	--   --------------------------------------------------------------------------
 968	--
 969	--  The "preview" signal
 970	--
 971	-- gboolean    user_function                  (GtkPrintOperation        *operation,
 972	--                                             GtkPrintOperationPreview *preview,
 973	--                                             GtkPrintContext          *context,
 974	--                                             GtkWindow                *parent,
 975	--                                             gpointer                  user_data)      : Run last
 976	--
 977	--   Gets emitted when a preview is requested from the native dialog.
 978	--
 979	--   The default handler for this signal uses an external viewer application to
 980	--   preview.
 981	--
 982	--   To implement a custom print preview, an application must return TRUE from
 983	--   its handler for this signal. In order to use the provided context for the
 984	--   preview implementation, it must be given a suitable cairo context with
 985	--   gtk_print_context_set_cairo_context().
 986	--
 987	--   The custom preview implementation can use
 988	--   gtk_print_operation_preview_is_selected() and
 989	--   gtk_print_operation_preview_render_page() to find pages which are selected
 990	--   for print and render them. The preview must be finished by calling
 991	--   gtk_print_operation_preview_end_preview() (typically in response to the
 992	--   user clicking a close button).
 993	--
 994	--   operation : the GtkPrintOperation on which the signal was emitted
 995	--   preview :   the GtkPrintPreviewOperation for the current operation
 996	--   context :   the GtkPrintContext that will be used
 997	--   parent :    the GtkWindow to use as window parent, or NULL
 998	--   user_data : user data set when the signal handler was connected.
 999	--   Returns :   TRUE if the listener wants to take over control of the preview
1000	--
1001	--   Since 2.10
1002	--
1003	--   --------------------------------------------------------------------------
1004	--
1005	--  The "request-page-setup" signal
1006	--
1007	-- void        user_function                  (GtkPrintOperation *operation,
1008	--                                             GtkPrintContext   *context,
1009	--                                             gint               page_nr,
1010	--                                             GtkPageSetup      *setup,
1011	--                                             gpointer           user_data)      : Run last
1012	--
1013	--   Emitted once for every page that is printed, to give the application a
1014	--   chance to modify the page setup. Any changes done to setup will be in
1015	--   force only for printing this page.
1016	--
1017	--   operation : the GtkPrintOperation on which the signal was emitted
1018	--   context :   the GtkPrintContext for the current operation
1019	--   page_nr :   the number of the currently printed page
1020	--   setup :     the GtkPageSetup
1021	--   user_data : user data set when the signal handler was connected.
1022	--
1023	--   Since 2.10
1024	--
1025	--   --------------------------------------------------------------------------
1026	--
1027	--  The "status-changed" signal
1028	--
1029	-- void        user_function                  (GtkPrintOperation *operation,
1030	--                                             gpointer           user_data)      : Run last
1031	--
1032	--   Emitted at between the various phases of the print operation. See
1033	--   GtkPrintStatus for the phases that are being discriminated. Use
1034	--   gtk_print_operation_get_status() to find out the current status.
1035	--
1036	--   operation : the GtkPrintOperation on which the signal was emitted
1037	--   user_data : user data set when the signal handler was connected.
1038	--
1039feature {} -- Unwrapped code
1040
1041	-- #define GTK_PRINT_ERROR gtk_print_error_quark ()
1042	--
1043	--   The GQuark used for GtkPrintError errors.
1044
1045feature {} -- Hastened property spec
1046	allow_async_property_spec: G_PARAM_SPEC is
1047		once
1048			Result := find_property (allow_async_property_name)
1049		end
1050
1051	allow_async_property_name: STRING is "allow-async"
1052	
1053feature -- size
1054	struct_size: INTEGER is
1055		external "C inline use <gtk/gtk.h>"
1056		alias "sizeof(GtkPrintOperation)"
1057		end
1058
1059end -- class GTK_PRINT_OPERATION