www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@MBCToolbar/notifyNewSize.m
function notifyNewSize(obj, but) %NOTIFYNEWSIZE Notify toolbar that button size has altered % % NOTIFYNEWSIZE(OBJ, BUT) notifies the toolbar that the size of BUT has % been altered. % Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc. ch = obj.Children; ind = find(but==ch); if ~isempty(ind) if obj.ButtonVisCache(ind) % Need to recheck button heights obj.pUpdateHeight(but, 'altered'); oldW = obj.ButtonEdges(ind, 2) - obj.ButtonEdges(ind,1) + 1; butW = but.pGetWidth; if oldW~=butW if ind<length(ch) deltaW = butW - oldW; obj.ButtonEdges(ind+1:end, :) = obj.ButtonEdges(ind+1:end, :) + deltaW; end obj.ButtonEdges(ind, 2) = obj.ButtonEdges(ind, 1) + butW - 1; end if obj.DrawingEnabled % Update the number of buttons to render obj.NButtonsToRender = obj.pNumberOfButtonsToRender(obj.hToolbarInterface.Position); end end end