#! ../mofe --f
# This is a demo script for (mostly) shaped pixmaps in labels and icons. 
# The warning message for "Very Large" under "Not Resizable" is intended.
#
# Gustaf Neumann                        Mohegan Lake, July 3, 1994

if {[lsearch $PACKAGES XPM] == -1} {
  puts stderr "\n\
    This script can only be used, when mofe was compiled with XPM support\n\
    Your version of mofe is configured for the following packages:\n\
    \t $PACKAGES\n"
   quit
}

set title(f1) "Not Resizable:"
set title(f2) "Resizable:"

set label(alkier.xpm)  "Unshaped"
set label(mfull.xpm)   "Shaped"
set label(ws10.xpm)    "Larger"
set label(ws11.xpm)    "Very Large"
set label(Unspecified) "Unspecified"

sV topLevel allowShellResize true

mergeResources topLevel \
    *f1*XmLabel*recomputeSize false  \
    *f2*XmLabel*recomputeSize true   \
    *Unspecified.set          true   \
    *XmLabel*labelType        PIXMAP \
    *l*background             pink   \
    *background               #d0d0d0

proc setIcon {pix} { 
  changePixmap topLevel iconPixmap $pix 
}
proc togglePixmap {w pix state} {
  if $state { changePixmap $w labelPixmap $pix }
}

XmRowColumn b topLevel
foreach f {f1 f2} {
  set F [XmForm $f b]
  XmRowColumn p $F
  XmForm f2 $F.p
  XmLabel t $F*f2 labelString $title($f) labelType STRING
  XmLabel l $F*f2 width 110 height 110 \
      topAttachment ATTACH_WIDGET topWidget $F*t
  XmRadioBox r $F \
      leftAttachment ATTACH_WIDGET leftWidget $F.p
  foreach pix {alkier.xpm mfull.xpm ws10.xpm ws11.xpm Unspecified} {
    XmToggleButton $pix $F.r labelString $label($pix) \
	valueChangedCallback "togglePixmap $F*l $pix %s"
  }
  XmSeparator sep b
}
XmRowColumn B b orientation HORIZONTAL
XmPushButton quit B activateCallback quit
XmPushButton iconFull B activateCallback  {setIcon mfull.xpm}
XmPushButton iconEmpty B activateCallback {setIcon mempty.xpm}
setIcon mempty.xpm
realize
