{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, EmptyDataDecls, 
             OverlappingInstances, IncoherentInstances #-}

module HROOT.Class.TSPHE.Implementation where


import HROOT.TypeCast

import HROOT.Class.TSPHE.RawType
import HROOT.Class.TSPHE.FFI
import HROOT.Class.TSPHE.Interface
import HROOT.Class.TSPHE.Cast
import HROOT.Class.TClass.RawType
import HROOT.Class.TClass.Cast
import HROOT.Class.TClass.Interface
import HROOT.Class.TShape.RawType
import HROOT.Class.TShape.Cast
import HROOT.Class.TShape.Interface
import HROOT.Class.TNamed.RawType
import HROOT.Class.TNamed.Cast
import HROOT.Class.TNamed.Interface
import HROOT.Class.TAttLine.RawType
import HROOT.Class.TAttLine.Cast
import HROOT.Class.TAttLine.Interface
import HROOT.Class.TAttFill.RawType
import HROOT.Class.TAttFill.Cast
import HROOT.Class.TAttFill.Interface
import HROOT.Class.TAtt3D.RawType
import HROOT.Class.TAtt3D.Cast
import HROOT.Class.TAtt3D.Interface
import HROOT.Class.TObject.RawType
import HROOT.Class.TObject.Cast
import HROOT.Class.TObject.Interface
import HROOT.Class.Deletable.RawType
import HROOT.Class.Deletable.Cast
import HROOT.Class.Deletable.Interface

import Data.Word
-- import Foreign.C            
-- import Foreign.Ptr
import Foreign.ForeignPtr

import System.IO.Unsafe


instance ITSPHE TSPHE where
instance ITShape TSPHE where
instance ITNamed TSPHE where
  setName = xform1 c_tsphe_setname
  setNameTitle = xform2 c_tsphe_setnametitle
  setTitle = xform1 c_tsphe_settitle
instance ITAttLine TSPHE where
  getLineColor = xform0 c_tsphe_getlinecolor
  getLineStyle = xform0 c_tsphe_getlinestyle
  getLineWidth = xform0 c_tsphe_getlinewidth
  resetAttLine = xform1 c_tsphe_resetattline
  setLineAttributes = xform0 c_tsphe_setlineattributes
  setLineColor = xform1 c_tsphe_setlinecolor
  setLineStyle = xform1 c_tsphe_setlinestyle
  setLineWidth = xform1 c_tsphe_setlinewidth
instance ITAttFill TSPHE where
  setFillColor = xform1 c_tsphe_setfillcolor
  setFillStyle = xform1 c_tsphe_setfillstyle
instance ITAtt3D TSPHE where
instance ITObject TSPHE where
  draw = xform1 c_tsphe_draw
  findObject = xform1 c_tsphe_findobject
  getName = xform0 c_tsphe_getname
  isA = xform0 c_tsphe_isa
  isFolder = xform0 c_tsphe_isfolder
  isEqual = xform1 c_tsphe_isequal
  isSortable = xform0 c_tsphe_issortable
  paint = xform1 c_tsphe_paint
  printObj = xform1 c_tsphe_printobj
  recursiveRemove = xform1 c_tsphe_recursiveremove
  saveAs = xform2 c_tsphe_saveas
  useCurrentStyle = xform0 c_tsphe_usecurrentstyle
  write = xform3 c_tsphe_write
instance IDeletable TSPHE where
  delete = xform0 c_tsphe_delete

instance ITSPHE (Exist TSPHE) where

instance ITShape (Exist TSPHE) where

instance ITNamed (Exist TSPHE) where
  setName (ETSPHE x) = setName x
  setNameTitle (ETSPHE x) = setNameTitle x
  setTitle (ETSPHE x) = setTitle x
instance ITAttLine (Exist TSPHE) where
  getLineColor (ETSPHE x) = getLineColor x
  getLineStyle (ETSPHE x) = getLineStyle x
  getLineWidth (ETSPHE x) = getLineWidth x
  resetAttLine (ETSPHE x) = resetAttLine x
  setLineAttributes (ETSPHE x) = setLineAttributes x
  setLineColor (ETSPHE x) = setLineColor x
  setLineStyle (ETSPHE x) = setLineStyle x
  setLineWidth (ETSPHE x) = setLineWidth x
instance ITAttFill (Exist TSPHE) where
  setFillColor (ETSPHE x) = setFillColor x
  setFillStyle (ETSPHE x) = setFillStyle x
instance ITAtt3D (Exist TSPHE) where

instance ITObject (Exist TSPHE) where
  draw (ETSPHE x) = draw x
  findObject (ETSPHE x) = findObject x
  getName (ETSPHE x) = getName x
  isA (ETSPHE x) = isA x
  isFolder (ETSPHE x) = isFolder x
  isEqual (ETSPHE x) = isEqual x
  isSortable (ETSPHE x) = isSortable x
  paint (ETSPHE x) = paint x
  printObj (ETSPHE x) = printObj x
  recursiveRemove (ETSPHE x) = recursiveRemove x
  saveAs (ETSPHE x) = saveAs x
  useCurrentStyle (ETSPHE x) = useCurrentStyle x
  write (ETSPHE x) = write x
instance IDeletable (Exist TSPHE) where
  delete (ETSPHE x) = delete x


newTSPHE :: String -> String -> String -> Double -> Double -> Double -> Double -> Double -> Double -> IO TSPHE
newTSPHE = xform8 c_tsphe_newtsphe





instance FPtr (Exist TSPHE) where
  type Raw (Exist TSPHE) = RawTSPHE
  get_fptr (ETSPHE obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETSPHE (cast_fptr_to_obj (fptr :: ForeignPtr RawTSPHE) :: TSPHE)