www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@javaToolbar/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-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. ch = obj.hToolbarInterface.Children; ind = find(but==ch); nBtnsRendered = obj.NButtonsToRender; oldH = obj.ButtonHeight; oldW = obj.ButtonEdges(ind, 2) - obj.ButtonEdges(ind,1) + 1; mbcsuperclassmethod(obj, 'xregGui.javaToolbar', 'notifyNewSize', but); if ~isempty(ind) ... && obj.DrawingEnabled if oldH~=obj.ButtonHeight obj.redraw; elseif oldW~=but.pGetWidth && ind<=nBtnsRendered obj.pDrawToRight(ind); elseif ind<=nBtnsRendered SC = obj.hColors; w = obj.ButtonEdges(ind, 2)-obj.ButtonEdges(ind,1)+1; imdata = obj.pNewCanvas(w, obj.pGetImageHeight, SC.CTRL_BACK); but.pDrawButton(imdata, 1, 1, w, obj.pGetImageHeight, ... (ind==obj.CurrentButtonIndex), false); obj.hJavaImage.Peer.setImageSection(obj.ButtonEdges(ind,1), ... obj.hColors.convertToIRGB(imdata)); end end