view graphics/extend_ctxmenu.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 82075c94eed1
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