]> www.fi.muni.cz Git - evince.git/blobdiff - libdocument/ev-selection.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / libdocument / ev-selection.c
index 2aa45a7cafbd86710695389202ad107a6fead542..49e56eb434ae3967e54d5b439571ec557a828a1d 100644 (file)
@@ -14,7 +14,7 @@
  *
  *  You should have received a copy of the GNU General Public License
  *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  */
 
 
 #include "ev-selection.h"
 
-static void ev_selection_base_init (gpointer g_class);
-
-GType
-ev_selection_get_type (void)
-{
-       static GType type = 0;
-
-       if (G_UNLIKELY (type == 0))
-       {
-               const GTypeInfo our_info =
-               {
-                       sizeof (EvSelectionIface),
-                       ev_selection_base_init,
-                       NULL,
-               };
-
-               type = g_type_register_static (G_TYPE_INTERFACE,
-                                              "EvSelection",
-                                              &our_info, (GTypeFlags)0);
-       }
-
-       return type;
-}
+G_DEFINE_INTERFACE (EvSelection, ev_selection, 0)
 
 static void
-ev_selection_base_init (gpointer g_class)
+ev_selection_default_init (EvSelectionInterface *klass)
 {
-       static gboolean initialized = FALSE;
-
-       if (!initialized) {
-       }
 }
 
-
 void
 ev_selection_render_selection (EvSelection      *selection,
                               EvRenderContext  *rc,
-                              GdkPixbuf       **pixbuf,
+                              cairo_surface_t **surface,
                               EvRectangle      *points,
                               EvRectangle      *old_points,
-                              GdkColor        *text,
-                              GdkColor        *base)
+                              EvSelectionStyle  style,
+                              GdkColor         *text,
+                              GdkColor         *base)
 {
-       EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
+       EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
 
+       if (!iface->render_selection)
+               return;
+       
        iface->render_selection (selection, rc,
-                                pixbuf,
+                                surface,
                                 points, old_points,
+                                style,
                                 text, base);
 }
 
-GdkRegion *
-ev_selection_get_selection_region (EvSelection     *selection,
-                                  EvRenderContext *rc,
-                                  EvRectangle     *points)
+gchar *
+ev_selection_get_selected_text (EvSelection      *selection,
+                               EvPage           *page,
+                               EvSelectionStyle  style,
+                               EvRectangle      *points)
 {
-       EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
+       EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
 
-       return iface->get_selection_region (selection, rc, points);
+       return iface->get_selected_text (selection, page, style, points);
 }
 
-GdkRegion *
-ev_selection_get_selection_map (EvSelection     *selection,
-                               EvRenderContext *rc)
+cairo_region_t *
+ev_selection_get_selection_region (EvSelection     *selection,
+                                  EvRenderContext *rc,
+                                  EvSelectionStyle style,
+                                  EvRectangle     *points)
 {
-       EvSelectionIface *iface = EV_SELECTION_GET_IFACE (selection);
+       EvSelectionInterface *iface = EV_SELECTION_GET_IFACE (selection);
 
-       return iface->get_selection_map (selection, rc);
+       if (!iface->get_selection_region)
+               return NULL;
+       
+       return iface->get_selection_region (selection, rc, style, points);
 }