XCursorTest1.src 2.0 KB

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