------------------------->  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>  <--------------

-- menubutton.sa: Tk menubuttons
-- Author: Matthias Ernst <tisi@beutlin.desy.de>

class TK_MENUBUTTON_CFG is
   include TK_WIDGET_CFG_INCL text -> text;
    -- there's more to come
end; -- class TK_MENUBUTTON_CFG
-------------------------------------------------------------------
class TK_MENUBUTTON < $TK_WIDGET is
    -- menubutton
   include TK_WIDGET_INCL{TK_MENUBUTTON_CFG};
    
   const tk_widget_type: STR := "menubutton";
    
   -- every menubutton has a menu created with itself
   -- this is for simplicity and to assure
   -- that the menu is the button's child
   readonly attr menu: TK_MENU;	
   
   private init(prnt:$TK_WIDGET,nm:STR,cf:TK_MENUBUTTON_CFG) is
      parent := prnt;
      name := nm;
      if ~void(parent) then path_name := parent.path_name+"."+nm;
      else path_name :=  "."+nm end;
      eval(tk_widget_type,path_name);
      menu := #TK_MENU(self, "menu", TK_MENU_CFG::std);      
      eval(path_name, "configure", "-menu", menu.path_name);
      default_init(cf);
   end;
   
   private default_init(c: TK_MENUBUTTON_CFG) is
      -- Do nothing
   end;
    
end; -- class TK_MENUBUTTON
-------------------------------------------------------------------




