-- 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/MediaList.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.MediaList(
item,
deleteMedium,
appendMedium,
setMediaText,
getMediaText,
getLength,
MediaList,
castToMediaList,
gTypeMediaList,
MediaListClass,
toMediaList,
) 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.DOM.EventM
import Graphics.UI.Gtk.WebKit.Types
{-# LINE 25 "./Graphics/UI/Gtk/WebKit/DOM/MediaList.chs" #-}
import Graphics.UI.Gtk.WebKit.DOM.Enums

 
item ::
     (MonadIO m, MediaListClass self, GlibString string) =>
       self -> Word -> m (Maybe string)
item self index
  = liftIO
      (((\(MediaList arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_media_list_item argPtr1 arg2) (toMediaList self)
          (fromIntegral index))
         >>=
         maybePeek readUTFString)
 
deleteMedium ::
             (MonadIO m, MediaListClass self, GlibString string) =>
               self -> string -> m ()
deleteMedium self oldMedium
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString oldMedium $
             \ oldMediumPtr ->
               (\(MediaList arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_media_list_delete_medium argPtr1 arg2 arg3) (toMediaList self)
                 oldMediumPtr
             errorPtr_)
 
appendMedium ::
             (MonadIO m, MediaListClass self, GlibString string) =>
               self -> string -> m ()
appendMedium self newMedium
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString newMedium $
             \ newMediumPtr ->
               (\(MediaList arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_media_list_append_medium argPtr1 arg2 arg3) (toMediaList self)
                 newMediumPtr
             errorPtr_)
 
setMediaText ::
             (MonadIO m, MediaListClass self, GlibString string) =>
               self -> (Maybe string) -> m ()
setMediaText self val
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           maybeWith withUTFString val $
             \ valPtr ->
               (\(MediaList arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_media_list_set_media_text argPtr1 arg2 arg3) (toMediaList self)
                 valPtr
             errorPtr_)
 
getMediaText ::
             (MonadIO m, MediaListClass self, GlibString string) =>
               self -> m (Maybe string)
getMediaText self
  = liftIO
      (((\(MediaList arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_media_list_get_media_text argPtr1)
{-# LINE 83 "./Graphics/UI/Gtk/WebKit/DOM/MediaList.chs" #-}
          (toMediaList self))
         >>=
         maybePeek readUTFString)
 
getLength :: (MonadIO m, MediaListClass self) => self -> m Word
getLength self
  = liftIO
      (fromIntegral <$>
         ((\(MediaList arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_media_list_get_length argPtr1) (toMediaList self)))

foreign import ccall safe "webkit_dom_media_list_item"
  webkit_dom_media_list_item :: ((Ptr MediaList) -> (CULong -> (IO (Ptr CChar))))

foreign import ccall safe "webkit_dom_media_list_delete_medium"
  webkit_dom_media_list_delete_medium :: ((Ptr MediaList) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_media_list_append_medium"
  webkit_dom_media_list_append_medium :: ((Ptr MediaList) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_media_list_set_media_text"
  webkit_dom_media_list_set_media_text :: ((Ptr MediaList) -> ((Ptr CChar) -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_media_list_get_media_text"
  webkit_dom_media_list_get_media_text :: ((Ptr MediaList) -> (IO (Ptr CChar)))

foreign import ccall safe "webkit_dom_media_list_get_length"
  webkit_dom_media_list_get_length :: ((Ptr MediaList) -> (IO CULong))