www.gusucode.com > mbcguitools 工具箱 matlab 源码程序 > mbcguitools/@xregGui/@javaToolbar/notifyNewImage.m
function notifyNewImage(obj, but) %NOTIFYNEWIMAGE Notify toolbar that a button has a new image % % NOTIFYNEWIMAGE(OBJ, BUT) is called to notify OBJ that the image of the % button BUT has been altered without its size changing. % Copyright 2000-2005 The MathWorks, Inc. and Ford Global Technologies, Inc. nBtnsRendered = obj.NButtonsToRender; mbcsuperclassmethod(obj, 'xregGui.javaToolbar', 'notifyNewImage', but); ch = obj.hToolbarInterface.Children; ind = find(but==ch); if ~isempty(ind) if obj.ButtonVisCache(ind) ... && obj.DrawingEnabled ... && ind<=nBtnsRendered % Insert a new image section into the java object 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