annotate 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 |
|
rev |
line source |
samer@47
|
1 function h=extend_ctxmenu(parent,commands,varargin)
|
samer@47
|
2 opts=prefs(varargin{:});
|
samer@47
|
3 h=get(parent,'UIContextMenu');
|
samer@47
|
4 if isempty(h),
|
samer@47
|
5 h=uicontextmenu;
|
samer@47
|
6 set(parent,'UIContextMenu',h);
|
samer@47
|
7 end
|
samer@47
|
8
|
samer@47
|
9 foreach(@(cmd)add_to_menu(h,cmd),commands);
|
samer@47
|
10 end
|
samer@47
|
11
|
samer@47
|
12 function h=add_to_menu(menu,cmd)
|
samer@47
|
13 h=uimenu('Parent',menu,'Label',cmd{1},'Callback',cmd{2});
|
samer@47
|
14 end
|
samer@47
|
15
|
samer@47
|
16
|