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

-- module HROOT.Class.Interface where

module HROOT.Class.TApplication.Interface where


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

import HROOT.Class.TApplication.RawType

import HROOT.Class.TObject.Interface
import HROOT.Class.TQObject.Interface


class (ITObject a,ITQObject a) => ITApplication a where

    run :: a -> Int -> IO () 

instance Existable TApplication where
  data Exist TApplication = forall a. (FPtr a, ITApplication a) => ETApplication a

upcastTApplication :: (FPtr a, ITApplication a) => a -> TApplication
upcastTApplication h = let fh = get_fptr h
                           fh2 :: ForeignPtr RawTApplication = castForeignPtr fh
                       in cast_fptr_to_obj fh2