Initial import of the CDE 2.1.30 sources from the Open Group.
This commit is contained in:
143
cde/programs/dtksh/examples/CallDataTest4.src
Executable file
143
cde/programs/dtksh/examples/CallDataTest4.src
Executable file
@@ -0,0 +1,143 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: CallDataTest4.src /main/3 1996/04/23 20:17:51 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how the CB_WIDGET and CB_CALL_DATA
|
||||
XCOMM convenience environment variables can be referenced within a callback
|
||||
XCOMM function.
|
||||
XCOMM
|
||||
|
||||
XCOMM PushButton Callback: Forces the scale to reset to the origin
|
||||
ResetScale()
|
||||
{
|
||||
XmScaleSetValue $SCALE 0
|
||||
}
|
||||
|
||||
XCOMM PushButton Callback: Forces the scale to its minimum value
|
||||
SetScaleMin()
|
||||
{
|
||||
XmScaleSetValue $SCALE -200
|
||||
}
|
||||
|
||||
XCOMM PushButton Callback: Forces the scale to its maximum value
|
||||
SetScaleMax()
|
||||
{
|
||||
XmScaleSetValue $SCALE 200
|
||||
|
||||
echo "CB Widget = "$CB_WIDGET
|
||||
echo "CallData = "$CB_CALL_DATA
|
||||
echo "CallData.Reason = "${CB_CALL_DATA.REASON}
|
||||
echo "CallData.Event = "${CB_CALL_DATA.EVENT}
|
||||
echo "CallData.Event.Type = "${CB_CALL_DATA.EVENT.TYPE}
|
||||
echo "CallData.Event.Xbutton.Type = "${CB_CALL_DATA.EVENT.XBUTTON.TYPE}
|
||||
echo "CallData.Event.Xbutton.Serial = "${CB_CALL_DATA.EVENT.XBUTTON.SERIAL}
|
||||
echo "CallData.Event.Xbutton.Send_Event = "${CB_CALL_DATA.EVENT.XBUTTON.SEND_EVENT}
|
||||
echo "CallData.Event.Xbutton.Display = "${CB_CALL_DATA.EVENT.XBUTTON.DISPLAY}
|
||||
echo "CallData.Event.Xbutton.Window = "${CB_CALL_DATA.EVENT.XBUTTON.WINDOW}
|
||||
echo "CallData.Event.Xbutton.Root = "${CB_CALL_DATA.EVENT.XBUTTON.ROOT}
|
||||
echo "CallData.Event.Xbutton.Subwindow = "${CB_CALL_DATA.EVENT.XBUTTON.SUBWINDOW}
|
||||
echo "CallData.Event.Xbutton.Time = "${CB_CALL_DATA.EVENT.XBUTTON.TIME}
|
||||
echo "CallData.Event.Xbutton.X = "${CB_CALL_DATA.EVENT.XBUTTON.X}
|
||||
echo "CallData.Event.Xbutton.Y = "${CB_CALL_DATA.EVENT.XBUTTON.Y}
|
||||
echo "CallData.Event.Xbutton.X_root = "${CB_CALL_DATA.EVENT.XBUTTON.X_ROOT}
|
||||
echo "CallData.Event.Xbutton.Y_root = "${CB_CALL_DATA.EVENT.XBUTTON.Y_ROOT}
|
||||
echo "CallData.Event.Xbutton.State = "${CB_CALL_DATA.EVENT.XBUTTON.STATE}
|
||||
echo "CallData.Event.Xbutton.Button = "${CB_CALL_DATA.EVENT.XBUTTON.BUTTON}
|
||||
echo "CallData.Event.Xbutton.Same_Screen = "${CB_CALL_DATA.EVENT.XBUTTON.SAME_SCREEN}
|
||||
echo
|
||||
}
|
||||
|
||||
|
||||
XCOMM Scale Callback: Invoked when the user interactively modified the scale value
|
||||
ScaleValueChanged()
|
||||
{
|
||||
XmScaleGetValue $CB_WIDGET VALUE
|
||||
|
||||
echo "New Scale Value = "$VALUE
|
||||
echo "CB Widget = "$CB_WIDGET
|
||||
echo "CallData = "$CB_CALL_DATA
|
||||
echo "CallData.Value = "${CB_CALL_DATA.VALUE}
|
||||
echo "CallData.Event = "${CB_CALL_DATA.EVENT}
|
||||
echo "CallData.Event.Xany.Type = "${CB_CALL_DATA.EVENT.XANY.TYPE}
|
||||
echo "CallData.Event.Type = "${CB_CALL_DATA.EVENT.TYPE}
|
||||
echo "CallData.Reason = "${CB_CALL_DATA.REASON}
|
||||
echo
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL command1 Command1 "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
|
||||
|
||||
XtCreateManagedWidget SCALE scale XmScale $FORM \
|
||||
showValue:True \
|
||||
orientation:HORIZONTAL \
|
||||
maximum:200 \
|
||||
minimum:-200 \
|
||||
topAttachment:ATTACH_FORM \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:10 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10
|
||||
XtAddCallback $SCALE valueChangedCallback ScaleValueChanged
|
||||
|
||||
XtCreateManagedWidget SEP sep XmSeparator $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SCALE \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
rightAttachment:ATTACH_FORM
|
||||
|
||||
XtCreateManagedWidget PB pb XmPushButton $FORM \
|
||||
labelString:"Reset Scale" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topOffset:10 \
|
||||
topWidget:$SEP \
|
||||
bottomAttachment:ATTACH_FORM \
|
||||
bottomOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:30
|
||||
XtAddCallback $PB activateCallback ResetScale
|
||||
|
||||
XtCreateManagedWidget PB2 pb XmPushButton $FORM \
|
||||
labelString:"Set Scale Max" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topOffset:10 \
|
||||
topWidget:$SEP \
|
||||
bottomAttachment:ATTACH_FORM \
|
||||
bottomOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:40 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:60
|
||||
XtAddCallback $PB2 activateCallback SetScaleMax
|
||||
|
||||
XtCreateManagedWidget PB3 pb XmPushButton $FORM \
|
||||
labelString:"Set Scale Min" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topOffset:10 \
|
||||
topWidget:$SEP \
|
||||
bottomAttachment:ATTACH_FORM \
|
||||
bottomOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:70 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90
|
||||
XtAddCallback $PB3 activateCallback SetScaleMin
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtMainLoop
|
||||
89
cde/programs/dtksh/examples/CallbackTest2.src
Executable file
89
cde/programs/dtksh/examples/CallbackTest2.src
Executable file
@@ -0,0 +1,89 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: CallbackTest2.src /main/3 1996/04/23 20:17:57 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how widget callbacks can be
|
||||
XCOMM added and removed. It adds callbacks both using XtAddCallback and
|
||||
XCOMM by specifying a callback as a resource, when the test pushbutton
|
||||
XCOMM is created.
|
||||
XCOMM
|
||||
|
||||
XCOMM The activate callback which can be dynamically added and removed
|
||||
ActivateCallback1()
|
||||
{
|
||||
echo "activateCallback1 invoked"
|
||||
}
|
||||
|
||||
XCOMM The activate callback which is added when the widget was created
|
||||
ActivateCallback2()
|
||||
{
|
||||
echo "activateCallback2 invoked"
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: Adds an activate callback to the test pushbutton
|
||||
AddCallback1()
|
||||
{
|
||||
XtAddCallback $TESTPB activateCallback ActivateCallback1
|
||||
XtGetValues $TESTPB activateCallback:AC
|
||||
echo "Callback list = "$AC
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: Removes an activate callback from the test pushbutton
|
||||
DeleteCallback1()
|
||||
{
|
||||
XtRemoveCallback $TESTPB activateCallback ActivateCallback1
|
||||
XtGetValues $TESTPB activateCallback:AC2
|
||||
echo "Callback list = "$AC2
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL callbackTest CallbackTest "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
|
||||
|
||||
XtCreateManagedWidget PB1 pb XmPushButton $FORM \
|
||||
labelString:"Add Callback1" \
|
||||
topAttachment:ATTACH_FORM \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:40 \
|
||||
activateCallback:AddCallback1
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $FORM \
|
||||
labelString:"Delete Callback1" \
|
||||
topAttachment:ATTACH_FORM \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:60 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90 \
|
||||
activateCallback:DeleteCallback1
|
||||
|
||||
XtCreateManagedWidget TESTPB testpb XmPushButton $FORM \
|
||||
labelString:"Test Button" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB2 \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:20 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:80 \
|
||||
bottomAttachment:ATTACH_FORM \
|
||||
bottomOffset:10 \
|
||||
activateCallback:ActivateCallback2
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtMainLoop
|
||||
59
cde/programs/dtksh/examples/DtCursorTest2.src
Executable file
59
cde/programs/dtksh/examples/DtCursorTest2.src
Executable file
@@ -0,0 +1,59 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: DtCursorTest2.src /main/3 1996/04/23 20:18:02 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how a cursor can be defined or
|
||||
XCOMM undefined for an X window.
|
||||
XCOMM
|
||||
|
||||
XCOMM Pushbutton Callback: set the busy cursor for the toplevel window
|
||||
DefineCursor()
|
||||
{
|
||||
XDefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) $CURSOR
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: remove the busy cursor from the toplevel window
|
||||
UndefineCursor()
|
||||
{
|
||||
XUndefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL dtCursorTest2 DtCursorTest2 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
|
||||
XtSetValues $DA height:200 width:200
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 dtCursorTest2a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Define Cursor"
|
||||
XtAddCallback $PB1 activateCallback "DefineCursor"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Undefine Cursor"
|
||||
XtAddCallback $PB2 activateCallback "UndefineCursor"
|
||||
|
||||
_DtGetHourGlassCursor CURSOR $(XtDisplay "-" $TOPLEVEL)
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
155
cde/programs/dtksh/examples/DtWsTest1.src
Executable file
155
cde/programs/dtksh/examples/DtWsTest1.src
Executable file
@@ -0,0 +1,155 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: DtWsTest1.src /main/3 1996/04/23 20:18:06 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how to interact with the workspace
|
||||
XCOMM manager. It demonstrates the following capabilities:
|
||||
XCOMM
|
||||
XCOMM 1) How to query which workspaces the widgets currently reside it.
|
||||
XCOMM 2) How to set the current workspace.
|
||||
XCOMM 3) How to be notified when the current workspace changes.
|
||||
XCOMM
|
||||
|
||||
|
||||
integer wsCount
|
||||
|
||||
XCOMM Pushbutton Callback: This function asks the workspace manager to change
|
||||
XCOMM to the workspace indicated by $1; $1 is an X atom
|
||||
XCOMM which identifies the new workspace. At some point
|
||||
XCOMM after our request to the workspace manager, the
|
||||
XCOMM workspace manager will activate our WsCB function,
|
||||
XCOMM letting us know that the change has actually taken
|
||||
XCOMM place.
|
||||
SetWorkspace()
|
||||
{
|
||||
echo
|
||||
if DtWsmSetCurrentWorkspace $TOPLEVEL $1; then
|
||||
echo "Changing to new workspace"
|
||||
else
|
||||
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $1
|
||||
echo "Unable to Change to workspace " $NAME
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM Workspace Changed Callback: This function is invoked whenever the workspace
|
||||
XCOMM manager changes workspaces. It will simply
|
||||
XCOMM query the 'name' of the new workspace, and
|
||||
XCOMM echo it outl
|
||||
WsCB()
|
||||
{
|
||||
DtWsmGetCurrentWorkspace $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
|
||||
NEW_ATOM
|
||||
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $NEW_ATOM
|
||||
echo "Change to workspace complete " $NAME "("$NEW_ATOM")"
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL dtWsTest DtWsTest "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
|
||||
XtSetValues $DA height:200 width:200
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
XSync $(XtDisplay "-" $TOPLEVEL) False
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 DtWsTesta TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XCOMM Get a list of all of the workspaces, and create a pushbutton for each one.
|
||||
XCOMM When a pushbutton is activated, it will ask the workspace manager to
|
||||
XCOMM change to the indicated workspace.
|
||||
oldIF=$IFS
|
||||
if DtWsmGetWorkspaceList $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
|
||||
WS_LIST;
|
||||
then
|
||||
IFS=,
|
||||
wsCount=0
|
||||
for item in $WS_LIST;
|
||||
do
|
||||
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
||||
label="Set Current Workspace to "$NAME
|
||||
XtCreateManagedWidget ITEM $item XmPushButton $RC \
|
||||
labelString:$label
|
||||
XtAddCallback $ITEM activateCallback "SetWorkspace $item"
|
||||
wsCount=$wsCount+1
|
||||
done
|
||||
IFS=$oldIFS
|
||||
else
|
||||
echo "Unable to get workspace list"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
XtSetValues $RC numColumns:$wsCount
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
XSync $(XtDisplay "-" $TOPLEVEL) False
|
||||
|
||||
XCOMM The following block queries the initial set of workspaces occupied by
|
||||
XCOMM this shell script; this list is printed out. Next, it will ask the
|
||||
XCOMM workspace manager to move the shell script windows into all workspaces.
|
||||
XCOMM Lastly, it will again ask the workspace manager for the list of
|
||||
XCOMM workspaces occupied by the shell script windows, and will again print
|
||||
XCOMM out the list.
|
||||
if DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XtWindow "-" $TOPLEVEL) \
|
||||
CURRENT_WS_LIST ;
|
||||
then
|
||||
echo "Initial workspaces occupied:"
|
||||
for item in $CURRENT_WS_LIST;
|
||||
do
|
||||
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
||||
echo " "$NAME
|
||||
done
|
||||
|
||||
DtWsmGetWorkspaceList $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XRootWindowOfScreen "-" $(XtScreen "-" $TOPLEVEL)) \
|
||||
WS_LIST
|
||||
|
||||
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XtWindow "-" $TOPLEVEL) \
|
||||
$WS_LIST
|
||||
|
||||
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL2) \
|
||||
$(XtWindow "-" $TOPLEVEL2) \
|
||||
$WS_LIST
|
||||
else
|
||||
echo "Unable to get current list of occupied workspaces"
|
||||
echo -2
|
||||
fi
|
||||
|
||||
XSync $(XtDisplay "-" $TOPLEVEL) False
|
||||
|
||||
XCOMM Print the new list of workspaces occupied
|
||||
DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XtWindow "-" $TOPLEVEL) \
|
||||
CURRENT_WS_LIST
|
||||
|
||||
echo "After modification, workspaces occupied:"
|
||||
IFS=,
|
||||
for item in $CURRENT_WS_LIST;
|
||||
do
|
||||
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
||||
echo " "$NAME
|
||||
done
|
||||
IFS=$oldIFS
|
||||
echo ""
|
||||
|
||||
XCOMM Add a callback to be notified whenever the workspace changes.
|
||||
DtWsmAddCurrentWorkspaceCallback HANDLE1 $TOPLEVEL WsCB
|
||||
|
||||
XtMainLoop
|
||||
215
cde/programs/dtksh/examples/EventHandlerTest.src
Executable file
215
cde/programs/dtksh/examples/EventHandlerTest.src
Executable file
@@ -0,0 +1,215 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: EventHandlerTest.src /main/3 1996/04/23 20:18:10 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how event handlers can be added
|
||||
XCOMM and removed. It also demonstrates how the EH_WIDGET and EH_EVENT
|
||||
XCOMM convenience environment variables can be referenced.
|
||||
XCOMM
|
||||
|
||||
|
||||
EventHandler1()
|
||||
{
|
||||
echo "EH_WIDGET ="$EH_WIDGET
|
||||
echo "EH_EVENT ="$EH_EVENT
|
||||
echo "EH_EVENT.TYPE ="${EH_EVENT.TYPE}
|
||||
echo "event handler 1 invoked ("$1")"
|
||||
}
|
||||
|
||||
EventHandler2()
|
||||
{
|
||||
echo "EH_WIDGET ="$EH_WIDGET
|
||||
echo "EH_EVENT ="$EH_EVENT
|
||||
echo "EH_EVENT.TYPE ="${EH_EVENT.TYPE}
|
||||
echo "event handler 1 invoked ("$1")"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Adds an event handler to the form widget
|
||||
AddMaskableEventHandler1()
|
||||
{
|
||||
XtAddEventHandler $FORM2 "Button2MotionMask" False \
|
||||
"EventHandler1 1"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Adds an event handler to the form widget
|
||||
AddMaskableEventHandler2()
|
||||
{
|
||||
XtAddEventHandler $FORM2 "ButtonPressMask|ButtonReleaseMask" False \
|
||||
"EventHandler1 1"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Adds an event handler to the form widget
|
||||
AddMaskableEventHandler3()
|
||||
{
|
||||
XtAddEventHandler $FORM2 "Button2MotionMask" False \
|
||||
"EventHandler1 2"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Adds an event handler to the form widget
|
||||
AddNonmaskableEventHandler()
|
||||
{
|
||||
XtAddEventHandler $FORM2 "NoEventMask" True "EventHandler2 1"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Adds an event handler to the form widget.
|
||||
XCOMM Should report a bad event mask.
|
||||
AddBadEventHandler()
|
||||
{
|
||||
XtAddEventHandler $FORM2 "fooMask" False "EventHandler2 1"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Removes an event handler to the form widget
|
||||
RemoveEventHandler1()
|
||||
{
|
||||
XtRemoveEventHandler $FORM2 "Button2MotionMask" False \
|
||||
"EventHandler1 1"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Removes an event handler to the form widget
|
||||
RemoveEventHandler2()
|
||||
{
|
||||
XtRemoveEventHandler $FORM2 "ButtonPressMask|ButtonReleaseMask" False \
|
||||
"EventHandler1 1"
|
||||
}
|
||||
|
||||
XCOMM PushbuttonCallback: Removes an event handler to the form widget
|
||||
RemoveEventHandler1and2()
|
||||
{
|
||||
XtRemoveEventHandler $FORM2 "XtAllEvents" True "EventHandler1 1"
|
||||
}
|
||||
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL eventHandlerTest EventHandlerTest "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
|
||||
|
||||
XtCreateManagedWidget FORM2 form2 XmForm $FORM \
|
||||
topAttachment:ATTACH_FORM \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
rightAttachment:ATTACH_FORM
|
||||
XtSetValues $FORM2 height:150 width:150
|
||||
|
||||
XtCreateManagedWidget SEP sep XmSeparator $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$FORM2 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
rightAttachment:ATTACH_FORM
|
||||
|
||||
XtCreateManagedWidget PB1 pb XmPushButton $FORM \
|
||||
labelString:"Add Maskable Event Handler 1" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SEP \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:40
|
||||
XtAddCallback $PB1 activateCallback AddMaskableEventHandler1
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $FORM \
|
||||
labelString:"Add Maskable Event Handler 2" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SEP \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:60 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90
|
||||
XtAddCallback $PB2 activateCallback AddMaskableEventHandler2
|
||||
|
||||
XtCreateManagedWidget PB3 pb3 XmPushButton $FORM \
|
||||
labelString:"Add Maskable Event Handler 3" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB2 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:40
|
||||
XtAddCallback $PB3 activateCallback AddMaskableEventHandler3
|
||||
|
||||
XtCreateManagedWidget PB4 pb4 XmPushButton $FORM \
|
||||
labelString:"Add Maskable Event Handler 4" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB2 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:60 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90
|
||||
XtAddCallback $PB4 activateCallback AddMaskableEventHandler4
|
||||
XtSetSensitive $PB4 False
|
||||
|
||||
XtCreateManagedWidget PB5 pb5 XmPushButton $FORM \
|
||||
labelString:"Add non-maskable Event Handler" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB4 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:40
|
||||
XtAddCallback $PB5 activateCallback AddNonmaskableEventHandler
|
||||
|
||||
XtCreateManagedWidget PB6 pb6 XmPushButton $FORM \
|
||||
labelString:"Add Bad Event Handler" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB4 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:60 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90
|
||||
XtAddCallback $PB6 activateCallback AddBadEventHandler
|
||||
|
||||
XtCreateManagedWidget PB7 pb7 XmPushButton $FORM \
|
||||
labelString:"Remove Maskable Event Handler 1" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB6 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:40
|
||||
XtAddCallback $PB7 activateCallback RemoveEventHandler1
|
||||
|
||||
XtCreateManagedWidget PB8 pb8 XmPushButton $FORM \
|
||||
labelString:"Remove Maskable Event Handler 2" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB6 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:60 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90
|
||||
XtAddCallback $PB8 activateCallback RemoveEventHandler2
|
||||
|
||||
XtCreateManagedWidget PB9 pb9 XmPushButton $FORM \
|
||||
labelString:"Remove Maskable Event Handler 1 and 2" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PB8 \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:40 \
|
||||
bottomAttachment:ATTACH_FORM \
|
||||
bottomOffset:10
|
||||
XtAddCallback $PB9 activateCallback RemoveEventHandler1and2
|
||||
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtMainLoop
|
||||
31
cde/programs/dtksh/examples/Imakefile
Normal file
31
cde/programs/dtksh/examples/Imakefile
Normal file
@@ -0,0 +1,31 @@
|
||||
XCOMM $XConsortium: Imakefile /main/4 1996/04/21 19:30:42 drk $
|
||||
DESKTOP_VERSION_STRING = DesktopVersionString
|
||||
|
||||
MODULE=dtksh/examples
|
||||
|
||||
LOCAL_CPP_DEFINES = -DCDE_INSTALLATION_TOP=$(CDE_INSTALLATION_TOP) \
|
||||
-DCDE_CONFIGURATION_TOP=$(CDE_CONFIGURATION_TOP)
|
||||
|
||||
CppSourceFile(CallDataTest4,CallDataTest4.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(CallbackTest2,CallbackTest2.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(DtCursorTest2,DtCursorTest2.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(DtWsTest1,DtWsTest1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(EventHandlerTest,EventHandlerTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(ListBounds1,ListBounds1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(ListItemPos1,ListItemPos1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(ListPosSel1,ListPosSel1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(PipeTest,PipeTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(PopupTest,PopupTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(SelBoxResTest,SelBoxResTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(SessionTest,SessionTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(TextCutBuf1,TextCutBuf1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(TextDisp1,TextDisp1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(TextFXYPos1,TextFXYPos1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(TransEventTest,TransEventTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(TransTest1,TransTest1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(WorkProcTest1,WorkProcTest1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(XCursorTest1,XCursorTest1.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(XdrawTest,XdrawTest.src,$(LOCAL_CPP_DEFINES),)
|
||||
CppSourceFile(crMovesText1,crMovesText1.src,$(LOCAL_CPP_DEFINES),)
|
||||
|
||||
all::
|
||||
71
cde/programs/dtksh/examples/ListBounds1.src
Executable file
71
cde/programs/dtksh/examples/ListBounds1.src
Executable file
@@ -0,0 +1,71 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: ListBounds1.src /main/3 1996/04/23 20:18:16 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how to create a list widget, and
|
||||
XCOMM also how to query the bounds for each of the list items.
|
||||
XCOMM
|
||||
|
||||
integer i
|
||||
|
||||
XCOMM Pushbutton Callback: Query the bound for each list item
|
||||
GetBounds()
|
||||
{
|
||||
i=1
|
||||
echo
|
||||
while XmListPosToBounds $LIST $i X Y W H; do
|
||||
echo "Bounds of item "$i" is ("$X $Y $W $H")"
|
||||
i=i+1
|
||||
done
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: Delete the first list item
|
||||
DelFirst()
|
||||
{
|
||||
XmListDeletePos $LIST 1
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL listKbd1 ListKbd1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XmCreateScrolledList LIST $TOPLEVEL list \
|
||||
itemCount:11 \
|
||||
items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
|
||||
visibleItemCount:15 \
|
||||
listSizePolicy:VARIABLE
|
||||
XtSetValues $LIST \
|
||||
selectedItemCount:3 \
|
||||
selectedItems:"item2,item4,item6"
|
||||
XtManageChild $LIST
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 listKbd1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Get Item Bounds"
|
||||
XtAddCallback $PB1 activateCallback "GetBounds"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Delete First Item"
|
||||
XtAddCallback $PB2 activateCallback "DelFirst"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
71
cde/programs/dtksh/examples/ListItemPos1.src
Executable file
71
cde/programs/dtksh/examples/ListItemPos1.src
Executable file
@@ -0,0 +1,71 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: ListItemPos1.src /main/3 1996/04/23 20:18:21 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how to create a list widget, and
|
||||
XCOMM verifies that the XmListItemPos command operates correctly. The list
|
||||
XCOMM contains multiple items with the label "item4"; XmListItemPos will
|
||||
XCOMM return the position of the first occurrence. By selecting the push
|
||||
XCOMM button labeled "Delete First Item", you can delete the first item
|
||||
XCOMM labeled "item4"; the next call to XmListItemPos should now return
|
||||
XCOMM the position of the next item labeled "item4".
|
||||
XCOMM
|
||||
|
||||
XCOMM Pushbutton Callback: prints the position occupied by the first occurrence
|
||||
XCOMM of the "item4" label.
|
||||
GetItemPosition()
|
||||
{
|
||||
XmListItemPos POS $LIST "item4"
|
||||
echo "First position for item4 is: "$POS
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: deletes the first item in the list.
|
||||
DelFirstItem()
|
||||
{
|
||||
XmListDeletePos $LIST 1
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL listItemPos1 ListItemPos1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XmCreateScrolledList LIST $TOPLEVEL list \
|
||||
itemCount:11 \
|
||||
items:"item4,item2,item4,item3,item5,item6,item7,item8,item9,item4,item11" \
|
||||
visibleItemCount:15 \
|
||||
listSizePolicy:VARIABLE
|
||||
XtSetValues $LIST \
|
||||
selectedItemCount:3 \
|
||||
selectedItems:"item2,item4,item6"
|
||||
XtManageChild $LIST
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 ListItemPos1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Get Position Of item4"
|
||||
XtAddCallback $PB1 activateCallback "GetItemPosition"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Delete First Item"
|
||||
XtAddCallback $PB2 activateCallback "DelFirstItem"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
66
cde/programs/dtksh/examples/ListPosSel1.src
Executable file
66
cde/programs/dtksh/examples/ListPosSel1.src
Executable file
@@ -0,0 +1,66 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: ListPosSel1.src /main/3 1996/04/23 20:18:25 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how to create a list widget, and
|
||||
XCOMM also verifies that the XmListPosSelected command works; this command
|
||||
XCOMM returns information about whether an indicated list item is selected.
|
||||
XCOMM
|
||||
|
||||
integer i
|
||||
|
||||
XCOMM Pushbutton Callback: print the selection state of each list item.
|
||||
GetSelectionStatus()
|
||||
{
|
||||
i=1
|
||||
echo
|
||||
while (($i <= 11 )); do
|
||||
if XmListPosSelected $LIST $i; then
|
||||
echo "Item "$i" is selected"
|
||||
else
|
||||
echo "Item "$i" is not selected"
|
||||
fi
|
||||
i=i+1
|
||||
done
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL listPosSel1 ListPosSel1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XmCreateScrolledList LIST $TOPLEVEL list \
|
||||
itemCount:11 \
|
||||
items:"item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,item11" \
|
||||
visibleItemCount:15 \
|
||||
listSizePolicy:VARIABLE
|
||||
XtSetValues $LIST \
|
||||
selectedItemCount:3 \
|
||||
selectedItems:"item2,item4,item6"
|
||||
XtManageChild $LIST
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 ListPosSel1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Get Item Selection Status"
|
||||
XtAddCallback $PB1 activateCallback "GetSelectionStatus"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
43
cde/programs/dtksh/examples/PipeTest.src
Executable file
43
cde/programs/dtksh/examples/PipeTest.src
Executable file
@@ -0,0 +1,43 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: PipeTest.src /main/3 1996/04/23 20:18:30 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates some of the more advanced features
|
||||
XCOMM of dtksh. It shows how a structure can be defined and accessed, and
|
||||
XCOMM how a C library function can be called.
|
||||
XCOMM
|
||||
|
||||
XCOMM Define a structure made up of 2 integer fields: pipe_in and pipe_out
|
||||
struct pipe_fds pipe_in:int pipe_out:int
|
||||
typedef 'struct pipe_fds *' pipe_fds_ptr
|
||||
|
||||
echo "Test 1"
|
||||
XCOMM Malloc space for the structure, and initialize the fields
|
||||
call -F nop '@pipe_fds_ptr:{0,0}'
|
||||
PIPE_FDS=$RET
|
||||
XCOMM Call the pipe(2) kernel intrinsic
|
||||
call pipe $PIPE_FDS
|
||||
RESULT=$RET
|
||||
XCOMM Print the values of the fields in the structure
|
||||
call strprint pipe_fds_ptr $PIPE_FDS
|
||||
echo RESULT = $RESULT
|
||||
echo
|
||||
|
||||
XCOMM Repeat the test, to make sure we get different file descriptors
|
||||
echo "Test 2"
|
||||
call -F nop '@pipe_fds_ptr:{0,0}'
|
||||
PIPE_FDS=$RET
|
||||
call pipe $PIPE_FDS
|
||||
RESULT=$RET
|
||||
call strprint pipe_fds_ptr $PIPE_FDS
|
||||
echo RESULT = $RESULT
|
||||
echo
|
||||
57
cde/programs/dtksh/examples/PopupTest.src
Executable file
57
cde/programs/dtksh/examples/PopupTest.src
Executable file
@@ -0,0 +1,57 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: PopupTest.src /main/3 1996/04/23 20:18:36 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates the steps necessary to create and
|
||||
XCOMM manage a popup menu.
|
||||
XCOMM
|
||||
|
||||
|
||||
XCOMM This event handler positions the menu at the point where the button event
|
||||
XCOMM occurred, and then posts the popup menu.
|
||||
EventHandler()
|
||||
{
|
||||
XmMenuPosition $POPUP $EH_EVENT
|
||||
XtManageChild $POPUP
|
||||
}
|
||||
|
||||
|
||||
XCOMM Menu button callback
|
||||
MenuActivated()
|
||||
{
|
||||
echo "Menu Activated: "$1
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL popupTest PopupTest "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
|
||||
XtSetValues $FORM height:300 width:300
|
||||
XtAddEventHandler $FORM "ButtonPressMask" False EventHandler
|
||||
|
||||
XmCreatePopupMenu POPUP $FORM "popup"
|
||||
XmCreatePushButton PB1 $POPUP "pb1" \
|
||||
labelString:"Menu Item 1"
|
||||
XtManageChild $PB1
|
||||
XtAddCallback $PB1 activateCallback "MenuActivated MenuItem1"
|
||||
XmCreatePushButton PB2 $POPUP "pb2" \
|
||||
labelString:"Menu Item 2"
|
||||
XtManageChild $PB2
|
||||
XtAddCallback $PB2 activateCallback "MenuActivated MenuItem2"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtMainLoop
|
||||
63
cde/programs/dtksh/examples/SelBoxResTest.src
Executable file
63
cde/programs/dtksh/examples/SelBoxResTest.src
Executable file
@@ -0,0 +1,63 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: SelBoxResTest.src /main/3 1996/04/23 20:18:42 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script verifies that the selection box properly
|
||||
XCOMM interprets the 'childPlacement' resource. Using a timer, it will
|
||||
XCOMM set the resource to a particular value, verify it is correct, and
|
||||
XCOMM then repeat for the next setting.
|
||||
XCOMM
|
||||
|
||||
Timeout3()
|
||||
{
|
||||
XtGetValues $SB childPlacement:CP
|
||||
echo ChildPlacement
|
||||
echo " Expected = PLACE_TOP"
|
||||
echo " Actual = " $CP
|
||||
}
|
||||
|
||||
Timeout2()
|
||||
{
|
||||
XtGetValues $SB childPlacement:CP
|
||||
echo ChildPlacement
|
||||
echo " Expected = PLACE_BELOW_SELECTION"
|
||||
echo " Actual = " $CP
|
||||
XtSetValues $SB childPlacement:PLACE_TOP
|
||||
XtAddTimeOut ID 5000 "Timeout3"
|
||||
}
|
||||
|
||||
Timeout1()
|
||||
{
|
||||
XtGetValues $SB childPlacement:CP
|
||||
echo ChildPlacement
|
||||
echo " Expected = PLACE_ABOVE_SELECTION"
|
||||
echo " Actual = " $CP
|
||||
XtSetValues $SB childPlacement:PLACE_BELOW_SELECTION
|
||||
XtAddTimeOut ID 5000 "Timeout2"
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL selectionBoxTest SelectionBoxTest "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget SB sb XmSelectionBox $TOPLEVEL \
|
||||
childPlacement:PLACE_ABOVE_SELECTION
|
||||
|
||||
XtCreateManagedWidget SCALE scale XmScale $SB \
|
||||
orientation:HORIZONTAL
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtAddTimeOut ID 5000 "Timeout1"
|
||||
|
||||
XtMainLoop
|
||||
137
cde/programs/dtksh/examples/SessionTest.src
Executable file
137
cde/programs/dtksh/examples/SessionTest.src
Executable file
@@ -0,0 +1,137 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: SessionTest.src /main/6 1996/04/23 20:18:46 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates the steps necessary for tying into
|
||||
XCOMM session management. To run, simply run this script, and then save the
|
||||
XCOMM current session. When the session is restored, this script should again
|
||||
XCOMM restore to its previous state.
|
||||
XCOMM
|
||||
|
||||
|
||||
XCOMM This function is invoked when the user attempts to save the current session.
|
||||
XCOMM It will save off its state information (whether it is iconified, and the
|
||||
XCOMM list of workspaces it occupies) into a session file, and then tell the
|
||||
XCOMM session manager how to reinvoke it when the session is restored.
|
||||
SessionCallback()
|
||||
{
|
||||
XCOMM Get the name of our session file
|
||||
if DtSessionSavePath $TOPLEVEL PATH SAVEFILE; then
|
||||
exec 9>$PATH
|
||||
|
||||
XCOMM Save our iconification state
|
||||
if DtShellIsIconified $TOPLEVEL ; then
|
||||
print -u9 'Iconified'
|
||||
else
|
||||
print -u9 'Deiconified'
|
||||
fi
|
||||
|
||||
XCOMM Save the list of workspace we occupy
|
||||
if DtWsmGetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XtWindow "-" $TOPLEVEL) \
|
||||
CURRENT_WS_LIST ;
|
||||
then
|
||||
oldIFS=$IFS
|
||||
IFS=","
|
||||
for item in $CURRENT_WS_LIST;
|
||||
do
|
||||
XmGetAtomName NAME $(XtDisplay "-" $TOPLEVEL) $item
|
||||
print -u9 $NAME
|
||||
done
|
||||
IFS=$oldIFS
|
||||
fi
|
||||
|
||||
exec 9<&-
|
||||
|
||||
XCOMM Tell the session manager how to restart us
|
||||
DtSetStartupCommand $TOPLEVEL \
|
||||
"/usr/dt/share/examples/dtksh/SessionTest $SAVEFILE"
|
||||
else
|
||||
echo "DtSessionSavePath FAILED!!"
|
||||
exit -3
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
XCOMM This function is invoked when we are restarted at session restore time.
|
||||
XCOMM It is passed the name of the session file as $1. It will extract our
|
||||
XCOMM session information from the session file, and will restore our state
|
||||
XCOMM accordingly.
|
||||
RestoreSession()
|
||||
{
|
||||
XCOMM Get the full path of our session file
|
||||
if DtSessionRestorePath $TOPLEVEL PATH $1; then
|
||||
exec 9<$PATH
|
||||
read -u9 ICONIFY
|
||||
|
||||
XCOMM Restore our iconification state
|
||||
case $ICONIFY in
|
||||
Iconified) DtSetIconifyHint $TOPLEVEL True;;
|
||||
*) DtSetIconifyHint $TOPLEVEL False;;
|
||||
esac
|
||||
|
||||
XCOMM Place us into the indicated set of workspaces
|
||||
WS_LIST=""
|
||||
while read -u9 NAME
|
||||
do
|
||||
XmInternAtom ATOM $(XtDisplay "-" $TOPLEVEL) $NAME False
|
||||
if [ ${#WS_LIST} -gt 0 ]; then
|
||||
WS_LIST=$WS_LIST,$ATOM
|
||||
else
|
||||
WS_LIST=$ATOM
|
||||
fi
|
||||
done
|
||||
|
||||
DtWsmSetWorkspacesOccupied $(XtDisplay "-" $TOPLEVEL) \
|
||||
$(XtWindow "-" $TOPLEVEL) \
|
||||
$WS_LIST
|
||||
|
||||
exec 9<&-
|
||||
else
|
||||
echo "DtSessionRestorePath FAILED!!"
|
||||
exit -3
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL wmProtTest WmProtTest "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
|
||||
XtSetValues $DA height:200 width:200
|
||||
|
||||
XmInternAtom SAVE_SESSION_ATOM $(XtDisplay "-" $TOPLEVEL) "WM_SAVE_YOURSELF" False
|
||||
|
||||
|
||||
XCOMM If we are invoked with any command line parameters, then we will assume
|
||||
XCOMM that it is the name of our session file, and will restore to the indicated
|
||||
XCOMM state.
|
||||
if (( $# > 0))
|
||||
then
|
||||
XtSetValues $TOPLEVEL mappedWhenManaged:False
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
XSync $(XtDisplay "-" $TOPLEVEL) False
|
||||
RestoreSession $1
|
||||
XtSetValues $TOPLEVEL mappedWhenManaged:True
|
||||
XtPopup $TOPLEVEL GrabNone
|
||||
else
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
XSync $(XtDisplay "-" $TOPLEVEL) False
|
||||
fi
|
||||
|
||||
XCOMM Register our interest in participating in session management.
|
||||
XmAddWMProtocols $TOPLEVEL $SAVE_SESSION_ATOM
|
||||
XmAddWMProtocolCallback $TOPLEVEL $SAVE_SESSION_ATOM SessionCallback
|
||||
|
||||
XtMainLoop
|
||||
114
cde/programs/dtksh/examples/TextCutBuf1.src
Executable file
114
cde/programs/dtksh/examples/TextCutBuf1.src
Executable file
@@ -0,0 +1,114 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: TextCutBuf1.src /main/3 1996/04/23 20:18:52 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how the Text cut, copy and paste
|
||||
XCOMM facilities work.
|
||||
XCOMM
|
||||
|
||||
XCOMM Pushbutton Callback: cut the currently select text
|
||||
Cut()
|
||||
{
|
||||
if XmTextCut $TEXT $(XtLastTimestampProcessed "-" $(XtDisplay "-" $TEXT));
|
||||
then
|
||||
echo "Cut occurred"
|
||||
else
|
||||
echo "No primary selection"
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: copy the currently select text
|
||||
Copy()
|
||||
{
|
||||
if XmTextCopy $TEXT $(XtLastTimestampProcessed "-" $(XtDisplay "-" $TEXT));
|
||||
then
|
||||
echo "Copy occurred"
|
||||
else
|
||||
echo "No primary selection"
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: clear the text selection
|
||||
ClearSelection()
|
||||
{
|
||||
XmTextClearSelection $TEXT $(XtLastTimestampProcessed "-" $(XtDisplay "-" $TEXT))
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: paste the cut buffer at the current insertion position
|
||||
Paste()
|
||||
{
|
||||
if XmTextPaste $TEXT; then
|
||||
echo "Paste occurred"
|
||||
else
|
||||
echo "No primary selection"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL textCutBuf1 TextCutBuf1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL \
|
||||
|
||||
XtCreateManagedWidget TEXT text XmText $FORM \
|
||||
topAttachment:ATTACH_FORM \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:10 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
columns:40 \
|
||||
value:"This is the default string"
|
||||
|
||||
XtCreateManagedWidget TEXT2 text2 XmText $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$TEXT \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:10 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
bottomAttachment:ATTACH_FORM \
|
||||
bottomOffset:10 \
|
||||
columns:40 \
|
||||
editable:False
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 textCutBuf1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Cut Selection"
|
||||
XtAddCallback $PB1 activateCallback "Cut"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Copy Selection"
|
||||
XtAddCallback $PB2 activateCallback "Copy"
|
||||
|
||||
XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
|
||||
labelString:"Paste"
|
||||
XtAddCallback $PB3 activateCallback "Paste"
|
||||
|
||||
XtCreateManagedWidget PB4 pb4 XmPushButton $RC \
|
||||
labelString:"Clear Selection"
|
||||
XtAddCallback $PB4 activateCallback "ClearSelection"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
100
cde/programs/dtksh/examples/TextDisp1.src
Executable file
100
cde/programs/dtksh/examples/TextDisp1.src
Executable file
@@ -0,0 +1,100 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: TextDisp1.src /main/3 1996/04/23 20:18:56 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script exercises the commands which enable and disable
|
||||
XCOMM updating in a text widget. If the update is disabled, and the value of
|
||||
XCOMM the text field is then changed, the text field will not update what is
|
||||
XCOMM shown, until update is again enabled.
|
||||
XCOMM
|
||||
|
||||
XCOMM Pushbutton Callback: enable update in the text widget
|
||||
EnableUpdate()
|
||||
{
|
||||
XmTextEnableRedisplay $TEXT
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: disable update in the text widget
|
||||
DisableUpdate()
|
||||
{
|
||||
XmTextDisableRedisplay $TEXT
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: changes the text value
|
||||
ChangeValue1()
|
||||
{
|
||||
XmTextSetString $TEXT "line A
|
||||
line B
|
||||
line C
|
||||
line D
|
||||
line E
|
||||
line F
|
||||
line G"
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: changes the text value
|
||||
ChangeValue2()
|
||||
{
|
||||
XmTextSetString $TEXT "line a
|
||||
line b
|
||||
line c
|
||||
line d
|
||||
line e
|
||||
line f
|
||||
line g"
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL textDisp1 TextDisp1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XmCreateScrolledText TEXT $TOPLEVEL text \
|
||||
columns:20 \
|
||||
rows:5 \
|
||||
editMode:MULTI_LINE_EDIT \
|
||||
value:\
|
||||
"line 1
|
||||
line 2
|
||||
line 3
|
||||
line 4"
|
||||
XtManageChild $TEXT
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 textDisp1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Disable Update"
|
||||
XtAddCallback $PB1 activateCallback "DisableUpdate"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Enable Update"
|
||||
XtAddCallback $PB2 activateCallback "EnableUpdate"
|
||||
|
||||
XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
|
||||
labelString:"Change Value 1"
|
||||
XtAddCallback $PB3 activateCallback "ChangeValue1"
|
||||
|
||||
XtCreateManagedWidget PB4 pb4 XmPushButton $RC \
|
||||
labelString:"Change Value 2"
|
||||
XtAddCallback $PB4 activateCallback "ChangeValue2"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
65
cde/programs/dtksh/examples/TextFXYPos1.src
Executable file
65
cde/programs/dtksh/examples/TextFXYPos1.src
Executable file
@@ -0,0 +1,65 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: TextFXYPos1.src /main/3 1996/04/23 20:19:01 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script verifies that the XmTextFieldPosToXY command
|
||||
XCOMM functions correctly.
|
||||
XCOMM
|
||||
|
||||
XCOMM Pushbutton Callback: exercise the Text functions
|
||||
RunTests()
|
||||
{
|
||||
XCOMM This position should not be visible
|
||||
if XmTextFieldPosToXY $TEXT 90 X Y; then
|
||||
echo "Text position 90 is at point ("$X","$Y")"
|
||||
else
|
||||
echo "Text position 90 is not currently visible"
|
||||
fi
|
||||
|
||||
XCOMM This position should be visible
|
||||
if XmTextFieldPosToXY $TEXT 3 X Y; then
|
||||
echo "Text position 3 is at point ("$X","$Y")"
|
||||
else
|
||||
echo "Text position 3 is not currently visible"
|
||||
fi
|
||||
|
||||
XmTextFieldXYToPos POS $TEXT $X $Y
|
||||
echo "At point ("$X","$Y") is character position "$POS
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL textFXYPos1 TextFXYPos1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XmCreateTextField TEXT $TOPLEVEL text \
|
||||
columns:20 \
|
||||
value:"line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8"
|
||||
XtManageChild $TEXT
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 textFXYPos1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Run XY Position Tests"
|
||||
XtAddCallback $PB1 activateCallback "RunTests"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
80
cde/programs/dtksh/examples/TransEventTest.src
Executable file
80
cde/programs/dtksh/examples/TransEventTest.src
Executable file
@@ -0,0 +1,80 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: TransEventTest.src /main/3 1996/04/23 20:19:07 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script verifies that the augment and override
|
||||
XCOMM capabilities for translations work as expected. Since augmenting
|
||||
XCOMM a translation does not replace an existing translation, the first
|
||||
XCOMM pushbutton should only use our button3 translation. Since overriding
|
||||
XCOMM a translation replaces an existing translation, the second pushbutton
|
||||
XCOMM should use both our Enter and button1 translations.
|
||||
XCOMM
|
||||
XCOMM It also demonstrates access to the TRANSLATION_EVENT convenience
|
||||
XCOMM environment variable.
|
||||
XCOMM
|
||||
|
||||
XCOMM EnterNotify handler
|
||||
Enter()
|
||||
{
|
||||
echo EnterNotify
|
||||
echo "Event = "${TRANSLATION_EVENT}
|
||||
echo "Event.type = "${TRANSLATION_EVENT.TYPE}
|
||||
echo "Event.xany.window = "${TRANSLATION_EVENT.XANY.WINDOW}
|
||||
}
|
||||
|
||||
XCOMM ButtonDown handler; $1 indicates which button
|
||||
BtnDown()
|
||||
{
|
||||
echo "ButtonDown ("$1")"
|
||||
echo "Event = "${TRANSLATION_EVENT}
|
||||
echo "Event.type = "${TRANSLATION_EVENT.TYPE}
|
||||
echo "Event.xany.window = "${TRANSLATION_EVENT.XANY.WINDOW}
|
||||
echo "Event.xbutton.x = "${TRANSLATION_EVENT.XBUTTON.X}
|
||||
echo "Event.xbutton.y = "${TRANSLATION_EVENT.XBUTTON.Y}
|
||||
}
|
||||
|
||||
XCOMM Default activate callback for the pushbuttons; should only get called
|
||||
XCOMM for the first pushbutton (augmented one).
|
||||
Activate()
|
||||
{
|
||||
echo "Activate ("$1")"
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL transEventTest TransEventTest "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Augmented Button" \
|
||||
translations:'#augment
|
||||
<EnterNotify>:ksh_eval("Enter")
|
||||
<Btn1Down>:ksh_eval("BtnDown 1")
|
||||
<Btn3Down>:ksh_eval("BtnDown 3")'
|
||||
XtAddCallback $PB1 activateCallback "Activate 1"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Overridden Button" \
|
||||
translations:'#override
|
||||
<EnterNotify>:ksh_eval("Enter")
|
||||
<Btn1Down>:ksh_eval("BtnDown 1")'
|
||||
XtAddCallback $PB2 activateCallback "Activate 2"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtMainLoop
|
||||
91
cde/programs/dtksh/examples/TransTest1.src
Executable file
91
cde/programs/dtksh/examples/TransTest1.src
Executable file
@@ -0,0 +1,91 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: TransTest1.src /main/3 1996/04/23 20:19:11 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates the operation of augmented and
|
||||
XCOMM overridden translations. If the translations are cleared, then both
|
||||
XCOMM overriding and augmenting the translations will cause all of the new
|
||||
XCOMM translations to take effect.
|
||||
XCOMM
|
||||
|
||||
Enter()
|
||||
{
|
||||
echo "EnterNotify ("$1")"
|
||||
}
|
||||
|
||||
BtnDown()
|
||||
{
|
||||
echo "ButtonDown ("$1")"
|
||||
}
|
||||
|
||||
Activate()
|
||||
{
|
||||
echo "Activate"
|
||||
}
|
||||
|
||||
Augment()
|
||||
{
|
||||
XtAugmentTranslations $PB \
|
||||
'<EnterNotify>:ksh_eval("Enter augmented")
|
||||
<Btn1Down>:ksh_eval("BtnDown 1")
|
||||
<Btn3Down>:ksh_eval("BtnDown 3")'
|
||||
}
|
||||
|
||||
Override()
|
||||
{
|
||||
XtOverrideTranslations $PB \
|
||||
'<EnterNotify>:ksh_eval("Enter overridden")
|
||||
<Btn1Down>:ksh_eval("BtnDown 1")'
|
||||
}
|
||||
|
||||
Uninstall()
|
||||
{
|
||||
XtUninstallTranslations $PB
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL transTest1 TransTest1 "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XmCreateForm FORM $TOPLEVEL form
|
||||
XtManageChild $FORM
|
||||
|
||||
XtCreateManagedWidget PB pb XmPushButton $FORM \
|
||||
labelString:"Test Button"
|
||||
XtAddCallback $PB activateCallback "Activate"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 listAdd1a TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Augment Translations"
|
||||
XtAddCallback $PB1 activateCallback "Augment"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Override Translations"
|
||||
XtAddCallback $PB2 activateCallback "Override"
|
||||
|
||||
XtCreateManagedWidget PB3 pb3 XmPushButton $RC \
|
||||
labelString:"Uninstall Translations"
|
||||
XtAddCallback $PB3 activateCallback "Uninstall"
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
40
cde/programs/dtksh/examples/WorkProcTest1.src
Executable file
40
cde/programs/dtksh/examples/WorkProcTest1.src
Executable file
@@ -0,0 +1,40 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: WorkProcTest1.src /main/3 1996/04/23 20:19:16 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates the usage of an Xt workproc
|
||||
XCOMM
|
||||
|
||||
integer count=5
|
||||
|
||||
XCOMM The work proc will be called five time, at which point it will return
|
||||
XCOMM '1', which will cause it to be automatically unregistered.
|
||||
function WorkProc1
|
||||
{
|
||||
count=$count-1
|
||||
echo "WorkProc1 ("$count")"
|
||||
if [ "$count" -eq 0 ]
|
||||
then
|
||||
return 1
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL workProcTest1 WorkProcTest1 "$0" "$@"
|
||||
|
||||
XtAddWorkProc ID1 "WorkProc1"
|
||||
|
||||
XtMainLoop
|
||||
63
cde/programs/dtksh/examples/XCursorTest1.src
Executable file
63
cde/programs/dtksh/examples/XCursorTest1.src
Executable file
@@ -0,0 +1,63 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: XCursorTest1.src /main/3 1996/04/23 20:19:21 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates how the 'call' command can be used
|
||||
XCOMM to obtain an 'X' cursor, and then how that cursor can be set for a
|
||||
XCOMM widget hierarchy.
|
||||
XCOMM
|
||||
|
||||
XCOMM Pushbutton Callback: set the cursor for the widget hierarchy
|
||||
DefineCursor()
|
||||
{
|
||||
XDefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL) $CURSOR
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: unset the cursor for the widget hierarchy
|
||||
UndefineCursor()
|
||||
{
|
||||
XUndefineCursor $(XtDisplay "-" $TOPLEVEL) $(XtWindow "-" $TOPLEVEL)
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL xCursorTest XCursorTest "$0" "$@"
|
||||
XtSetValues $TOPLEVEL allowShellResize:True
|
||||
|
||||
XtCreateManagedWidget DA da XmDrawingArea $TOPLEVEL
|
||||
XtSetValues $DA height:200 width:200
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtCreateApplicationShell TOPLEVEL2 xCursorTesta TopLevelShell
|
||||
|
||||
XtCreateManagedWidget RC rc XmRowColumn $TOPLEVEL2 \
|
||||
orientation:HORIZONTAL \
|
||||
numColumns:2 \
|
||||
packing:PACK_COLUMN
|
||||
|
||||
XtCreateManagedWidget PB1 pb1 XmPushButton $RC \
|
||||
labelString:"Define Cursor"
|
||||
XtAddCallback $PB1 activateCallback "DefineCursor"
|
||||
|
||||
XtCreateManagedWidget PB2 pb2 XmPushButton $RC \
|
||||
labelString:"Undefine Cursor"
|
||||
XtAddCallback $PB2 activateCallback "UndefineCursor"
|
||||
|
||||
XCOMM Call the X function for getting a cursor
|
||||
call XCreateFontCursor $(XtDisplay "-" $TOPLEVEL) 10
|
||||
CURSOR=$RET
|
||||
echo "Cursor = "$CURSOR
|
||||
|
||||
XtRealizeWidget $TOPLEVEL2
|
||||
|
||||
XtMainLoop
|
||||
116
cde/programs/dtksh/examples/XdrawTest.src
Executable file
116
cde/programs/dtksh/examples/XdrawTest.src
Executable file
@@ -0,0 +1,116 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: XdrawTest.src /main/3 1996/04/23 20:19:28 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This sample shell script demonstrates the calling sequence for most of
|
||||
XCOMM the X drawing commands.
|
||||
XCOMM
|
||||
|
||||
ExposeCallback()
|
||||
{
|
||||
XDrawRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
10 20 100 200 \
|
||||
120 20 200 100
|
||||
|
||||
XFillRectangle $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-foreground red -background green 20 30 80 180
|
||||
|
||||
XClearArea $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
30 40 60 40 false
|
||||
|
||||
XDrawLine $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-foreground red -background white 130 22 130 117
|
||||
|
||||
XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
140 30 140 101 \
|
||||
150 101 150 30
|
||||
|
||||
XDrawLines $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-CoordModePrevious -line_width 3 160 30 0 71 \
|
||||
10 0 0 -71
|
||||
|
||||
XDrawPoint $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
180 30 180 101
|
||||
|
||||
XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
190 30 190 40 190 50 190 60 190 70 190 80 190 90 190 101
|
||||
|
||||
XDrawPoints $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-CoordModePrevious \
|
||||
200 30 0 10 0 10 0 10 0 10 0 10 0 10 0 10
|
||||
|
||||
XDrawSegments $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-function clear -foreground green -background red \
|
||||
-line_width 3 \
|
||||
210 30 210 40 210 50 210 60 210 70 210 80 210 90 210 100
|
||||
|
||||
XDrawArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-line_width 3 20 300 100 150 300 5760
|
||||
|
||||
XFillArc $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-line_width 3 20 270 100 150 11520 5760
|
||||
|
||||
XDrawString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-font fixed -foreground blue -background red 200 200 \
|
||||
"XDrawString"
|
||||
|
||||
XDrawImageString $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-foreground green -background red 200 250 \
|
||||
"XDrawImageString"
|
||||
|
||||
XFillPolygon $(XtDisplay "-" $CB_WIDGET) $(XtWindow "-" $CB_WIDGET) \
|
||||
-Convex -CoordModePrevious \
|
||||
300 300 30 70 30 -140
|
||||
|
||||
XTextWidth "-" fixed "Hi Mom"
|
||||
}
|
||||
|
||||
ClearWindow()
|
||||
{
|
||||
XClearWindow $(XtDisplay "-" $DRAWINGAREA) $(XtWindow "-" $DRAWINGAREA)
|
||||
}
|
||||
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL drawingArea DrawingArea "$0" "$@"
|
||||
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
|
||||
|
||||
XtCreateManagedWidget DRAWINGAREA drawingArea XmDrawingArea $FORM \
|
||||
topAttachment:ATTACH_FORM \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
rightAttachment:ATTACH_FORM
|
||||
XtAddCallback $DRAWINGAREA exposeCallback ExposeCallback
|
||||
|
||||
XtCreateManagedWidget SEP sep XmSeparator $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$DRAWINGAREA \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
rightAttachment:ATTACH_FORM
|
||||
|
||||
XtCreateManagedWidget PB pb XmPushButton $FORM \
|
||||
labelString:"Clear The Window" \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SEP \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
bottomAttachment:ATTACH_FORM
|
||||
XtAddCallback $PB activateCallback ClearWindow
|
||||
|
||||
XtSetValues $DRAWINGAREA \
|
||||
height:450 \
|
||||
width:450
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
|
||||
XtMainLoop
|
||||
327
cde/programs/dtksh/examples/crMovesText1.src
Normal file
327
cde/programs/dtksh/examples/crMovesText1.src
Normal file
@@ -0,0 +1,327 @@
|
||||
XCOMM! CDE_INSTALLATION_TOP/bin/dtksh
|
||||
XCOMM $XConsortium: crMovesText1.src /main/3 1996/04/23 20:19:33 drk $
|
||||
|
||||
XCOMM #########################################################################
|
||||
XCOMM (c) Copyright 1993, 1994 Hewlett-Packard Company
|
||||
XCOMM (c) Copyright 1993, 1994 International Business Machines Corp.
|
||||
XCOMM (c) Copyright 1993, 1994 Sun Microsystems, Inc.
|
||||
XCOMM (c) Copyright 1993, 1994 Unix System Labs, Inc., a subsidiary of
|
||||
XCOMM Novell, Inc.
|
||||
XCOMM #########################################################################
|
||||
|
||||
|
||||
XCOMM
|
||||
XCOMM This advanced shell script demonstrates the code necessary for forcing
|
||||
XCOMM the Return key to move the focus to the next text field in a dialog,
|
||||
XCOMM instead of causing the default pushbutton to be activated. When the
|
||||
XCOMM focus has moved to the last text field, then the Return key will activate
|
||||
XCOMM the default pushbutton.
|
||||
XCOMM
|
||||
|
||||
XCOMM This function modifies the text field indicated by $1, so that when
|
||||
XCOMM the text field receives the focus, it clears the default button; when
|
||||
XCOMM it loses the focus, it will reenable the default button. It also adds
|
||||
XCOMM some translations for catching the Return key, so that it can force
|
||||
XCOMM the focus to the next text widget, which is indicated by $2
|
||||
SetCrControls()
|
||||
{
|
||||
XtAddCallback $1 focusCallback "ClearDftButton"
|
||||
XtAddCallback $1 losingFocusCallback "SetDftButton $OK"
|
||||
|
||||
XtOverrideTranslations $1 \
|
||||
"Ctrl<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")
|
||||
<Key>Return:ksh_eval(\"XmProcessTraversal $2 TRAVERSE_CURRENT\")"
|
||||
}
|
||||
|
||||
XCOMM FocusOut Callback: reenables the default button
|
||||
SetDftButton()
|
||||
{
|
||||
XtSetValues $FORM defaultButton:$OK
|
||||
}
|
||||
|
||||
XCOMM FocusIn Callback: disables the default button
|
||||
ClearDftButton()
|
||||
{
|
||||
XtSetValues $FORM defaultButton:NULL
|
||||
}
|
||||
|
||||
XCOMM If the 'Ok' button is activated, but the 'Name' field is empty, then
|
||||
XCOMM this function will display an error dialog.
|
||||
EmptyNameError()
|
||||
{
|
||||
XmCreateErrorDialog ERROR_DIALOG $TOPLEVEL noName \
|
||||
okLabelString:Ok \
|
||||
messageString:"You must supply a name...."
|
||||
XmMessageBoxGetChild CANCEL_BTN $ERROR_DIALOG DIALOG_CANCEL_BUTTON
|
||||
XmMessageBoxGetChild HELP_BTN $ERROR_DIALOG DIALOG_HELP_BUTTON
|
||||
XtUnmanageChildren $CANCEL_BTN $HELP_BTN
|
||||
|
||||
XtSetValues $(XtParent "-" $ERROR_DIALOG) title:foo
|
||||
|
||||
XtManageChildren $ERROR_DIALOG
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: attached to the 'Cancel' pushbutton
|
||||
QuitCB()
|
||||
{
|
||||
exit 0
|
||||
}
|
||||
|
||||
XCOMM Pushbutton Callback: attached to the default pushbutton. It extracts the
|
||||
XCOMM fields within the dialog, and does some validation.
|
||||
CheckActionValues()
|
||||
{
|
||||
XtGetValues $LARGEICON value:LARGEICON_VALUE
|
||||
XtGetValues $SMALLICON value:SMALLICON_VALUE
|
||||
XtGetValues $DESCRIPTION value:DESCRIPTION_VALUE
|
||||
XtGetValues $COMMANDLINE value:COMMANDLINE_VALUE
|
||||
XtGetValues $PROMPT value:PROMPT_VALUE
|
||||
XtGetValues $COMMANDTYPE menuHistory:COMMANDTYPE_WIDGET
|
||||
|
||||
XmTextGetString NAME_VALUE $NAME
|
||||
|
||||
if [ "$NAME_VALUE" = "" ]
|
||||
then
|
||||
EmptyNameError
|
||||
else
|
||||
echo "Name: "$NAME_VALUE
|
||||
echo "Large Icon: "$LARGEICON_VALUE
|
||||
echo "Small Icon: "$SMALLICON_VALUE
|
||||
echo "Description: "$DESCRIPTION_VALUE
|
||||
echo "Command Line: "$COMMANDLINE_VALUE
|
||||
echo "Prompt: "$PROMPT_VALUE
|
||||
echo "Command Type: "$COMMANDTYPE_WIDGET
|
||||
fi
|
||||
}
|
||||
|
||||
XCOMM ###################### Create the Main UI ###############################
|
||||
|
||||
XtInitialize TOPLEVEL createAction CreateAction "$0" "$@"
|
||||
XtCreateManagedWidget FORM form XmForm $TOPLEVEL
|
||||
|
||||
XtCreateManagedWidget NAMELABEL nameLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_FORM \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
labelString:"Name:"
|
||||
|
||||
XtCreateManagedWidget NAME name XmText $FORM \
|
||||
topAttachment:ATTACH_OPPOSITE_WIDGET \
|
||||
topWidget:$NAMELABEL \
|
||||
topOffset:-7 \
|
||||
leftAttachment:ATTACH_WIDGET \
|
||||
leftWidget:$NAMELABEL \
|
||||
leftOffset:10 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
|
||||
XtCreateManagedWidget COMMANDLINELABEL commandLineLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$NAMELABEL \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
labelString:"Command Line:"
|
||||
|
||||
XtCreateManagedWidget COMMANDLINE commandLine XmText $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$COMMANDLINELABEL \
|
||||
topOffset:5 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:40 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
|
||||
XmCreatePulldownMenu PANE $FORM pane
|
||||
XtCreateManagedWidget XWIN xwin XmPushButton $PANE \
|
||||
labelString:"X Windows"
|
||||
XtCreateManagedWidget NOOUT noOut XmPushButton $PANE \
|
||||
labelString:"No Output"
|
||||
XtCreateManagedWidget TERM term XmPushButton $PANE \
|
||||
labelString:"Terminal"
|
||||
XtCreateManagedWidget TERMCLOSE termClose XmPushButton $PANE \
|
||||
labelString:"Terminal [auto-close]"
|
||||
|
||||
XmCreateOptionMenu COMMANDTYPE $FORM commandType \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$COMMANDLINE \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
labelString:"Window Type:" \
|
||||
menuHistory:$TERM \
|
||||
subMenuId:$PANE \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
XtSetValues $COMMANDTYPE spacing:35
|
||||
XtManageChildren $COMMANDTYPE
|
||||
|
||||
XtCreateManagedWidget OPTLABEL optLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$COMMANDTYPE \
|
||||
topOffset:30 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:100 \
|
||||
labelString:"Optional Fields"
|
||||
|
||||
XtCreateManagedWidget SEP1 sep1 XmSeparator $FORM \
|
||||
topAttachment:ATTACH_OPPOSITE_WIDGET \
|
||||
topWidget:$OPTLABEL \
|
||||
topOffset:10 \
|
||||
rightAttachment:ATTACH_WIDGET \
|
||||
rightWidget:$OPTLABEL \
|
||||
rightOffset:5 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
orientation:HORIZONTAL \
|
||||
separatorType:SHADOW_ETCHED_OUT
|
||||
|
||||
XtCreateManagedWidget SEP2 sep2 XmSeparator $FORM \
|
||||
topAttachment:ATTACH_OPPOSITE_WIDGET \
|
||||
topWidget:$OPTLABEL \
|
||||
topOffset:10 \
|
||||
leftAttachment:ATTACH_WIDGET \
|
||||
leftWidget:$OPTLABEL \
|
||||
leftOffset:5 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
orientation:HORIZONTAL \
|
||||
separatorType:SHADOW_ETCHED_OUT
|
||||
|
||||
XtCreateManagedWidget PROMPTLABEL promptLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$OPTLABEL \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
labelString:"Filename Prompt:"
|
||||
|
||||
XtCreateManagedWidget PROMPT prompt XmText $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PROMPTLABEL \
|
||||
topOffset:5 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:40 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
|
||||
XtCreateManagedWidget LARGEICONLABEL largeIconLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$PROMPT \
|
||||
topOffset:30 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
labelString:"Large Icon:"
|
||||
|
||||
XtCreateManagedWidget LARGEICON largeIcon XmText $FORM \
|
||||
topAttachment:ATTACH_OPPOSITE_WIDGET \
|
||||
topWidget:$LARGEICONLABEL \
|
||||
topOffset:-7 \
|
||||
leftAttachment:ATTACH_WIDGET \
|
||||
leftWidget:$LARGEICONLABEL \
|
||||
leftOffset:20 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
|
||||
XtCreateManagedWidget SMALLICONLABEL smallIconLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$LARGEICONLABEL \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
labelString:"Small Icon:"
|
||||
|
||||
XtCreateManagedWidget SMALLICON smallIcon XmText $FORM \
|
||||
topAttachment:ATTACH_OPPOSITE_WIDGET \
|
||||
topWidget:$SMALLICONLABEL \
|
||||
topOffset:-7 \
|
||||
leftAttachment:ATTACH_OPPOSITE_WIDGET \
|
||||
leftWidget:$LARGEICON \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
|
||||
XtCreateManagedWidget DESCRIPTIONLABEL descriptionLabel XmLabel $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SMALLICONLABEL \
|
||||
topOffset:20 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:20 \
|
||||
labelString:"Description:"
|
||||
|
||||
XmCreateScrolledText DESCRIPTION $FORM description \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$DESCRIPTIONLABEL \
|
||||
topOffset:5 \
|
||||
leftAttachment:ATTACH_FORM \
|
||||
leftOffset:40 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
rightOffset:10 \
|
||||
editMode:MULTI_LINE_EDIT \
|
||||
rows:4 \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP
|
||||
XtManageChildren $DESCRIPTION
|
||||
|
||||
XtCreateManagedWidget SEP sep XmSeparator $FORM \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$DESCRIPTION \
|
||||
topOffset:20 \
|
||||
rightAttachment:ATTACH_FORM \
|
||||
leftAttachment:ATTACH_FORM
|
||||
|
||||
XtCreateManagedWidget OK ok XmPushButton $FORM \
|
||||
labelString:Apply \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:10 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:30 \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SEP \
|
||||
topOffset:20 \
|
||||
bottomOffset:10 \
|
||||
bottomAttachment:ATTACH_FORM
|
||||
XtAddCallback $OK activateCallback CheckActionValues
|
||||
|
||||
XtCreateManagedWidget CLOSE close XmPushButton $FORM \
|
||||
labelString:Close \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:40 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:60 \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SEP \
|
||||
topOffset:20 \
|
||||
bottomOffset:10 \
|
||||
bottomAttachment:ATTACH_FORM
|
||||
XtAddCallback $CLOSE activateCallback QuitCB
|
||||
|
||||
XtCreateManagedWidget HELP help XmPushButton $FORM \
|
||||
labelString:Help \
|
||||
leftAttachment:ATTACH_POSITION \
|
||||
leftPosition:70 \
|
||||
rightAttachment:ATTACH_POSITION \
|
||||
rightPosition:90 \
|
||||
topAttachment:ATTACH_WIDGET \
|
||||
topWidget:$SEP \
|
||||
topOffset:20 \
|
||||
bottomOffset:10 \
|
||||
bottomAttachment:ATTACH_FORM
|
||||
|
||||
XtSetValues $FORM \
|
||||
defaultButton:$OK \
|
||||
cancelButton:$CLOSE \
|
||||
navigationType:EXCLUSIVE_TAB_GROUP \
|
||||
initialFocus:$NAME
|
||||
|
||||
XCOMM Set up proper behavior for the Return key
|
||||
SetCrControls $NAME $COMMANDLINE
|
||||
SetCrControls $COMMANDLINE $PROMPT
|
||||
SetCrControls $PROMPT $LARGEICON
|
||||
SetCrControls $LARGEICON $SMALLICON
|
||||
|
||||
XtRealizeWidget $TOPLEVEL
|
||||
XtMainLoop
|
||||
Reference in New Issue
Block a user