]> www.fi.muni.cz Git - evince.git/blob - backend/ev-document.h
Fix a few bugs
[evince.git] / backend / ev-document.h
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /*
3  *  Copyright (C) 2000-2003 Marco Pesenti Gritti
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2, or (at your option)
8  *  any later version.
9  *
10  *  This program 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
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program; if not, write to the Free Software
17  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18  *
19  *  $Id$
20  */
21
22 #ifndef EV_DOCUMENT_H
23 #define EV_DOCUMENT_H
24
25 #include <glib-object.h>
26 #include <glib.h>
27 #include <gdk/gdk.h>
28
29 G_BEGIN_DECLS
30
31 typedef struct
32 {
33   int page_num;
34   GdkRectangle highlight_area;
35 } EvFindResult;
36
37 #define EV_TYPE_DOCUMENT            (ev_document_get_type ())
38 #define EV_DOCUMENT(o)              (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_DOCUMENT, EvDocument))
39 #define EV_DOCUMENT_IFACE(k)        (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_DOCUMENT, EvDocumentIface))
40 #define EV_IS_DOCUMENT(o)           (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_DOCUMENT))
41 #define EV_IS_DOCUMENT_IFACE(k)     (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_DOCUMENT))
42 #define EV_DOCUMENT_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_DOCUMENT, EvDocumentIface))
43
44 typedef struct _EvDocument      EvDocument;
45 typedef struct _EvDocumentIface EvDocumentIface;
46
47 struct _EvDocumentIface
48 {
49         GTypeInterface base_iface;
50
51         /* Methods  */
52         gboolean    (* load)            (EvDocument *document,
53                                          const char *uri,
54                                          GError    **error);
55         int         (* get_n_pages)     (EvDocument *document);
56         void        (* set_page)        (EvDocument  *document,
57                                          int          page);
58         int         (* get_page)        (EvDocument  *document);
59         void        (* set_target)      (EvDocument  *document,
60                                          GdkDrawable *target);
61         void        (* set_scale)       (EvDocument  *document,
62                                          double       scale);
63         void        (* set_page_offset) (EvDocument  *document,
64                                          int          x,
65                                          int          y);
66         void        (* get_page_size)   (EvDocument  *document,
67                                          int         *width,
68                                          int         *height);
69         void        (* render)          (EvDocument  *document,
70                                          int          clip_x,
71                                          int          clip_y,
72                                          int          clip_width,
73                                          int          clip_height);
74         
75         void         (* begin_find)     (EvDocument    *document,
76                                          const char    *search_string,
77                                          gboolean       case_sensitive);
78         void         (* end_find)       (EvDocument    *document);
79
80         /* Signals */
81
82         /* "found" emitted at least 1 time (possibly with n_results == 0)
83          * for any call to begin_find; also emitted with NULL,0 when
84          * you end_find. Calling begin_find twice without calling end_find
85          * is considered OK.
86          */
87         void         (* found)          (EvDocument         *document,
88                                          const EvFindResult *results,
89                                          int                 n_results,
90                                          double              percent_complete);
91 };
92
93 GType ev_document_get_type (void);
94
95 gboolean ev_document_load            (EvDocument   *document,
96                                       const char   *uri,
97                                       GError      **error);
98 int      ev_document_get_n_pages     (EvDocument   *document);
99 void     ev_document_set_page        (EvDocument   *document,
100                                       int           page);
101 int      ev_document_get_page        (EvDocument   *document);
102 void     ev_document_set_target      (EvDocument   *document,
103                                       GdkDrawable  *target);
104 void     ev_document_set_scale       (EvDocument   *document,
105                                       double        scale);
106 void     ev_document_set_page_offset (EvDocument   *document,
107                                       int           x,
108                                       int           y);
109 void     ev_document_get_page_size   (EvDocument   *document,
110                                       int          *width,
111                                       int          *height);
112 void     ev_document_render          (EvDocument   *document,
113                                       int           clip_x,
114                                       int           clip_y,
115                                       int           clip_width,
116                                       int           clip_height);
117 void     ev_document_begin_find    (EvDocument   *document,
118                                     const char   *search_string,
119                                     gboolean      case_sensitive);
120 void     ev_document_end_find      (EvDocument   *document);
121
122 void     ev_document_found         (EvDocument         *document,
123                                     const EvFindResult *results,
124                                     int                 n_results,
125                                     double              percent_complete);
126                                     
127
128 G_END_DECLS
129
130 #endif