www.gusucode.com > mbclayouts 工具箱 matlab 源码程序 > mbclayouts/@xregsnapsplitlayout/copyobj.m

    function newobj=copyobj(obj,fig)
%COPYOBJ Create a copy of an object in a new figure
%
%  NEWOBJ=COPYOBJ(OBJ,FIG) creates a replica of the object OBJ in the
%  figure FIG.

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


newobj = obj;

% copy graphics objects
newobj.xregcontainer = copyobj(obj.xregcontainer,fig);

DragBarPeer = com.mathworks.toolbox.mbc.gui.peer.SnapSplitBarPeer;
newobj.DragBar = mbcwidgets.javacomponent(DragBarPeer, ...
    'Parent', fig, ...
    'Visible', obj.DragBar.Visible, ...
    'Enable', obj.DragBar.Enable, ...
    'Position', obj.DragBar.Position);
connectdata(newobj.xregcontainer, newobj.DragBar);
newobj.Listeners = dragcallback(newobj);

set(newobj, ...
    'orientation', get(obj, 'orientation'), ...
    'style', get(obj, 'Style'), ...
    'state', get(obj, 'State'));