www.gusucode.com > mbctools 工具箱 matlab 源码程序 > mbctools/@xregtools/@MBrowser/makeContextMenuBase.m

    function hCont=makeContextMenuBase(h)
%MAKECONTEXTMENUBASE  Create the base items for a tree context menu
%
%  hCont=h.makeContextMenuBase
%

%  Copyright 2000-2011 The MathWorks, Inc. and Ford Global Technologies, Inc.


hCont=uicontextmenu('Parent',h.Figure);
hNew=uimenu(hCont,'Label','&New',...
   'Callback',{@i_new,h},...
   'Interruptible','off');
hDelete=uimenu(hCont,'Label','&Delete',...
   'Callback',{@i_delete,h},...
   'Interruptible','off');
uimenu(hCont,'Label','&Rename',...
   'Callback',{@i_rename,h.Hand.Figure.TreeView},...
   'Interruptible','off');

s=h.ContextMenus;

s.NewMenus(end+1) = hNew;
s.DeleteMenus(end+1) = hDelete;
h.ContextMenus=s;




function i_new(~,~,h)
PR=xregGui.PointerRepository;
ptrID=PR.stackSetPointer(h.Figure,'watch');
h.NewNode;
PR.stackRemovePointer(h.Figure,ptrID);


function i_rename(~,~,Htree)
Htree.startEdit;


function i_delete(~,~,h)
PR=xregGui.PointerRepository;

ptrID=PR.stackSetPointer(h.Figure,'watch');
h.DeleteNode;
PR.stackRemovePointer(h.Figure,ptrID);