www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@javaToolbar/redraw.m

    function redraw(obj)
%REDRAW Refresh the toolbar
%
%  REDRAW(OBJ) completely redraws the toolbar.

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


mbcsuperclassmethod(obj, 'xregGui.javaToolbar', 'redraw');
if obj.DrawingEnabled
    SC = obj.hColors;
    if length(obj.ButtonVisCache)
        imwidth = obj.ButtonEdges(end, 2);
    else
        imwidth = 4;
    end
    posRect = obj.hToolbarInterface.Position;
    imwidth = max(0, min(posRect(3) - 7, imwidth));
    imheight = max(0, min(posRect(4)-6, obj.ButtonHeight));
    imdata = pCreateCanvas(obj, imwidth, imheight, ...
        SC.CTRL_BACK, SC.CTRL_LT_HILITE, SC.CTRL_SHADOW);
    
    if obj.NButtonsToRender<length(obj.ButtonVisCache)
        pDrawEndMarker(obj, imdata);
    end
    obj.pDrawButtonImages(imdata, 1, obj.NButtonsToRender, false);
    obj.hJavaImage.Peer.setNewImage(obj.hColors.convertToIRGB(imdata));
    obj.pSetImagePosition(posRect);
end