www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@javaToolbar/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-2010 The MathWorks, Inc. and Ford Global Technologies, Inc.


if ishandle(obj.hToolbarInterface) ...
        && ~mbcgui.util.isBeingDestroyed(obj.hToolbarInterface.Parent)

    ind = find(obj.Children==but);
    
    wasVisible = obj.ButtonVisCache(ind);
    oldH = obj.ButtonHeight;

    if obj.MousePressed && but==obj.CurrentButton 
        % Cancel the mouse down 
        obj.pButtonUp(-1);
    end
    
    mbcsuperclassmethod(obj, 'xregGui.javaToolbar', 'notifyRemoval', but);

    if obj.DrawingEnabled && wasVisible
        if oldH~=obj.ButtonHeight
            obj.redraw;
        else
            % Need to redraw the existing buttons to the right of this one
            obj.pDrawToRight(ind);
        end
    end
end