www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@PointerRepository/pGetPointer.m

    function S = pGetPointer(pr, fH)
%PGETPOINTER Get pointer data structure from figure.
%
%   S = PGETPOINTER(PR, HFIG) gets the pointer data fields that are saved
%   for each figure and returns them as a structure array.
%   S = PGETPOINTER(PR, PTR) gets the pointer data fields for the pointer
%   named PTR.

%   Copyright 2006-2007 The MathWorks, Inc.


if ischar(fH)
    ptrname = fH;
    if isfield(pr.Pointers, ptrname)
        ptrs = pr.Pointers;
        ptrdata = ptrs.(ptrname);
        S = struct( ...
            'Pointer','custom', ...
            'PointerShapeCData',ptrdata.pointer, ...
            'PointerShapeHotSpot',ptrdata.hotspot);
    else
        S = struct( ...
            'Pointer',ptrname, ...
            'PointerShapeHotSpot', [1 1]);
    end
else
    data = get(fH,{'Pointer','PointerShapeCData','PointerShapeHotSpot'});
    S = struct( ...
        'Pointer',data(:,1)', ...
        'PointerShapeCData',data(:,2)', ...
        'PointerShapeHotSpot',data(:,3)');
end