]> www.fi.muni.cz Git - evince.git/blob - libdocument/ev-selection.c
25879a9202ffc63e14054d04a807c9b8d7c46cc6
[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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  */
20
21 #include "config.h"
22
23 #include "ev-selection.h"
24
25 G_DEFINE_INTERFACE (EvSelection, ev_selection, 0)
26
27 static void
28 ev_selection_default_init (EvSelectionInterface *klass)
29 {
30 }
31
32 void
33 ev_selection_render_selection (EvSelection      *selection,
34                                EvRenderContext  *rc,
35                                cairo_surface_t **surface,
36                                EvRectangle      *points,
37                                EvRectangle      *old_points,
38                                EvSelectionStyle  style,
39                                GdkColor         *text,
40                                GdkColor         *base)
41 {
42         EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
43
44         if (!iface->render_selection)
45                 return;
46         
47         iface->render_selection (selection, rc,
48                                  surface,
49                                  points, old_points,
50                                  style,
51                                  text, base);
52 }
53
54 gchar *
55 ev_selection_get_selected_text (EvSelection      *selection,
56                                 EvPage           *page,
57                                 EvSelectionStyle  style,
58                                 EvRectangle      *points)
59 {
60         EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
61
62         return iface->get_selected_text (selection, page, style, points);
63 }
64
65 GdkRegion *
66 ev_selection_get_selection_region (EvSelection     *selection,
67                                    EvRenderContext *rc,
68                                    EvSelectionStyle style,
69                                    EvRectangle     *points)
70 {
71         EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
72
73         if (!iface->get_selection_region)
74                 return NULL;
75         
76         return iface->get_selection_region (selection, rc, style, points);
77 }
78
79 GdkRegion *
80 ev_selection_get_selection_map (EvSelection *selection,
81                                 EvPage      *page)
82 {
83         EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
84
85         if (!iface->get_selection_map)
86                 return NULL;
87
88         return iface->get_selection_map (selection, page);
89 }