]> Pileus Git - ~andy/gtk/blob - gtk/gtkprintoperation-private.h
Revert "Set unix printer hard margins on print context"
[~andy/gtk] / gtk / gtkprintoperation-private.h
1 /* GTK - The GIMP Toolkit
2  * gtkprintoperation.h: Print Operation
3  * Copyright (C) 2006, Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef __GTK_PRINT_OPERATION_PRIVATE_H__
22 #define __GTK_PRINT_OPERATION_PRIVATE_H__
23
24 #include "gtkprintoperation.h"
25
26 G_BEGIN_DECLS
27
28 /* Page drawing states */
29 typedef enum
30 {
31   GTK_PAGE_DRAWING_STATE_READY,
32   GTK_PAGE_DRAWING_STATE_DRAWING,
33   GTK_PAGE_DRAWING_STATE_DEFERRED_DRAWING
34 } GtkPageDrawingState;
35
36 struct _GtkPrintOperationPrivate
37 {
38   GtkPrintOperationAction action;
39   GtkPrintStatus status;
40   GError *error;
41   gchar *status_string;
42   GtkPageSetup *default_page_setup;
43   GtkPrintSettings *print_settings;
44   gchar *job_name;
45   gint nr_of_pages;
46   gint nr_of_pages_to_print;
47   gint page_position;
48   gint current_page;
49   GtkUnit unit;
50   gchar *export_filename;
51   guint use_full_page      : 1;
52   guint track_print_status : 1;
53   guint show_progress      : 1;
54   guint cancelled          : 1;
55   guint allow_async        : 1;
56   guint is_sync            : 1;
57   guint support_selection  : 1;
58   guint has_selection      : 1;
59   guint embed_page_setup   : 1;
60
61   GtkPageDrawingState      page_drawing_state;
62
63   guint print_pages_idle_id;
64   guint show_progress_timeout_id;
65
66   GtkPrintContext *print_context;
67   
68   GtkPrintPages print_pages;
69   GtkPageRange *page_ranges;
70   gint num_page_ranges;
71   
72   gint manual_num_copies;
73   guint manual_collation   : 1;
74   guint manual_reverse     : 1;
75   guint manual_orientation : 1;
76   double manual_scale;
77   GtkPageSet manual_page_set;
78   guint manual_number_up;
79   GtkNumberUpLayout manual_number_up_layout;
80
81   GtkWidget *custom_widget;
82   gchar *custom_tab_label;
83   
84   gpointer platform_data;
85   GDestroyNotify free_platform_data;
86
87   GMainLoop *rloop; /* recursive mainloop */
88
89   void (*start_page) (GtkPrintOperation *operation,
90                       GtkPrintContext   *print_context,
91                       GtkPageSetup      *page_setup);
92   void (*end_page)   (GtkPrintOperation *operation,
93                       GtkPrintContext   *print_context);
94   void (*end_run)    (GtkPrintOperation *operation,
95                       gboolean           wait,
96                       gboolean           cancelled);
97 };
98
99
100 typedef void (* GtkPrintOperationPrintFunc) (GtkPrintOperation      *op,
101                                              GtkWindow              *parent,
102                                              gboolean                do_print,
103                                              GtkPrintOperationResult result);
104
105 GtkPrintOperationResult _gtk_print_operation_platform_backend_run_dialog             (GtkPrintOperation           *operation,
106                                                                                       gboolean                     show_dialog,
107                                                                                       GtkWindow                   *parent,
108                                                                                       gboolean                    *do_print);
109 void                    _gtk_print_operation_platform_backend_run_dialog_async       (GtkPrintOperation           *op,
110                                                                                       gboolean                     show_dialog,
111                                                                                       GtkWindow                   *parent,
112                                                                                       GtkPrintOperationPrintFunc   print_cb);
113 void                    _gtk_print_operation_platform_backend_launch_preview         (GtkPrintOperation           *op,
114                                                                                       cairo_surface_t             *surface,
115                                                                                       GtkWindow                   *parent,
116                                                                                       const char                  *filename);
117 cairo_surface_t *       _gtk_print_operation_platform_backend_create_preview_surface (GtkPrintOperation           *op,
118                                                                                       GtkPageSetup                *page_setup,
119                                                                                       gdouble                     *dpi_x,
120                                                                                       gdouble                     *dpi_y,
121                                                                                       gchar                       **target);
122 void                    _gtk_print_operation_platform_backend_resize_preview_surface (GtkPrintOperation           *op,
123                                                                                       GtkPageSetup                *page_setup,
124                                                                                       cairo_surface_t             *surface);
125 void                    _gtk_print_operation_platform_backend_preview_start_page     (GtkPrintOperation *op,
126                                                                                       cairo_surface_t *surface,
127                                                                                       cairo_t *cr);
128 void                    _gtk_print_operation_platform_backend_preview_end_page       (GtkPrintOperation *op,
129                                                                                       cairo_surface_t *surface,
130                                                                                       cairo_t *cr);
131
132 void _gtk_print_operation_set_status (GtkPrintOperation *op,
133                                       GtkPrintStatus     status,
134                                       const gchar       *string);
135
136 /* GtkPrintContext private functions: */
137
138 GtkPrintContext *_gtk_print_context_new                             (GtkPrintOperation *op);
139 void             _gtk_print_context_set_page_setup                  (GtkPrintContext   *context,
140                                                                      GtkPageSetup      *page_setup);
141 void             _gtk_print_context_translate_into_margin           (GtkPrintContext   *context);
142 void             _gtk_print_context_rotate_according_to_orientation (GtkPrintContext   *context);
143
144 G_END_DECLS
145
146 #endif /* __GTK_PRINT_OPERATION_PRIVATE_H__ */