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

    function  pSetupIP(obj)
%PSETUPIP Private method to setup listeners
%
%  PSETUPIP(OBJ)

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


hAx = ancestor(obj.Parent, 'axes');
obj.IPListeners = { ...
    handle.listener(obj, findprop(obj, 'Parent'), 'PropertyPostSet', {@i_setprnt, obj.hPatch}); ...
    handle.listener(obj, findprop(obj, 'Visible'), 'PropertyPostSet', {@i_setptch, obj.hPatch}); ...
    handle.listener(obj, findprop(obj, 'HitTest'), 'PropertyPostSet', {@i_setptch, obj.hPatch}); ...
    handle.listener(obj, findprop(obj, 'FaceColor'), 'PropertyPostSet', {@i_setptch, obj.hPatch}); ...
    handle.listener(obj, findprop(obj, 'EdgeColor'), 'PropertyPostSet', {@i_setptch, obj.hPatch}); ...
    handle.listener(obj, findprop(obj, 'OpenIntervals'), 'PropertyPostSet', @i_setints); ...
    handle.listener(obj, findprop(obj, 'Orientation'), 'PropertyPostSet', @i_setints); ...
    handle.listener(obj, 'ObjectBeingDestroyed', {@i_delobj, obj.hPatch}); ...
    mbcgui.hgclassesutil.listener(obj.hPatch, 'ObjectBeingDestroyed', mbcutils.callback(@i_delself, obj)); ...
    mbcgui.hgclassesutil.proplistener(hAx, 'XLim', 'PostSet', mbcutils.callback(@i_setlims, obj)); ...
    mbcgui.hgclassesutil.proplistener(hAx, 'YLim', 'PostSet', mbcutils.callback(@i_setlims, obj)); ...
    handle.listener(obj, obj.findprop('DisplayName'), 'PropertyPostSet', {@i_setDN, obj.hPatch}); ...
    };


function i_delobj(src, evt, hPatch)
if ~mbcgui.util.isBeingDestroyed(hPatch)
    delete(hPatch);
end

function i_delself(src, evt, obj)
if ~mbcgui.util.isBeingDestroyed(obj)
    delete(obj);
end

function i_setprnt(src, evt, hPatch)
set(hPatch, 'Parent', evt.NewValue);

% Re-create axes limit listeners
obj.pSetupIP;

function i_setptch(src, evt, hPatch)
set(hPatch, src.Name, evt.NewValue);

function i_setints(src, evt)
pDoIntervals(evt.AffectedObject);

function i_setlims(src, evt, obj)
obj.pDoIntervals;

function i_setDN(src, evt, hPatch)
xregGui.setLegendData(hPatch, evt.NewValue);