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

module HROOT.Class.TAttMarker.Implementation where


import HROOT.TypeCast

import HROOT.Class.TAttMarker.RawType
import HROOT.Class.TAttMarker.FFI
import HROOT.Class.TAttMarker.Interface
import HROOT.Class.TAttMarker.Cast

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 ITAttMarker TAttMarker where
  getMarkerColor = xform0 c_tattmarker_getmarkercolor
  getMarkerStyle = xform0 c_tattmarker_getmarkerstyle
  getMarkerSize = xform0 c_tattmarker_getmarkersize
  resetAttMarker = xform1 c_tattmarker_resetattmarker
  setMarkerAttributes = xform0 c_tattmarker_setmarkerattributes
  setMarkerColor = xform1 c_tattmarker_setmarkercolor
  setMarkerStyle = xform1 c_tattmarker_setmarkerstyle
  setMarkerSize = xform1 c_tattmarker_setmarkersize
instance IDeletable TAttMarker where
  delete = xform0 c_tattmarker_delete

instance ITAttMarker (Exist TAttMarker) where
  getMarkerColor (ETAttMarker x) = getMarkerColor x
  getMarkerStyle (ETAttMarker x) = getMarkerStyle x
  getMarkerSize (ETAttMarker x) = getMarkerSize x
  resetAttMarker (ETAttMarker x) = resetAttMarker x
  setMarkerAttributes (ETAttMarker x) = setMarkerAttributes x
  setMarkerColor (ETAttMarker x) = setMarkerColor x
  setMarkerStyle (ETAttMarker x) = setMarkerStyle x
  setMarkerSize (ETAttMarker x) = setMarkerSize x
instance IDeletable (Exist TAttMarker) where
  delete (ETAttMarker x) = delete x


newTAttMarker :: Int -> Int -> Int -> IO TAttMarker
newTAttMarker = xform2 c_tattmarker_newtattmarker



instance FPtr (Exist TAttMarker) where
  type Raw (Exist TAttMarker) = RawTAttMarker
  get_fptr (ETAttMarker obj) = castForeignPtr (get_fptr obj)
  cast_fptr_to_obj fptr = ETAttMarker (cast_fptr_to_obj (fptr :: ForeignPtr RawTAttMarker) :: TAttMarker)