function axobj = axisobj(varargin)
%AXISOBJ/AXISOBJ

%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 1.19 $  $Date: 1998/07/01 03:01:21 $
%   B.A. Jones & J.H. Roh 4-25-97.


if nargin==0
   axobj.Class = 'axisobj';
   axobj.Notes = [];
   axobj.FigObj = [];
   axobj.ZoomScale = [];
   axobj = class(axobj,'axisobj',scribehgobj);
   return
end

if nargin==1
   if isa(varargin{1},'axisobj')
      axobj = varargin{1};
      set(axobj,varargin{2:end});
      return
   else
	  ax = varargin{1};
   end
else
   ax = varargin{1};
   if ishandle(ax) & strcmp(get(ax,'type'),'axes')
      set(ax,varargin{2:end});
   else
	  ax = axes;
	  set(ax,varargin{:});
   end
end

fig = get(ax,'Parent');
HGObj = scribehgobj(ax);
HGObj = set(HGObj,'Draggable',0);

LAddContextMenu(ax,fig);

axobj.Class = 'axisobj';
axobj.Notes = [];
axobj.FigObj = figobj(fig);
axobj.ZoomScale = 1;

axobj = class(axobj,'axisobj',HGObj);
scribehandle(axobj);


function u = LAddContextMenu(HG,fig)
u = findall(fig,'Tag','ScribeAxisObjContextMenu');

if ishandle(u)
   % set(HG,'UIContextMenu',u);
   setappdata(HG,'ScribeUIContextMenu',u);
else
   u = uicontextmenu(...
           'Parent',fig,...
           'HandleVisibility','off',...
           'Callback','domymenu update',...
           'Tag','ScribeAxisObjContextMenu');
   % set(HG,'UIContextMenu',u);
   setappdata(HG,'ScribeUIContextMenu',u);
   
   
   ucut = uimenu(...
           'Label','Cu&t',...
           'Callback', 'domymenu cut',...
           'Parent',u,...
           'HandleVisibility','off',...
           'Tag','ScribeAxisObjCutMenu');
   ucopy = uimenu(...
           'Label','&Copy',...
           'Callback', 'domymenu copy',...
           'Parent',u,...
           'HandleVisibility','off',...
           'Tag','ScribeAxisObjCopyMenu');
   upaste = uimenu(...
           'Label','&Paste',...
           'Callback', 'domymenu paste',...
           'Parent',u,...
           'HandleVisibility','off',...
           'Tag','ScribeAxisObjPasteMenu');
   uclear = uimenu(...
           'Label','Clea&r',...
           'Callback', 'domymenu clear',...
           'Parent',u,...
           'HandleVisibility','off',...
           'Tag','ScribeAxisObjClearMenu');
   
   u1 = uimenu(...
           'Label','Show Legend',...
           'Callback', 'domymenu showlegend',...
           'Separator','on',...
           'Parent',u,...
           'HandleVisibility','off',...
           'Tag','ScribeAxisObjShowLegendMenu');
   u2 = uimenu(...
           'Label','Lock Position',...
           'Callback', 'domymenu moveresize',...
           'Separator','on',...
           'Parent',u,...
           'HandleVisibility','off',...
           'Tag','ScribeAxisObjMoveResizeMenu');
   % u3 = uimenu(...
   %         'Label','New Axes',...
   %         'Callback', 'axes',...
   %         'Parent',u,...
   %         'HandleVisibility','off',...
   %         'Tag','ScribeAxisObjNewAxesMenu');

   u4 = uimenu(...
              'Label','Properties...',...
              'Callback', 'domymenu more',...
              'Separator','on',...
              'Parent',u,...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjMoreMenu');
end




