www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@MBCToolbar/notifyRemoval.m
function notifyRemoval(obj, but) %NOTIFYREMOVAL Notify toolbar of button removal % % NOTIFYREMOVAL(OBJ, BUT) notifies OBJ that the button BUT should be % removed from the toolbar. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. ind = find(obj.Children==but); if but==obj.CurrentButton obj.pSetCurrentButton(0); end nChild = length(obj.ButtonVisCache); wasVisible = obj.ButtonVisCache(ind); obj.ButtonVisCache(ind) = []; obj.ButtonSepCache(ind) = []; obj.Children(ind) = []; % Update the button edges cache if wasVisible && ind<nChild if ind==1 offset = obj.ButtonEdges(ind,2) - 5; else offset = obj.ButtonEdges(ind,2) - obj.ButtonEdges(ind-1,2); end obj.ButtonEdges(ind+1:end,:) = obj.ButtonEdges(ind+1:end,:) - offset; end obj.ButtonEdges(ind,:) = []; if wasVisible % Update the common button height obj.pUpdateHeight(but, 'removed'); end if obj.DrawingEnabled % Update the number of buttons to render obj.NButtonsToRender = obj.pNumberOfButtonsToRender(obj.hToolbarInterface.Position); end