function aObj = axischild(HG)
%AXISCHILD/AXISCHILD Make axischild object
%   This file is an internal helper function for plot annotation.

%   Copyright 1984-2015 The MathWorks, Inc.

if nargin==0
   aObj.Class = 'axischild';
   aObj.DragConstraint = [];
   aObj.AutoDragConstraint = [];
   aObj.OldDragConstraint = [];
   aObj.Prefix = [];
   aObj.Suffix = [];
   aObj = class(aObj,'axischild',scribehgobj);
   return
end

hgObj = scribehgobj(HG);

%set(HG,'ButtonDownFcn','doclick(gcbo)')
setappdata(HG,'ScribeButtonDownFcn','doclick');


aObj.Class = 'axischild';
aObj.DragConstraint = 'nodrag';
aObj.AutoDragConstraint = 0;
aObj.OldDragConstraint = '';
aObj.Prefix = '';
aObj.Suffix = '';

fig = ancestor(HG,'Figure');
LAddContextMenu(HG,fig);

aObj = class(aObj,'axischild',hgObj);

myH = scribehandle(aObj);


function u = LAddContextMenu(HG,fig)

   u = findall(fig,'Tag','ScribeAxischildObjContextMenu');

   if ishghandle(u)
      setscribecontextmenu(HG, u); 
   else
      
      u = uicontextmenu(...
              'Parent',fig,...
              'Serializable','off', ...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjContextMenu');

      
      ucut = uimenu(...
              'Label',getString(message('MATLAB:uistring:axischild:Cut')),...
              'Callback', 'domymenu cut',...
              'Parent',u,...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjCutMenu');
      ucopy = uimenu(...
              'Label',getString(message('MATLAB:uistring:axischild:Copy')),...
              'Callback', 'domymenu copy',...
              'Parent',u,...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjCopyMenu');
      upaste = uimenu(...
              'Label',getString(message('MATLAB:uistring:axischild:Paste')),...
              'Callback', 'domymenu paste',...
              'Parent',u,...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjPasteMenu');
      uclear = uimenu(...
              'Label',getString(message('MATLAB:uistring:axischild:Clear')),...
              'Callback', 'domymenu clear',...
              'Parent',u,...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjClearMenu');
      
      
      u4 = uimenu(...
              'Label',getString(message('MATLAB:uistring:axischild:Properties')),...
              'Callback', 'domymenu more',...
              'Separator','on',...
              'Parent',u,...
              'HandleVisibility','off',...
              'Tag','ScribeAxischildObjMoreMenu');
   end

   setscribecontextmenu(HG, u); 

   
