view graphics/set_ctxmenu.m @ 53:3ba80c9914ff

Minor doc fix, added .class to .hgignore
author samer
date Mon, 02 Feb 2015 10:47:55 +0000
parents 82075c94eed1
children
line wrap: on
line source
function h=set_ctxmenu(parent,commands,varargin)
	opts=prefs(varargin{:});
	h=uicontextmenu;

	foreach(@(cmd)add_to_menu(h,cmd),commands);
	set(parent,'UIContextMenu',h);
end

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