;+
; NAME:
;       HW_AUX__DEFINE
;
; PURPOSE:
;       Defines the class HW_AUX. This is the superclass for auxiliary
;       objects used by the Hansteen/Wikstøl data analysis SW. It
;       contains nothing except defines the general structure for auxiliary
;       objects. The HW_AUX class is inherited by auxiliary classes for a
;       specific data source. The purpose of the auxiliary objects are
;       to provide information to the display/analysis SW
;       (xdisplay.pro) about the contents of the companyng data class,
;       in order to provide correct titles on axes, widget menus etc.
;       
;
; CATEGORY:
;       Hansteen/Wikstol Data analysis SW
;
; CALLING SEQUENCE:
;       
;
; INPUTS:
;       None
;
; KEYWORD PARAMETERS:
;
;
; OUTPUTS:
;       Objects of class HW_AUX includes the following parameters:
;
;       maintitle:           Title describing the data source (e.g. 'EIS
;                        Quicklook: Spectral data')   
;       variablename:    Contents of data (e.g. 'Intensity')
;       xytitle:          Name on x-axis (e.g. '!4k!3 (pixels)')  
;       menu:            Structure with the following fields
;            action:     Name of window actions in the display window
;                        (used for naming widget buttons in xdisplay.pro)
;                        (e.g. ['Zoom','Average along slit','Average
;                        along wavelength'])
;            naction:    Number of actions (e.g. 3 in this example)
;            mode:       Name of the diiferent modes the data may be
;                        displayed in (e.g. ['Detector
;                        image','Raster','Imap']). Again this is used
;                        for naming widget menus in xdisplay.pro.
;            nmode:      Number of display modes (e.g. 3 in this example
;
; CALLS:
;       
;
; COMMON BLOCKS:
;       
;
; PROCEDURE:
;       Defines the structure of auxiliary class objects.
;
; RESTRICTIONS:
;
;
; MODIFICATION HISTORY:
;       XX-Aug-2001: Viggo Hansteen
;       20-Sep-2001: Oivind Wikstol. Added documentation.
;       11-Sep-2002: Oivind Wikstol. Modified structure.
;       10-Feb-2007: Viggo Hansteen - Added help methods.
;        4-Jul-2008: A. Gardini     - Added HELP and INIT_HW_AUX_METHODS.
;    
; $Id: hw_aux__define.pro 405 2010-07-04 11:21:38Z viggoh $
;
;-
function hw_aux::init
  self->init_hw_aux_methods ; initialization of the help method
  self.help=obj_new('hw_help')
  return,1
end

function hw_aux::gettitle,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.title
end

pro hw_aux::display_all,init=init
  if n_elements(init) eq 1 then return
  self.help->display_all
  return
end

pro hw_aux::display_methods,init=init
  if n_elements(init) eq 1 then return
  self.help->display_methods
  return
end

pro hw_aux::setxtitle,xtitle,init=init
  if n_elements(init) eq 1 then return
  self.xtitle=xtitle
end

function hw_aux::getxtitle,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.xtitle
end

pro hw_aux::setxrastertitle,xrastertitle,init=init
  if n_elements(init) eq 1 then return
  self.xrastertitle=xrastertitle
end

function hw_aux::getxrastertitle,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.xrastertitle
end

pro hw_aux::setytitle,ytitle,init=init
  if n_elements(init) eq 1 then return
  self.ytitle=ytitle
end

function hw_aux::getytitle,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.ytitle
end

function hw_aux::getvariablename,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.variablename
end

function hw_aux::getxytitle,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.xytitle
end

function hw_aux::getmenu,init=init
  if n_elements(init) eq 1 then return,-1
  return,self.menu
end

function hw_aux::getdispmode,init=init
  if n_elements(init) eq 1 then return,-1
  return, self.dispmode
end

pro hw_aux::setdispmode,mode,init=init
  if n_elements(init) eq 1 then return
  self.dispmode=mode
end

pro hw_aux::loadct,ct
cct=ct
if datatype(cct) eq 'STR' then begin
  case cct of
  'int': cct=0
  'vel': cct=99
  'wid': cct=13
  else: begin
    message,'no such ct '+cct+' defined, set to 0',/info
    cct=0
        end
  endcase
endif
case cct of 
99: begin
  ctfile=getenv('SSW')+'/hinode/eis/idl/ancillary/bluegreyred.sav'
  restore,ctfile
  tvlct,r,g,b
  message,'Loading table BLUEGREYRED',/info
   end
13: begin 
  loadct,13
  tvlct,r,g,b,/get
  flc=255
  r[flc]=255 & g[flc]=255 & b[flc]=255
  tvlct,r,g,b
  end
else: begin
  loadct,cct
      end
endcase
end


pro hw_aux::help
  help,self,/obj
  return
end

pro hw_aux::init_hw_aux_methods

  a=self->gettitle(/init)
  self->display_all,/init
  self->display_methods,/init
  self->setxtitle,/init
  a=self->getxtitle(/init)
  self->setxrastertitle,/init
  a=self->getxrastertitle(/init)
  self->setytitle,/init
  a=self->getytitle(/init)
  a=self->getvariablename(/init)
  a=self->getxytitle(/init)
  a=self->getmenu(/init)
  a=self->getdispmode(/init)
  self->setdispmode,/init

  return
end

pro hw_aux__define
  nitem=10
  struct={hw_aux, title:' ', $
                  help:obj_new(), $
                  variablename:strarr(nitem), $
                  xtitle:' ', $
                  xrastertitle:' ', $
                  ytitle:' ', $
                  xytitle:strarr(nitem), $
                  dispmode:0,$
                  menu:create_struct(name='menu', $
                                    'action',strarr(nitem), $
                                    'naction',0, $
                                    'xtitle',strarr(nitem), $
                                    'ytitle',strarr(nitem), $
                                    'mode',strarr(nitem), $
                                    'nmode',0, $
                                    'params',strarr(nitem), $
                                    'nparams',0)}
end
