www.gusucode.com > mbcview 工具箱matlab源码程序 > mbcview/@cgtools/@exprview/exprview.m

    function obj = exprview(varargin)
%EXPRVIEW Constructor for component which shows expression linkage
%
%  OBJ = EXPRVIEW(PROP, VALUE) creates a component that displays the
%  input tree for an expression.

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

if nargin && isa(varargin{1}, 'cgtools.exprview')
   obj = varargin{1};
   varargin(1) = [];
else
   obj = cgtools.exprview;
end

% Call parent class constructor
if ~isempty(varargin)
    obj.abstractcomponent(varargin{:});
else
    obj.abstractcomponent;
end

obj.hAxes = xregGui.scrollaxes( ...
   'Parent' , obj.Parent , ...
   'Visible', obj.Visible, ...
   'Position', obj.Position, ...
   'BackgroundColor' , [1 1 1] , ...
   'Xzeromode','left',...
   'Yzeromode','top',...
   'UIContextMenu', obj.MainContextMenu);

obj.hAxes.construct(@(ax) set(ax,'SortMethod','childorder'));

if ~isnull(obj.RootExpression)
    obj.pSetExpr;
end

obj.addPropertyListeners({ ...
    'BlockContextMenu', ...
    'MainContextMenu', ...
    'RootExpression', ...
    'ZoomFactor'}, ...
    {@i_redraw, {@i_setmaincontextmenu, obj.hAxes}, @i_redraw, @i_redraw});


function i_redraw(src, evt)
evt.AffectedObject.update;

function i_setmaincontextmenu(src, evt, hAxes)
hAxes.UIContextMenu = evt.NewValue;