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


