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

    function doDrawTree(h, p, action, si)
%DODRAWTREE Refresh the main treeview
%
%  DODRAWTREE(CGB) refreshes the tree by clearing it and re-adding all
%  items.
%  DODRAWTREE(CGB, p) refreshes the given node's icon and text.
%  DODRAWTREE(CGB, [], 'update') refreshes the icon and text of every node
%  on the tree.
%  DODRAWTREE(CGB, p, action, si) allows the specification of a subitem to
%  use per node in p. si must be a scalar or a vector the same length as p.

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


if h.GUIExists && h.TreeOn
    if nargin<2
        p = xregpointer;
        action = 'refresh';
    elseif nargin<3
        action = 'update';
    end

    hTree = h.Hand.Figure.Tree;
    switch action
        case 'update'
            if isempty(p)
                % Refresh all node labels/icons
                updateAll(hTree);
            else
                update(hTree,p);
            end
        case 'refresh'
            if isnull(p)
                p = [];
            end
            hTree.TypeFilter = h.CurrentType;
            refresh(hTree,h.RootNode,2,p)
        case 'add'
            add(hTree,p);
        case 'select'
            select(hTree,p);
    end
end