Code

restored pedro/work and added it to make.exclude
[inkscape.git] / src / sp-cursor.cpp
1 #define __SP_CURSOR_C__
3 /*
4  * Use a pixmap to make a cursor.
5  *
6  * Authors:
7  *   Lauris Kaplinski <lauris@kaplinski.com>
8  *   James ----
9  *
10  * Copyright (C) 1999-2006 authors
11  * Copyright (C) 2001-2002 Ximian, Inc.
12  *
13  * Released under GNU GPL, read the file 'COPYING' for more information
14  */
16 #include <string.h>
17 #include <ctype.h>
18 #include "sp-cursor.h"
20 GdkCursor *sp_cursor_new (GdkDisplay *display, GdkPixbuf *pixbuf, gchar **xpm, gint hot_x, gint hot_y)
21 {
22     GdkCursor *new_cursor=NULL;
24     if ((!pixbuf && xpm) || !gdk_display_supports_cursor_alpha(display)) 
25         //if there is no pixbuf, but there is xpm data, or the display 
26         //doesn't support alpha, use bitmap cursor.
27     {
28         pixbuf=gdk_pixbuf_new_from_xpm_data((const char**)xpm);
29     }
30     if(pixbuf) {
31         new_cursor = gdk_cursor_new_from_pixbuf(display,pixbuf,hot_x,hot_y);
32     }
33     return new_cursor;
34 }
38 GdkCursor *sp_cursor_new_from_xpm (gchar **xpm, gint hot_x, gint hot_y)
39 {
40     GdkDisplay *display=gdk_display_get_default();
41     GdkPixbuf *pixbuf=NULL;
42     GdkCursor *new_cursor=NULL;
43     pixbuf=gdk_pixbuf_new_from_xpm_data((const char**)xpm);
44     if (pixbuf != NULL){
45         new_cursor = gdk_cursor_new_from_pixbuf(display,pixbuf,hot_x,hot_y);
46         g_message("xpm cursor defined\n");
47         return new_cursor;
48     }
49     g_warning("xpm cursor not defined\n");
51     return NULL;
52 }
56 GdkCursor *sp_cursor_new_from_pixbuf (GdkPixbuf *pixbuf, gint hot_x, gint hot_y)
57 {
58     GdkDisplay *display=gdk_display_get_default();
59     GdkCursor *new_cursor=NULL;
60     if (pixbuf) {
61         new_cursor = gdk_cursor_new_from_pixbuf(display,pixbuf,hot_x,hot_y);
62         g_message("pixbuf cursor defined\n");
63         return new_cursor;
64      }
65     g_warning("pixbuf cursor not defined\n");
66         return new_cursor;
67     return NULL;
68 }
70 /*
71   Local Variables:
72   mode:c++
73   c-file-style:"stroustrup"
74   c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
75   indent-tabs-mode:nil
76   fill-column:99
77   End:
78 */
79 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :