1 XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
2 XCOMM $XConsortium: XdrawTest.src /main/3 1996/04/23 20:19:28 drk $
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
10 XCOMM #########################################################################
14 XCOMM This sample shell script demonstrates the calling sequence for most of
15 XCOMM the X drawing commands.
20 XDrawRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
24 XFillRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
25 -foreground red -background green 20 30 80 180
27 XClearArea $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
30 XDrawLine $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
31 -foreground red -background white 130 22 130 117
33 XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
37 XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
38 -CoordModePrevious -line_width 3 160 30 0 71 \
41 XDrawPoint $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
44 XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
45 190 30 190 40 190 50 190 60 190 70 190 80 190 90 190 101
47 XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
49 200 30 0 10 0 10 0 10 0 10 0 10 0 10 0 10
51 XDrawSegments $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
52 -function clear -foreground green -background red \
54 210 30 210 40 210 50 210 60 210 70 210 80 210 90 210 100
56 XDrawArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
57 -line_width 3 20 300 100 150 300 5760
59 XFillArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
60 -line_width 3 20 270 100 150 11520 5760
62 XDrawString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
63 -font fixed -foreground blue -background red 200 200 \
66 XDrawImageString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
67 -foreground green -background red 200 250 \
70 XFillPolygon $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
71 -Convex -CoordModePrevious \
74 XTextWidth "-" fixed "Hi Mom"
79 XClearWindow $(XtDisplay "-" $DRAWINGAREA) $(XtWindow "-" $DRAWINGAREA)
83 XCOMM ###################### Create the Main UI ###############################
85 XtInitialize TOPLEVEL drawingArea DrawingArea "$0" "$@"
87 XtCreateManagedWidget FORM form XmForm $TOPLEVEL
89 XtCreateManagedWidget DRAWINGAREA drawingArea XmDrawingArea $FORM \
90 topAttachment:ATTACH_FORM \
91 leftAttachment:ATTACH_FORM \
92 rightAttachment:ATTACH_FORM
93 XtAddCallback $DRAWINGAREA exposeCallback ExposeCallback
95 XtCreateManagedWidget SEP sep XmSeparator $FORM \
96 topAttachment:ATTACH_WIDGET \
97 topWidget:$DRAWINGAREA \
98 leftAttachment:ATTACH_FORM \
99 rightAttachment:ATTACH_FORM
101 XtCreateManagedWidget PB pb XmPushButton $FORM \
102 labelString:"Clear The Window" \
103 topAttachment:ATTACH_WIDGET \
105 leftAttachment:ATTACH_FORM \
106 rightAttachment:ATTACH_FORM \
107 bottomAttachment:ATTACH_FORM
108 XtAddCallback $PB activateCallback ClearWindow
110 XtSetValues $DRAWINGAREA \
114 XtRealizeWidget $TOPLEVEL