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

module HROOT.Class.TPCON.Implementation where


import HROOT.TypeCast

import HROOT.Class.TPCON.RawType
import HROOT.Class.TPCON.FFI
import HROOT.Class.TPCON.Interface
import HROOT.Class.TPCON.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 ITPCON TPCON where
instance ITShape TPCON where
instance ITNamed TPCON where
  setName = xform1 c_tpcon_setname
  setNameTitle = xform2 c_tpcon_setnametitle
  setTitle = xform1 c_tpcon_settitle
instance ITAttLine TPCON where
  getLineColor = xform0 c_tpcon_getlinecolor
  getLineStyle = xform0 c_tpcon_getlinestyle
  getLineWidth = xform0 c_tpcon_getlinewidth
  resetAttLine = xform1 c_tpcon_resetattline
  setLineAttributes = xform0 c_tpcon_setlineattributes
  setLineColor = xform1 c_tpcon_setlinecolor
  setLineStyle = xform1 c_tpcon_setlinestyle
  setLineWidth = xform1 c_tpcon_setlinewidth
instance ITAttFill TPCON where
  setFillColor = xform1 c_tpcon_setfillcolor
  setFillStyle = xform1 c_tpcon_setfillstyle
instance ITAtt3D TPCON where
instance ITObject TPCON where
  draw = xform1 c_tpcon_draw
  findObject = xform1 c_tpcon_findobject
  getName = xform0 c_tpcon_getname
  isA = xform0 c_tpcon_isa
  isFolder = xform0 c_tpcon_isfolder
  isEqual = xform1 c_tpcon_isequal
  isSortable = xform0 c_tpcon_issortable
  paint = xform1 c_tpcon_paint
  printObj = xform1 c_tpcon_printobj
  recursiveRemove = xform1 c_tpcon_recursiveremove
  saveAs = xform2 c_tpcon_saveas
  useCurrentStyle = xform0 c_tpcon_usecurrentstyle
  write = xform3 c_tpcon_write
instance IDeletable TPCON where
  delete = xform0 c_tpcon_delete

instance ITPCON (Exist TPCON) where

instance ITShape (Exist TPCON) where

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

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


newTPCON :: String -> String -> String -> Double -> Double -> Int -> IO TPCON
newTPCON = xform5 c_tpcon_newtpcon



instance FPtr (Exist TPCON) where
  type Raw (Exist TPCON) = RawTPCON
  get_fptr (ETPCON obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETPCON (cast_fptr_to_obj (fptr :: ForeignPtr RawTPCON) :: TPCON)