function h = scribehandle(MLObj)
%HANDLE/HANDLE   Wrapper class for Scribe HG Objects

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.14 $  $Date: 1998/09/16 17:23:09 $
%   J.H. Roh & B.A. Jones 4-25-97.

if nargin==0
   h.HGHandle = [];
   h = class(h,'scribehandle');
   return
end

if isempty(MLObj)
   % create a 0x0 struct
   h = struct('HGHandle',{});
   h = class(h,'scribehandle');
   return
end

if isa(MLObj,'figobj')
   figHGHandle = MLObj.HGHandle;
   HGHandle = uimenu(...
           'Parent',figHGHandle,...
           'Tag','ScribeFigObjStorage',...
           'Visible','off',...
           'HandleVisibility','off');
   figUD = fighandle(HGHandle);
   % object to redirect deferencing...
   setappdata(figHGHandle,'ScribeObjectData',figUD);
   
else
   HGHandle = MLObj.HGHandle;
end

h.HGHandle = HGHandle;

ud = getappdata(HGHandle,'ScribeObjectData');
ud.ObjectStore = MLObj;

h = class(h,'scribehandle');

ud.HandleStore = h;
setappdata(HGHandle,'ScribeObjectData',ud)

