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

module HROOT.Class.TPolyLine.Implementation where


import HROOT.TypeCast

import HROOT.Class.TPolyLine.RawType
import HROOT.Class.TPolyLine.FFI
import HROOT.Class.TPolyLine.Interface
import HROOT.Class.TPolyLine.Cast
import HROOT.Class.TClass.RawType
import HROOT.Class.TClass.Cast
import HROOT.Class.TClass.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 ITPolyLine TPolyLine where
instance ITObject TPolyLine where
  draw = xform1 c_tpolyline_draw
  findObject = xform1 c_tpolyline_findobject
  getName = xform0 c_tpolyline_getname
  isA = xform0 c_tpolyline_isa
  isFolder = xform0 c_tpolyline_isfolder
  isEqual = xform1 c_tpolyline_isequal
  isSortable = xform0 c_tpolyline_issortable
  paint = xform1 c_tpolyline_paint
  printObj = xform1 c_tpolyline_printobj
  recursiveRemove = xform1 c_tpolyline_recursiveremove
  saveAs = xform2 c_tpolyline_saveas
  useCurrentStyle = xform0 c_tpolyline_usecurrentstyle
  write = xform3 c_tpolyline_write
instance ITAttLine TPolyLine where
  getLineColor = xform0 c_tpolyline_getlinecolor
  getLineStyle = xform0 c_tpolyline_getlinestyle
  getLineWidth = xform0 c_tpolyline_getlinewidth
  resetAttLine = xform1 c_tpolyline_resetattline
  setLineAttributes = xform0 c_tpolyline_setlineattributes
  setLineColor = xform1 c_tpolyline_setlinecolor
  setLineStyle = xform1 c_tpolyline_setlinestyle
  setLineWidth = xform1 c_tpolyline_setlinewidth
instance ITAttFill TPolyLine where
  setFillColor = xform1 c_tpolyline_setfillcolor
  setFillStyle = xform1 c_tpolyline_setfillstyle
instance IDeletable TPolyLine where
  delete = xform0 c_tpolyline_delete

instance ITPolyLine (Exist TPolyLine) where

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


newTPolyLine :: Int -> [Double] -> [Double] -> String -> IO TPolyLine
newTPolyLine = xform3 c_tpolyline_newtpolyline





instance FPtr (Exist TPolyLine) where
  type Raw (Exist TPolyLine) = RawTPolyLine
  get_fptr (ETPolyLine obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETPolyLine (cast_fptr_to_obj (fptr :: ForeignPtr RawTPolyLine) :: TPolyLine)