www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@mbcwidgets/@Table1D/pGetContextMenu.m

    function hContext = pGetContextMenu(obj, ContextProperty)
%PGETCONTEXTMENU Return the context menu handle for the object.
%
%   HCONTEXT = PGETCONTEXTMENU(OBJ) returns a context menu to show for the
%   table.  The table objects will substitute a copy/paste menu if no
%   other has been provided by the user.  To change this behaviour, set the
%   value of the 'ProvideContextMenu' property on the table.

%   Copyright 2007-2014 The MathWorks, Inc.


hContext = get(obj, ContextProperty);
if obj.ProvideContextMenu ...
        && isempty(hContext) ...
        && isempty(obj.UIContextMenu)
    hContext = obj.DefaultContextMenu;
    if isempty(hContext)
        hContext = uicontextmenu('Parent', ancestor(obj.Parent, 'figure'));
        obj.createCopyPasteMenus(hContext);
        obj.DefaultContextMenu = hContext;
    end
end