{-# LANGUAGE ForeignFunctionInterface, TypeFamilies, MultiParamTypeClasses, 
             FlexibleInstances, TypeSynonymInstances, 
             EmptyDataDecls, ExistentialQuantification, ScopedTypeVariables #-}

-- module HROOT.Class.Interface where

module HROOT.Class.TBox.Interface where


import Data.Word
import Foreign.ForeignPtr
import HROOT.TypeCast

import HROOT.Class.TBox.RawType

import HROOT.Class.TObject.Interface
import HROOT.Class.TAttLine.Interface
import HROOT.Class.TAttFill.Interface


class (ITObject a,ITAttLine a,ITAttFill a) => ITBox a where

instance Existable TBox where
  data Exist TBox = forall a. (FPtr a, ITBox a) => ETBox a

upcastTBox :: (FPtr a, ITBox a) => a -> TBox
upcastTBox h = let fh = get_fptr h
                   fh2 :: ForeignPtr RawTBox = castForeignPtr fh
               in cast_fptr_to_obj fh2