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

    function doDrawList(h,action,nds,si)
%DODRAWLIST Refresh the main listview
%
%  DODRAWLIST(CGB) refreshes the entire list by clearing it and re-adding
%  all items to it.
%  DODRAWLIST(CGB, 'update') updates the current node information.
%  DODRAWLIST(CGB, 'update',nds, si) updates the information for nodes nds
%  (nds is a node pointer vector).
%  DODRAWLIST(CGB, 'updateall') updates the node information for all
%  currently displayed nodes.

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


if h.GUIExists && h.ListOn
    if nargin<2
        action = 'refresh';
    end
    if nargin<3
        nds = h.CurrentNode;
        si = h.CurrentSubItem;
    elseif nargin<4
        % just specified a node list - assume no valid subitems for each node
        si = null(xregpointer,size(nds));
    end
    
    hList = h.Hand.Figure.List;
    switch lower(action)
        case 'refresh'
            p = h.RootNode;
            buildlist(hList,p,h.CurrentType);
            if nargin==4
                select(hList,nds, si);
            end
        case 'update'
            if length(nds)==length(si)
                % pairs of node-subitems
                for i = 1:length(nds)
                    update(hList,nds(i),si(i));
                end
            elseif length(nds)==1
                % single node, multiple subitems
                for i = 1:length(si)
                    update(hList,nds,si(i));
                end
            end
        case 'updateall'
            refresh(hList);
        case 'select'
            select(hList,nds, si);
        case 'uicontextmenu'
            if ~isnull(nds)
                set(hList,'UIContextMenu',nds.getContextMenu(h));
            end

    end
end