#!/usr/bin/X11/mofe --f
mergeResources topLevel *background gray75
set light gray90 

proc entity {name args} {
   eval mPushButton $name g fontList \
	-adobe-helvetica-bold-r-normal--18-180-75-75-p-103-iso8859-1 $args
}

proc attribute {name type args} {global light;
   eval mToggleButton $type$name g labelString $name background $light $args 
   mArc a$type$name g from $type$name to $type
}

proc relation {name args} {
   eval mLabel $name g $args width 65 height 31;
   changePixmap $name backgroundPixmap relation.xpm
}

mMainWindow main topLevel

  mMenuBar menu_bar main 
    mPulldownMenu mp1 menu_bar unmanaged
      mPushButton Edit mp1 \
	activateCallback "sV g editable true"
      mPushButton NoEdit mp1 \
	activateCallback "sV g editable false"
      mPushButton reOrient mp1 \
	activateCallback "sV g reorient true"
      mPushButton Quit mp1 \
	activateCallback quit
    mCascadeButton Actions menu_bar \
	subMenuId mp1

    mPulldownMenu mp2 menu_bar unmanaged
      mPushButton Help mp2 \
	activateCallback "manageChild helpbox"
      mPushButton Version mp2 \
	activateCallback "manageChild versionbox"
    mCascadeButton Help menu_bar \
	subMenuId mp2
    sV menu_bar menuHelpWidget Help


    mGraph g main  \
	autoLayoutMode false reLayout false background $light \
	width 370 height 135
    entity Person   x 40 y 70
    entity Project  x 260 y 70


mMainWindowSetAreas main menu_bar NULL NULL NULL g
realize

    relation works  x 160 y 70
    attribute Date works x 165 y 20

    attribute Ssn Person x 20 y 20
    attribute Name Person x 70 y 20

    attribute Pnr Project x 245 y 20
    attribute Name Project x 295 y 20

    mArc worker g from works to Person labelString n mapLabel true
    mArc theWork g from works to Project labelString 1 mapLabel true

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

mMessageDialog helpbox Help unmanaged \
	dialogTitle "m-er Help" \
	okLabelString "Close" \
	messageString "\
This program is a simple demo program showing an er diagram. \n\
It is implemented using the XmGraph widget and using a xpm pixmap \n\
with a clip mask for relationship types. The layout can be rearranged \n\
by using the items from the Actions menu"


unmanageChild \
	versionbox.[mMessageBoxGetChild versionbox DIALOG_CANCEL_BUTTON] \
	versionbox.[mMessageBoxGetChild versionbox DIALOG_HELP_BUTTON] \
	helpbox.[mMessageBoxGetChild helpbox DIALOG_CANCEL_BUTTON] \
	helpbox.[mMessageBoxGetChild helpbox DIALOG_HELP_BUTTON] 
