function uistate = uisuspend(fig)
%UISUSPEND suspends all interactive properties of the figure.
%
%   UISTATE=UISUSPEND(FIG) suspends the interactive properties of a 
%   figure window and returns the previous state in the structure
%   UISTATE.  This structure contains information about the figure's
%   WindowButton* functions and the pointer.  It also contains the 
%   ButtonDownFcn's for all children of the figure.
%
%   See also UIRESTORE.

%   Chris Griffin, 6-19-97
%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.6 $ $Date: 1998/09/30 21:07:11 $

% disable plot editing and annotation buttons


uistate = struct(...
        'ploteditEnable', plotedit(fig,'getenabletools'), ...        
        'figureHandle', fig, ...
        'children', findobj(fig), ...
        'WindowButtonMotionFcn', get(fig, 'WindowButtonMotionFcn'), ...
        'WindowButtonDownFcn', get(fig, 'WindowButtonDownFcn'), ...
        'WindowButtonUpFcn', get(fig, 'WindowButtonUpFcn'), ...
        'KeyPressFcn', get(fig, 'KeyPressFcn'), ...
        'Pointer', get(fig, 'Pointer'), ...
        'PointerCdata', get(fig, 'PointerShapeCData'), ...
        'PointerHotSpot', get(fig, 'PointerShapeHotSpot'));

plotedit(fig,'setenabletools','off');
set(fig, 'pointer', get(0, 'DefaultFigurePointer'),...
   'WindowButtonMotionFcn', get(0, 'DefaultFigureWindowButtonMotionFcn'),...
   'WindowButtonDownFcn', get(0, 'DefaultFigureWindowButtonDownFcn'),...
   'WindowButtonUpFcn', get(0, 'DefaultFigureWindowButtonUpFcn'));

uistate.ButtonDownFcns = get(uistate.children, {'buttondownfcn'});
uistate.Interruptible = get(uistate.children, {'Interruptible'});
uistate.BusyAction = get(uistate.children, {'BusyAction'});
set(uistate.children, 'buttondownfcn', '', 'BusyAction', 'Queue', ...
   'Interruptible', 'on');
