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

%   Copyright 1984-2000 The MathWorks, Inc. 
%   $Revision: 1.16 $  $Date: 2000/08/01 22:10:12 $
%   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...
   setscribeobjectdata(figHGHandle,figUD);
   
else
   HGHandle = MLObj.HGHandle;
end

h.HGHandle = HGHandle;

ud = getscribeobjectdata(HGHandle);
ud.ObjectStore = MLObj;

h = class(h,'scribehandle');

ud.HandleStore = h;
setscribeobjectdata(HGHandle,ud)

