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

module HROOT.Class.TFrame.Implementation where


import HROOT.TypeCast

import HROOT.Class.TFrame.RawType
import HROOT.Class.TFrame.FFI
import HROOT.Class.TFrame.Interface
import HROOT.Class.TFrame.Cast
import HROOT.Class.TClass.RawType
import HROOT.Class.TClass.Cast
import HROOT.Class.TClass.Interface
import HROOT.Class.TWbox.RawType
import HROOT.Class.TWbox.Cast
import HROOT.Class.TWbox.Interface
import HROOT.Class.TBox.RawType
import HROOT.Class.TBox.Cast
import HROOT.Class.TBox.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 ITFrame TFrame where
instance ITWbox TFrame where
  setBorderMode = xform1 c_tframe_setbordermode
instance ITBox TFrame where
instance ITObject TFrame where
  draw = xform1 c_tframe_draw
  findObject = xform1 c_tframe_findobject
  getName = xform0 c_tframe_getname
  isA = xform0 c_tframe_isa
  isFolder = xform0 c_tframe_isfolder
  isEqual = xform1 c_tframe_isequal
  isSortable = xform0 c_tframe_issortable
  paint = xform1 c_tframe_paint
  printObj = xform1 c_tframe_printobj
  recursiveRemove = xform1 c_tframe_recursiveremove
  saveAs = xform2 c_tframe_saveas
  useCurrentStyle = xform0 c_tframe_usecurrentstyle
  write = xform3 c_tframe_write
instance ITAttLine TFrame where
  getLineColor = xform0 c_tframe_getlinecolor
  getLineStyle = xform0 c_tframe_getlinestyle
  getLineWidth = xform0 c_tframe_getlinewidth
  resetAttLine = xform1 c_tframe_resetattline
  setLineAttributes = xform0 c_tframe_setlineattributes
  setLineColor = xform1 c_tframe_setlinecolor
  setLineStyle = xform1 c_tframe_setlinestyle
  setLineWidth = xform1 c_tframe_setlinewidth
instance ITAttFill TFrame where
  setFillColor = xform1 c_tframe_setfillcolor
  setFillStyle = xform1 c_tframe_setfillstyle
instance IDeletable TFrame where
  delete = xform0 c_tframe_delete

instance ITFrame (Exist TFrame) where

instance ITWbox (Exist TFrame) where
  setBorderMode (ETFrame x) = setBorderMode x
instance ITBox (Exist TFrame) where

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


newTFrame :: Double -> Double -> Double -> Double -> IO TFrame
newTFrame = xform3 c_tframe_newtframe



instance FPtr (Exist TFrame) where
  type Raw (Exist TFrame) = RawTFrame
  get_fptr (ETFrame obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETFrame (cast_fptr_to_obj (fptr :: ForeignPtr RawTFrame) :: TFrame)