]> www.fi.muni.cz Git - evince.git/blob - libdocument/ev-selection.c
Fix mime type handling.
[evince.git] / libdocument / ev-selection.c
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */
2 /*
3  *  Copyright (C) 2005 Red Hat, Inc.
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  */
20
21 #include "config.h"
22
23 #include "ev-selection.h"
24
25 static void ev_selection_base_init (gpointer g_class);
26
27 GType
28 ev_selection_get_type (void)
29 {
30         static GType type = 0;
31
32         if (G_UNLIKELY (type == 0))
33         {
34                 const GTypeInfo our_info =
35                 {
36                         sizeof (EvSelectionIface),
37                         ev_selection_base_init,
38                         NULL,
39                 };
40
41                 type = g_type_register_static (G_TYPE_INTERFACE,
42                                                "EvSelection",
43                                                &our_info, (GTypeFlags)0);
44         }
45
46         return type;
47 }
48
49 static void
50 ev_selection_base_init (gpointer g_class)
51 {
52         static gboolean initialized = FALSE;
53
54         if (!initialized) {
55         }
56 }
57
58
59 void
60 ev_selection_render_selection (EvSelection      *selection,
61                                EvRenderContext  *rc,
62                                cairo_surface_t **surface,
63                                EvRectangle      *points,
64                                EvRectangle      *old_points,
65                                EvSelectionStyle  style,
66                                GdkColor         *text,
67                                GdkColor         *base)
68 {
69         EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
70
71         if (!iface->render_selection)
72                 return;
73         
74         iface->render_selection (selection, rc,
75                                  surface,
76                                  points, old_points,
77                                  style,
78                                  text, base);
79 }
80
81 gchar *
82 ev_selection_get_selected_text (EvSelection      *selection,
83                                 EvRenderContext  *rc,
84                                 EvSelectionStyle  style,
85                                 EvRectangle      *points)
86 {
87         EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
88
89         return iface->get_selected_text (selection, rc, style, points);
90 }
91
92 GdkRegion *
93 ev_selection_get_selection_region (EvSelection     *selection,
94                                    EvRenderContext *rc,
95                                    EvSelectionStyle style,
96                                    EvRectangle     *points)
97 {
98         EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
99
100         if (!iface->get_selection_region)
101                 return NULL;
102         
103         return iface->get_selection_region (selection, rc, style, points);
104 }
105
106 GdkRegion *
107 ev_selection_get_selection_map (EvSelection     *selection,
108                                 EvRenderContext *rc)
109 {
110         EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
111
112         if (!iface->get_selection_map)
113                 return NULL;
114         
115         return iface->get_selection_map (selection, rc);
116 }