www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@cgbrowser/makeContextMenuBase.m
function hCont = makeContextMenuBase(h) %MAKECONTEXTMENUBASE Create the base items for a tree context menu % % hCont = MAKECONTEXTMENUBASE(CGB) creates a context menu with the basic % browser actions in it. This menu can then be used for adding additional % view-specific actions. % Copyright 2000-2010 The MathWorks, Inc. and Ford Global Technologies, Inc. hCont = uicontextmenu('Parent',h.Figure); hDuplicate = uimenu(hCont,'Label','D&uplicate',... 'Callback',{@i_dup,h},... 'Interruptible','off'); hDelete = uimenu(hCont,'Label','&Delete',... 'Callback',{@i_delete,h},... 'Interruptible','off'); hRename = uimenu(hCont,'Label','&Rename',... 'Callback',{@i_rename,h},... 'Interruptible','off'); s = h.ContextMenus; s.DuplicateMenus = [s.DuplicateMenus hDuplicate]; s.DeleteMenus = [s.DeleteMenus hDelete]; s.RenameMenus = [s.RenameMenus hRename]; h.ContextMenus = s; function i_rename(src,evt,h) if h.lock h.renamenode; h.unlock; end function i_delete(src,evt,h) if h.lock PR = xregGui.PointerRepository; ptrID = PR.stackSetPointer(h.Figure,'watch'); h.deletenode; PR.stackRemovePointer(h.Figure,ptrID); h.unlock; end function i_dup(src, evt, h) if h.lock PR = xregGui.PointerRepository; ptrID = PR.stackSetPointer(h.Figure,'watch'); h.duplicatenode; PR.stackRemovePointer(h.Figure,ptrID); h.unlock; end