/* When minimized, all the windows in OpenWindows
   will also be minimized. Restores all windows if its system
   menu choice Restore All (0xF220) is selected          */

Def WM_SYSCOMMAND(self,wp,lp | choice)
{
  WM_SYSCOMMAND(self:ancestor,wp,lp);
  /* The last four bits are used internally by */
  /* MS-Windows, so mask them to get           */
  /* the real value:                           */
  choice := wp bitAnd 0xFFF0;

  select
    /* the minimize box was clicked,
       so iconize all windows in OpenWindows */
    case choice = 0xF020
       do(OpenWindows,{using(win) show(win,2)})
    endCase

    /* Restore All is selected,
       so restore all windows in OpenWindows */
    case choice = 0xF220
       /* need to restore the Actor */
       /* Display explicitly here:  */
       show(mainWindow(TheApp),1);
       do(OpenWindows,{using(win) show(win,1)})
    endCase
  endSelect
}
