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

    function obj = abstractlayoutcomponent(varargin)
%ABSTRACTLAYOUTCOMPONENT Constructor for the abstractDataView object
%
%  OBJ = ABSTRACTLAYOUTCOMPONENT
%  OBJ = ABSTRACTLAYOUTCOMPONENT(OBJ)
%  OBJ = ABSTRACTLAYOUTCOMPONENT('Property', Value) 

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


% Is the first input argument a udd object derived from me? If it is then
% we are being called as a super class constructor and don't have to
% construct an object
if nargin && isa(varargin{1}, 'mbcwidgets.abstractlayoutcomponent')
   obj = varargin{1};
   varargin(1) = [];
else
    obj = mbcwidgets.abstractlayoutcomponent;
end

% Call the inherited constructor
abstractcomponent(obj, varargin{:});

% Check for Display being already set
if isscalar(obj.Display) && ~isgraphics(obj.Display) ...
        && (isa(obj.Display, 'xregcontainer') || ishandle(obj.Display))
    connect(obj.Display, obj, 'up');
end  

% Add a listener to the display property being changed
obj.addPropertyListeners('Display', @i_setdisplay);


function i_setdisplay(src, evt)
if isscalar(evt.NewValue) && ~isgraphics(evt.NewValue) ...
        && (isa(evt.NewValue, 'xregcontainer') || ishandle(evt.NewValue))
    connect(evt.NewValue, evt.AffectedObject, 'up');
end