------------------------->  GNU Sather - sourcefile  <-------------------------
-- Copyright (C) 1995 by International Computer Science Institute            --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute  and/or modify it under the terms of the GNU Library General --
-- Public  License (LGPL)  as published  by the  Free  Software  Foundation; --
-- either version 2 of the license, or (at your option) any later version.   --
-- This  library  is distributed  in the  hope that it will  be  useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details.       --
-- The license text is also available from:  Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA                     --
-------------->  Please email comments to <bug-sather@gnu.org>  <--------------

-- Demo of the menu widget
-- Author: Matthias Ernst <tisi@beutlin.desy.de>

class DEMO_MENU is
   include GUI_UTIL;
    
   file_new is
      #OUT + "File::new\n";
   end;
    
   file_open is
      #OUT + "FILE::open\n";
   end;
    
   language(l: STR) is
      #OUT + "FILE::language::"+l+"\n";
   end;
    
   do_quit is
      quit_routine.call;	-- provided by GUI_UTIL
   end;
    
   init is
      startup_gui;
	
      file ::= #TK_MENUBUTTON(root_window, "File",
			      TK_MENUBUTTON_CFG::std.text("File"),
			      TK_PACK::left);
      file.menu.
	    command("New",      bind(file_new)).
	    command("Open ...", bind(file_open)).
	    separator;
	
      submenu ::=
	    file.menu.
	    cascade("Language")
	    .command("English", bind(language("English")))
	    .command("German", bind(language("German")));

      submenu.disable(submenu.index_end); -- only english supported by now
      
      file.menu.
	    separator.
	    command("Quit", bind(do_quit));
   end;
end; 
-------------------------------------------------------------------

