2008-10-09 [colin] 3.6.0cvs18
[claws.git] / src / gtk / gtksourceprintjob.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- */
2 /*
3  * gtksourceprintjob.h
4  * This file is part of GtkSourceView
5  *
6  * Copyright (C) 2003  Gustavo Giráldez
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21  
22 #ifndef __GTK_SOURCE_PRINT_JOB_H__
23 #define __GTK_SOURCE_PRINT_JOB_H__
24
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28
29 #ifdef USE_GNOMEPRINT
30
31 #include <libgnomeprint/gnome-print-config.h>
32 #include <libgnomeprint/gnome-print-job.h>
33 #include <gtk/gtk.h>
34
35 G_BEGIN_DECLS
36
37 #define GTK_TYPE_SOURCE_PRINT_JOB            (gtk_source_print_job_get_type ())
38 #define GTK_SOURCE_PRINT_JOB(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_SOURCE_PRINT_JOB, GtkSourcePrintJob))
39 #define GTK_SOURCE_PRINT_JOB_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_SOURCE_PRINT_JOB, GtkSourcePrintJobClass))
40 #define GTK_IS_SOURCE_PRINT_JOB(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_SOURCE_PRINT_JOB))
41 #define GTK_IS_SOURCE_PRINT_JOB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_SOURCE_PRINT_JOB))
42 #define GTK_SOURCE_PRINT_JOB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_SOURCE_PRINT_JOB, GtkSourcePrintJobClass))
43
44 typedef struct _GtkSourcePrintJob         GtkSourcePrintJob;
45 typedef struct _GtkSourcePrintJobClass    GtkSourcePrintJobClass;
46 typedef struct _GtkSourcePrintJobPrivate  GtkSourcePrintJobPrivate;
47
48 struct _GtkSourcePrintJob
49 {
50         GObject parent_instance;
51
52         GtkSourcePrintJobPrivate *priv;
53 };
54
55 struct _GtkSourcePrintJobClass
56 {
57         GObjectClass parent_class;
58
59         void   (* begin_page)    (GtkSourcePrintJob  *job);
60         void   (* finished)      (GtkSourcePrintJob  *job);
61 };
62
63 /* we want the idle handler to run before the view validation, but do
64  * not interfere with ui updates */
65 #define GTK_SOURCE_PRINT_JOB_PRIORITY ((GDK_PRIORITY_REDRAW + GTK_TEXT_VIEW_PRIORITY_VALIDATE) / 2)
66
67 GType              gtk_source_print_job_get_type               (void) G_GNUC_CONST;
68
69 /* constructor functions */
70 GtkSourcePrintJob *gtk_source_print_job_new                    (GnomePrintConfig  *config);
71 GtkSourcePrintJob *gtk_source_print_job_new_with_buffer        (GnomePrintConfig  *config,
72                                                                 GtkTextBuffer   *buffer);
73 /* print job basic configuration */
74 void               gtk_source_print_job_set_config             (GtkSourcePrintJob *job,
75                                                                 GnomePrintConfig  *config);
76 GnomePrintConfig  *gtk_source_print_job_get_config             (GtkSourcePrintJob *job);
77 void               gtk_source_print_job_set_buffer             (GtkSourcePrintJob *job,
78                                                                 GtkTextBuffer   *buffer);
79 GtkTextBuffer   *gtk_source_print_job_get_buffer             (GtkSourcePrintJob *job);
80
81 /* print job layout and style configuration */
82 //void               gtk_source_print_job_setup_from_view        (GtkSourcePrintJob *job,
83 //                                                              GtkSourceView     *view);
84 void               gtk_source_print_job_set_tabs_width         (GtkSourcePrintJob *job,
85                                                                 guint              tabs_width);
86 guint              gtk_source_print_job_get_tabs_width         (GtkSourcePrintJob *job);
87 void               gtk_source_print_job_set_wrap_mode          (GtkSourcePrintJob *job,
88                                                                 GtkWrapMode        wrap);
89 GtkWrapMode        gtk_source_print_job_get_wrap_mode          (GtkSourcePrintJob *job);
90 void               gtk_source_print_job_set_highlight          (GtkSourcePrintJob *job,
91                                                                 gboolean           highlight);
92 gboolean           gtk_source_print_job_get_highlight          (GtkSourcePrintJob *job);
93 void               gtk_source_print_job_set_font               (GtkSourcePrintJob *job,
94                                                                 const gchar       *font_name);
95 gchar             *gtk_source_print_job_get_font               (GtkSourcePrintJob *job);
96 void               gtk_source_print_job_set_numbers_font       (GtkSourcePrintJob *job,
97                                                                 const gchar       *font_name);
98 gchar             *gtk_source_print_job_get_numbers_font       (GtkSourcePrintJob *job);
99 void               gtk_source_print_job_set_print_numbers      (GtkSourcePrintJob *job,
100                                                                 guint              interval);
101 guint              gtk_source_print_job_get_print_numbers      (GtkSourcePrintJob *job);
102 void               gtk_source_print_job_set_text_margins       (GtkSourcePrintJob *job,
103                                                                 gdouble            top,
104                                                                 gdouble            bottom,
105                                                                 gdouble            left,
106                                                                 gdouble            right);
107 void               gtk_source_print_job_get_text_margins       (GtkSourcePrintJob *job,
108                                                                 gdouble           *top,
109                                                                 gdouble           *bottom,
110                                                                 gdouble           *left,
111                                                                 gdouble           *right);
112
113 /* New non-deprecated font-setting API */
114 void                   gtk_source_print_job_set_font_desc               (GtkSourcePrintJob    *job,
115                                                                          PangoFontDescription *desc);
116 PangoFontDescription  *gtk_source_print_job_get_font_desc               (GtkSourcePrintJob    *job);
117 void                   gtk_source_print_job_set_numbers_font_desc       (GtkSourcePrintJob    *job,
118                                                                          PangoFontDescription *desc);
119 PangoFontDescription  *gtk_source_print_job_get_numbers_font_desc       (GtkSourcePrintJob    *job);
120 void                   gtk_source_print_job_set_header_footer_font_desc (GtkSourcePrintJob    *job,
121                                                                          PangoFontDescription *desc);
122 PangoFontDescription  *gtk_source_print_job_get_header_footer_font_desc (GtkSourcePrintJob    *job);
123
124 /* printing operations */
125 GnomePrintJob     *gtk_source_print_job_print                  (GtkSourcePrintJob *job);
126 GnomePrintJob     *gtk_source_print_job_print_range            (GtkSourcePrintJob *job,
127                                                                 const GtkTextIter *start,
128                                                                 const GtkTextIter *end);
129
130 /* asynchronous printing */
131 gboolean           gtk_source_print_job_print_range_async      (GtkSourcePrintJob *job,
132                                                                 const GtkTextIter *start,
133                                                                 const GtkTextIter *end);
134 void               gtk_source_print_job_cancel                 (GtkSourcePrintJob *job);
135 GnomePrintJob     *gtk_source_print_job_get_print_job          (GtkSourcePrintJob *job);
136
137 /* information for asynchronous ops and headers and footers callback */
138 guint              gtk_source_print_job_get_page               (GtkSourcePrintJob *job);
139 guint              gtk_source_print_job_get_page_count         (GtkSourcePrintJob *job);
140 GnomePrintContext *gtk_source_print_job_get_print_context      (GtkSourcePrintJob *job);
141
142
143 /* header and footer */
144 void               gtk_source_print_job_set_print_header       (GtkSourcePrintJob *job,
145                                                                 gboolean           setting);
146 gboolean           gtk_source_print_job_get_print_header       (GtkSourcePrintJob *job);
147 void               gtk_source_print_job_set_print_footer       (GtkSourcePrintJob *job,
148                                                                 gboolean           setting);
149 gboolean           gtk_source_print_job_get_print_footer       (GtkSourcePrintJob *job);
150 void               gtk_source_print_job_set_header_footer_font (GtkSourcePrintJob *job,
151                                                                 const gchar       *font_name);
152 gchar             *gtk_source_print_job_get_header_footer_font (GtkSourcePrintJob *job);
153 /* format strings are strftime like */
154 void               gtk_source_print_job_set_header_format      (GtkSourcePrintJob *job,
155                                                                 const gchar       *left,
156                                                                 const gchar       *center,
157                                                                 const gchar       *right,
158                                                                 gboolean           separator);
159 void               gtk_source_print_job_set_footer_format      (GtkSourcePrintJob *job,
160                                                                 const gchar       *left,
161                                                                 const gchar       *center,
162                                                                 const gchar       *right,
163                                                                 gboolean           separator);
164
165 G_END_DECLS
166
167 #endif /* __GTK_SOURCE_PRINT_JOB_H__ */
168 #endif