-- GENERATED by C->Haskell Compiler, version 0.13.13 (gtk2hs branch) "Bin IO", 27 May 2012 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "./Graphics/UI/Gtk/WebKit/DOM/EventTarget.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.EventTarget(
addEventListener,
removeEventListener,
dispatchEvent,
EventTarget,
castToEventTarget,
gTypeEventTarget,
EventTargetClass,
toEventTarget,
) where
import Prelude hiding (drop, error, print)
import Data.Typeable (Typeable)
import Foreign.Marshal (maybePeek, maybeWith)
import System.Glib.FFI (maybeNull, withForeignPtr, nullForeignPtr, Ptr, nullPtr, castPtr, Word, Int64, Word64, CChar(..), CInt(..), CUInt(..), CLong(..), CULong(..), CLLong(..), CULLong(..), CShort(..), CUShort(..), CFloat(..), CDouble(..), toBool, fromBool)
import System.Glib.UTFString (GlibString(..), readUTFString)
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Monad.IO.Class (MonadIO(..))
import System.Glib.GError
import Graphics.UI.Gtk.WebKit.DOM.EventTargetClosures
import Graphics.UI.Gtk.WebKit.Types
{-# LINE 21 "./Graphics/UI/Gtk/WebKit/DOM/EventTarget.chs" #-}
import Graphics.UI.Gtk.WebKit.DOM.Enums

 
addEventListener ::
                 (MonadIO m, EventTargetClass self, EventListenerClass listener,
                  GlibString string) =>
                   self -> string -> Maybe listener -> Bool -> m ()
addEventListener self type' listener useCapture
  = liftIO
      (void $
         withUTFString type' $
           \ typePtr ->
             (\(EventTarget arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_target_add_event_listener_with_closure argPtr1 arg2 arg3 arg4)
{-# LINE 38 "./Graphics/UI/Gtk/WebKit/DOM/EventTarget.chs" #-}
               (toEventTarget self)
               typePtr
           (maybe nullPtr (castPtr . unEventListener . toEventListener)
              listener)
           (fromBool useCapture))
 
removeEventListener ::
                    (MonadIO m, EventTargetClass self, EventListenerClass listener,
                     GlibString string) =>
                      self -> string -> Maybe listener -> Bool -> m ()
removeEventListener self type' listener useCapture
  = liftIO
      (void $
         withUTFString type' $
           \ typePtr ->
             (\(EventTarget arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_target_remove_event_listener_with_closure argPtr1 arg2 arg3 arg4)
{-# LINE 58 "./Graphics/UI/Gtk/WebKit/DOM/EventTarget.chs" #-}
               (toEventTarget self)
               typePtr
           (maybe nullPtr (castPtr . unEventListener . toEventListener)
              listener)
           (fromBool useCapture))
 
dispatchEvent ::
              (MonadIO m, EventTargetClass self, EventClass event) =>
                self -> Maybe event -> m ()
dispatchEvent self event
  = liftIO . void $
         propagateGError $
            \ errorPtr_ ->
              (\(EventTarget arg1) (Event arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->webkit_dom_event_target_dispatch_event argPtr1 argPtr2 arg3)
{-# LINE 72 "./Graphics/UI/Gtk/WebKit/DOM/EventTarget.chs" #-}
                (toEventTarget self)
                (maybe (Event nullForeignPtr) toEvent event)
                errorPtr_

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/EventTarget.h webkit_dom_event_target_add_event_listener_with_closure"
  webkit_dom_event_target_add_event_listener_with_closure :: ((Ptr EventTarget) -> ((Ptr CChar) -> ((Ptr ()) -> (CInt -> (IO CInt)))))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/EventTarget.h webkit_dom_event_target_remove_event_listener_with_closure"
  webkit_dom_event_target_remove_event_listener_with_closure :: ((Ptr EventTarget) -> ((Ptr CChar) -> ((Ptr ()) -> (CInt -> (IO CInt)))))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/EventTarget.h webkit_dom_event_target_dispatch_event"
  webkit_dom_event_target_dispatch_event :: ((Ptr EventTarget) -> ((Ptr Event) -> ((Ptr (Ptr ())) -> (IO CInt))))