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

    function [tb, btns]=xregtoolbar(fH, tps, varargin)
%XREGTOOLBAR  Create an xregGui.uitoolbar
%
%

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



if ~isa(fH,'xregGui.uitoolbar')
   fH=xregGui.uitoolbar(fH,'Visible','off');
end

nB=length(tps);
if nB
   matches={'uipushtool';'uitoggletool'};   
   fH.setRedraw(false);
   for n=1:nB
      idx= find( strncmp( tps{ n },matches,length(tps{ n }) ) );
      if idx==1
         btns(n)=xregGui.uipushtool(fH);
         
      else
         btns(n)=xregGui.uitoggletool(fH);
      end
   end
   if ~isempty(varargin)
      set(btns,varargin{:});
   end
   fH.setRedraw(true);
   fH.drawToolBar;
end
tb=fH;