]> www.fi.muni.cz Git - evince.git/blob - libview/ev-view-cursor.c
6411712a4212a218ad2ebdb04af95c4fc134f6c0
[evince.git] / libview / ev-view-cursor.c
1 /* this file is part of evince, a gnome document viewer
2  *
3  *  Copyright (C) 2004 Red Hat, Inc
4  *
5  * Evince is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * Evince is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * 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 #include "ev-view-cursor.h"
21
22 static GdkCursor *
23 ev_view_create_invisible_cursor (void)
24 {
25         GdkBitmap *empty;
26         GdkColor black = { 0, 0, 0, 0 };
27         static char bits[] = { 0x00 };
28
29         empty = gdk_bitmap_create_from_data (NULL, bits, 1, 1);
30
31         return gdk_cursor_new_from_pixmap (empty, empty, &black, &black, 0, 0);
32 }
33
34 GdkCursor *
35 ev_view_cursor_new (GdkDisplay  *display,
36                     EvViewCursor new_cursor)
37 {
38         GdkCursor *cursor = NULL;
39
40         switch (new_cursor) {
41         case EV_VIEW_CURSOR_NORMAL:
42                 break;
43         case EV_VIEW_CURSOR_IBEAM:
44                 cursor = gdk_cursor_new_for_display (display, GDK_XTERM);
45                 break;
46         case EV_VIEW_CURSOR_LINK:
47                 cursor = gdk_cursor_new_for_display (display, GDK_HAND2);
48                 break;
49         case EV_VIEW_CURSOR_WAIT:
50                 cursor = gdk_cursor_new_for_display (display, GDK_WATCH);
51                 break;
52         case EV_VIEW_CURSOR_HIDDEN:
53                 cursor = ev_view_create_invisible_cursor ();
54                 break;
55         case EV_VIEW_CURSOR_DRAG:
56                 cursor = gdk_cursor_new_for_display (display, GDK_FLEUR);
57                 break;
58         case EV_VIEW_CURSOR_AUTOSCROLL:
59                 cursor = gdk_cursor_new_for_display (display, GDK_DOUBLE_ARROW);
60                 break;
61         }
62
63         return cursor;
64 }