#! ../mofe --f
mergeResources topLevel *background gray75
set FILESEARCHPATH /usr/lib/X11/twm/%N

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 reOrient mp1 \
	activateCallback "sV g reorient true"
      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 650

XmMainWindowSetAreas main menu_bar NULL NULL NULL g
sV menu_bar menuHelpWidget Help
realize

mergeResources topLevel \
    *XmLabel.width 48 \
    *XmLabel.height 48 \
    *XmGraph*XmLabel.labelType PIXMAP

proc pix {c} {
  global pixmaps
  return [lindex {ghostview.xpm xmosaic.xpm unknown1.xpm} [expr $c%3]]
}

# DBUG_PUSH d,pixmap
unmapWidget g
   set size 80
   set max 4
   set xoff [set yoff 300]
   set count 0
   for {set i 1} {$i<$max} {incr i} {
     set pos [expr $i*$size]
     set s [expr ($i-1)*$size/2]
     set N1 [XmLabel n[incr count] g  x [expr $xoff+$pos]  y [expr $yoff+$s]]
     changePixmap $N1 backgroundPixmap [pix $count]
     set N2 [XmLabel n[incr count] g  x [expr $xoff-$pos]  y [expr $yoff+$s]]
     changePixmap $N2 backgroundPixmap [pix $count]
     set N3 [XmLabel n[incr count] g  x [expr $xoff+$s]  y [expr $yoff+$pos]]
     changePixmap $N3 backgroundPixmap [pix $count]
     set N4 [XmLabel n[incr count] g  x [expr $xoff+$s]  y [expr $yoff-$pos]]
     changePixmap $N4 backgroundPixmap [pix $count]
     XmArc a1 g from $N1 to $N2
     XmArc a2 g from $N2 to $N3
     XmArc a3 g from $N3 to $N4
     XmArc a4 g from $N1 to $N4
   }
mapWidget g

XmMessageDialog versionbox mp2 unmanaged \
	dialogTitle "Motif Demo Program using XmGraph" \
	okLabelString "Close" \
	messageString "@(#)m-graphdemo Version 0.00001, Jan 15, 1993"

XmMessageDialog helpbox mp2 unmanaged \
	dialogTitle "m-er 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] 
