1 /*****************************************************************
2     ViewKlass - C++ framework library for Motif
3 
4     This library is free software; you can redistribute it and/or
5     modify it under the terms of the GNU Library General Public
6     License as published by the Free Software Foundation; either
7     version 2 of the License, or (at your option) any later version.
8 
9     This library is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12     Library General Public License for more details.
13 
14     You should have received a copy of the GNU Library General Public
15     License along with this library; if not, write to the Free
16     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 
18     Copyright (C) 2001 John Lemcke
19     jostle@users.sourceforge.net
20 *****************************************************************/
21 
22 /**
23  *
24  * builtinbusy.C
25  *
26  * This file contains the implementation of the built-in busy cursor
27  *
28  * Chris Toshok
29  *
30  **/
31 
32 static const char* rcsid
33 #ifdef __GNUC__
34 __attribute__ ((unused))
35 #endif
36 = "$Id: builtinbusy.C,v 1.10 2009/03/21 11:44:34 jostle Exp $";
37 
38 #include <Vk/builtinbusy.h>
39 
40 using namespace std;
41 
BuiltInBusyCursor()42 BuiltInBusyCursor::BuiltInBusyCursor() : VkCursorList (NUMCURSORS)
43 {
44 	xcolors[0].pixel =
45 		(Pixel) VkGetResource(theApplication->baseWidget(),
46 							  "busyCursorForeground",
47 							  XmCForeground,
48 							  XmRPixel,
49 							  "Black");
50 
51 	xcolors[1].pixel =
52 		(Pixel) VkGetResource(theApplication->baseWidget(),
53 							  "busyCursorBackground",
54 							  XmCBackground,
55 							  XmRPixel,
56 							  "White");
57 
58 	XQueryColors(theApplication->display(),
59 				 DefaultColormapOfScreen(DefaultScreenOfDisplay(
60 					 theApplication->display())),
61 				 xcolors, 2);
62 }
63 
64 void
createCursor(int indx)65 BuiltInBusyCursor::createCursor(int indx)
66 {
67 	Pixmap pixmap = 0, maskPixmap = 0;
68 
69 	Display *dpy = theApplication->display();
70 
71 	pixmap = XCreateBitmapFromData(dpy,
72 								   DefaultRootWindow(dpy),
73 								   (const char*)clock_bits[indx*2],
74 								   CURSOR_WIDTH, CURSOR_HEIGHT);
75 
76 	maskPixmap = XCreateBitmapFromData(dpy,
77 									   DefaultRootWindow(dpy),
78 									   (const char*)clock_bits[indx*2+1],
79 									   CURSOR_WIDTH, CURSOR_HEIGHT);
80 
81 	_cursorList[indx] = XCreatePixmapCursor(dpy, pixmap, maskPixmap,
82                                             &(xcolors[0]), &(xcolors[1]),
83                                             0,0);
84 
85 	if (pixmap)	XFreePixmap(dpy, pixmap);
86 	if (maskPixmap)	XFreePixmap(dpy, maskPixmap);
87 }
88 
89