function fObj = figobj(varargin)
%FIGOBJ/FIGOBJ

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.15 $  $Date: 2000/06/15 22:42:50 $
%   B.A. Jones & J.H. Roh 4-25-97.

switch nargin
case 0
   fObj.Class = 'figobj';
   fObj.SavedState = [];
   fObj.Notes = [];
   fObj.Date = [];
   fObj.DragObjects = [];
   fObj.aChild = [];
   fObj.Origin = [];
   fObj.SavedPosition = [];
   fObj = class(fObj,'figobj',scribehgobj);
   return
case 1
   HG = varargin{1};
   set(HG,...
           'ResizeFcn','doresize(gcbf)',...
           'KeyPressFcn','dokeypress(gcbf)');
otherwise
   HG = figure(varargin{:},...
           'ResizeFcn','doresize(gcbf)',...
           'KeyPressFcn','dokeypress(gcbf)');
end

hgObj = scribehgobj(HG);

t = clock;
fObj.Class = 'figobj';
fObj.SavedState = [];
fObj.Notes = [];
fObj.Date = [int2str(t(2)) '/' int2str(t(3)) '/' int2str(t(1))];
u = uimenu(...
        'Parent',HG,...
        'Visible','off',...
        'HandleVisibility','off',...
        'Tag','ScribeHGBinObject');
fObj.DragObjects = scribehandle(hgbin(u));
fObj.aChild = u;

% Default origin is LL for lower left. Use subsasgn to change to UL.
fObj.Origin = 'LL';
savedunits = get(HG,'Units');
if ~strcmp(lower(savedunits),'pixels')
   set(HG,'Units','pixels')
   fObj.SavedPosition = get(HG,'Position');
   set(HG,'Units',savedunits);
else
   fObj.SavedPosition = get(HG,'Position');
end


fObj = class(fObj,'figobj',hgObj);
