convert all Imakefile LinuxDistribution to LinuxArchitecture.
[oweals/cde.git] / cde / programs / dtksh / examples / XCursorTest1.src
1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM  $XConsortium: XCursorTest1.src /main/3 1996/04/23 20:19:21 drk $
3
4 XCOMM #########################################################################
5 XCOMM   (c) Copyright 1993, 1994 Hewlett-Packard Company        
6 XCOMM   (c) Copyright 1993, 1994 International Business Machines Corp.
7 XCOMM   (c) Copyright 1993, 1994 Sun Microsystems, Inc.
8 XCOMM   (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
9 XCOMM       Novell, Inc.
10 XCOMM #########################################################################
11
12
13 XCOMM 
14 XCOMM  This sample shell script demonstrates how the 'call' command can be used
15 XCOMM  to obtain an 'X' cursor, and then how that cursor can be set for a
16 XCOMM  widget hierarchy.
17 XCOMM 
18
19 XCOMM  Pushbutton Callback: set the cursor for the widget hierarchy
20 DefineCursor()
21 {
22    XDefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) $CURSOR
23 }
24
25 XCOMM  Pushbutton Callback: unset the cursor for the widget hierarchy
26 UndefineCursor()
27 {
28    XUndefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
29 }
30
31 XCOMM ###################### Create the Main UI ###############################
32
33 XtInitialize TOPLEVEL xCursorTest XCursorTest "$0" "$@"
34 XtSetValues $TOPLEVEL allowShellResize:True
35
36 XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
37 XtSetValues $DA height:200 width:200
38
39 XtRealizeWidget $TOPLEVEL
40
41 XtCreateApplicationShell TOPLEVEL2 xCursorTesta TopLevelShell
42
43 XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
44          orientation:HORIZONTAL \
45          numColumns:2 \
46          packing:PACK_COLUMN 
47
48 XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
49         labelString:"Define Cursor"
50 XtAddCallback $PB1 activateCallback "DefineCursor"
51
52 XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
53         labelString:"Undefine Cursor"
54 XtAddCallback $PB2 activateCallback "UndefineCursor"
55
56 XCOMM  Call the X function for getting a cursor
57 call XCreateFontCursor $(XtDisplay "-" $TOPLEVEL) 10
58 CURSOR=$RET
59 echo "Cursor = "$CURSOR
60
61 XtRealizeWidget $TOPLEVEL2
62
63 XtMainLoop