#! ../mofe --f

scriptNeeds XmGraph "This script needs the XmGraph Widget!"

mergeResources topLevel \
    *XmGraph*XmPushButton.activateCallback "describe %w" \
    *XmGraph*XmPushButton.labelType PIXMAP \
    *XmFrame*XmLabel.background white \
    *background gainsboro \
    *foreground black \
    *Apollo*x  220  *Apollo*y 220 \
    *Neptun*x   10  *Neptun*y 120 \
    *Uranus.x  420  *Uranus.y  70 \
    *Pluto.x   430  *Pluto.y  320 \
    *Saturn.x  220  *Saturn.y 420 \
    *Vega.x     30  *Vega.y   350 

set FILESEARCHPATH %N:/usr/lib/X11/twm/%N

proc ws {name server} {
  XmPushButton $name g
  changePixmap $name labelPixmap ws10.xpm 
  XmArc a$name g from $name to $server \
      labelString "100 MBit FDDI" \
      foreground black highlightColor black \
      armCallback "sV %W  mapLabel true " \
      disarmCallback "sV %W mapLabel false "
}

proc server {name} {
  XmPushButton $name g
  changePixmap $name labelPixmap ws11.xpm 
}

proc describe {w} {
  if [isWidget desc_$w] {
    destroyWidget descArc_$w
    destroyWidget desc_$w
  } else {
    XmFrame desc_$w g shadowThickness 2 \
	x [gV $w x] y [expr [gV $w y]+[gV $w height]+20] 
    set f [expr {$w == {Apollo} ? 2 : 1}]
    XmLabel descText_$w desc_$w labelString "\
The Name of this Machine is '$w'\n\
PowerSquared Architecture \n\
[expr 2*$f] GB Memory, [expr 1200*$f] SPECint\n\
[expr 4*$f] TB Harddisk (removable)" \
        fontList -adobe-times-medium-r-*-*-12-*-*-*-*-*-*-*
    XmArc descArc_$w g from desc_$w to $w \
	arcWidth 3 foreground gray60 arcDirection DIRECTED
  }

}

XmMainWindow main topLevel

  XmMenuBar menu_bar main
    XmPulldownMenu mp1 menu_bar unmanaged
      XmPushButton Edit     mp1 activateCallback "sV g editable true"
      XmPushButton NoEdit   mp1 activateCallback "sV g editable false"
      XmPushButton Quit     mp1 activateCallback quit
    XmCascadeButton Actions menu_bar subMenuId mp1

    XmPulldownMenu mp2 menu_bar unmanaged
      XmPushButton Help    mp2 activateCallback "manageChild helpbox"
      XmPushButton Version mp2 activateCallback "manageChild versionbox"
    XmCascadeButton Help menu_bar subMenuId mp2

   XmGraph g main \
	autoLayoutMode false reLayout false \
        width 650 height 600

   XmLabel title g \
       labelString "Configuration of the Wafe Department" \
       x 30 y 20 \
       fontList "-adobe-times-bold-i-*-*-34-*-*-*-*-*-*-*"
   XmLabel footnote g \
       labelString "Click on the various Objects in the Configuration!" \
       x 0 y 590 \
       fontList -adobe-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*

XmMainWindowSetAreas main menu_bar NULL NULL NULL g
sV menu_bar menuHelpWidget Help

realize
server Apollo
ws Neptun Apollo
ws Uranus Apollo
ws Pluto Apollo
ws Saturn Apollo
ws Vega Apollo 

regexp {[^/]*$} $argv0 progName
XmMessageDialog versionbox mp2 unmanaged \
	dialogTitle "Motif Demo Program using XmGraph" \
	okLabelString "Close" \
	messageString "$progName Version 0.00001, Jan 15, 1994"

XmMessageDialog helpbox mp2 unmanaged \
	dialogTitle "$progName Help" \
	okLabelString "Close" \
	messageString "This program is a simple demo program for XmGraph."


unmanageChild \
	[XmMessageBoxGetChild versionbox DIALOG_CANCEL_BUTTON] \
	[XmMessageBoxGetChild versionbox DIALOG_HELP_BUTTON] 
unmanageChild \
	[XmMessageBoxGetChild helpbox DIALOG_CANCEL_BUTTON] \
	[XmMessageBoxGetChild helpbox DIALOG_HELP_BUTTON] 
