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

module HROOT.Class.TArc.Implementation where


import HROOT.TypeCast

import HROOT.Class.TArc.RawType
import HROOT.Class.TArc.FFI
import HROOT.Class.TArc.Interface
import HROOT.Class.TArc.Cast
import HROOT.Class.TClass.RawType
import HROOT.Class.TClass.Cast
import HROOT.Class.TClass.Interface
import HROOT.Class.TEllipse.RawType
import HROOT.Class.TEllipse.Cast
import HROOT.Class.TEllipse.Interface
import HROOT.Class.TObject.RawType
import HROOT.Class.TObject.Cast
import HROOT.Class.TObject.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.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 ITArc TArc where
instance ITEllipse TArc where
instance ITObject TArc where
  draw = xform1 c_tarc_draw
  findObject = xform1 c_tarc_findobject
  getName = xform0 c_tarc_getname
  isA = xform0 c_tarc_isa
  isFolder = xform0 c_tarc_isfolder
  isEqual = xform1 c_tarc_isequal
  isSortable = xform0 c_tarc_issortable
  paint = xform1 c_tarc_paint
  printObj = xform1 c_tarc_printobj
  recursiveRemove = xform1 c_tarc_recursiveremove
  saveAs = xform2 c_tarc_saveas
  useCurrentStyle = xform0 c_tarc_usecurrentstyle
  write = xform3 c_tarc_write
instance ITAttLine TArc where
  getLineColor = xform0 c_tarc_getlinecolor
  getLineStyle = xform0 c_tarc_getlinestyle
  getLineWidth = xform0 c_tarc_getlinewidth
  resetAttLine = xform1 c_tarc_resetattline
  setLineAttributes = xform0 c_tarc_setlineattributes
  setLineColor = xform1 c_tarc_setlinecolor
  setLineStyle = xform1 c_tarc_setlinestyle
  setLineWidth = xform1 c_tarc_setlinewidth
instance ITAttFill TArc where
  setFillColor = xform1 c_tarc_setfillcolor
  setFillStyle = xform1 c_tarc_setfillstyle
instance IDeletable TArc where
  delete = xform0 c_tarc_delete

instance ITArc (Exist TArc) where

instance ITEllipse (Exist TArc) where

instance ITObject (Exist TArc) where
  draw (ETArc x) = draw x
  findObject (ETArc x) = findObject x
  getName (ETArc x) = getName x
  isA (ETArc x) = isA x
  isFolder (ETArc x) = isFolder x
  isEqual (ETArc x) = isEqual x
  isSortable (ETArc x) = isSortable x
  paint (ETArc x) = paint x
  printObj (ETArc x) = printObj x
  recursiveRemove (ETArc x) = recursiveRemove x
  saveAs (ETArc x) = saveAs x
  useCurrentStyle (ETArc x) = useCurrentStyle x
  write (ETArc x) = write x
instance ITAttLine (Exist TArc) where
  getLineColor (ETArc x) = getLineColor x
  getLineStyle (ETArc x) = getLineStyle x
  getLineWidth (ETArc x) = getLineWidth x
  resetAttLine (ETArc x) = resetAttLine x
  setLineAttributes (ETArc x) = setLineAttributes x
  setLineColor (ETArc x) = setLineColor x
  setLineStyle (ETArc x) = setLineStyle x
  setLineWidth (ETArc x) = setLineWidth x
instance ITAttFill (Exist TArc) where
  setFillColor (ETArc x) = setFillColor x
  setFillStyle (ETArc x) = setFillStyle x
instance IDeletable (Exist TArc) where
  delete (ETArc x) = delete x


newTArc :: Double -> Double -> Double -> Double -> Double -> IO TArc
newTArc = xform4 c_tarc_newtarc





instance FPtr (Exist TArc) where
  type Raw (Exist TArc) = RawTArc
  get_fptr (ETArc obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETArc (cast_fptr_to_obj (fptr :: ForeignPtr RawTArc) :: TArc)