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


