view graphics/extend_ctxmenu.m @ 47:82075c94eed1

adding a bunch of stuff, including graphics and pitch toolboxes.
author samer
date Sat, 17 Jan 2015 15:20:35 +0000
parents
children
line wrap: on
line source
function h=extend_ctxmenu(parent,commands,varargin)
	opts=prefs(varargin{:});
	h=get(parent,'UIContextMenu');
	if isempty(h), 
		h=uicontextmenu; 
		set(parent,'UIContextMenu',h);
	end

	foreach(@(cmd)add_to_menu(h,cmd),commands);
end

function h=add_to_menu(menu,cmd)
	h=uimenu('Parent',menu,'Label',cmd{1},'Callback',cmd{2});
end