annotate graphics/set_ctxmenu.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 82075c94eed1
children
rev   line source
samer@47 1 function h=set_ctxmenu(parent,commands,varargin)
samer@47 2 opts=prefs(varargin{:});
samer@47 3 h=uicontextmenu;
samer@47 4
samer@47 5 foreach(@(cmd)add_to_menu(h,cmd),commands);
samer@47 6 set(parent,'UIContextMenu',h);
samer@47 7 end
samer@47 8
samer@47 9 function h=add_to_menu(menu,cmd)
samer@47 10 h=uimenu('Parent',menu,'Label',cmd{1},'Callback',cmd{2});
samer@47 11 end
samer@47 12
samer@47 13