-- 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/DOMTokenList.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.DOMTokenList(
item,
contains,
add,
remove,
toggle,
getLength,
DOMTokenList,
castToDOMTokenList,
gTypeDOMTokenList,
DOMTokenListClass,
toDOMTokenList,
) 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 27 "./Graphics/UI/Gtk/WebKit/DOM/DOMTokenList.chs" #-}
import Graphics.UI.Gtk.WebKit.DOM.Enums

 
item ::
     (MonadIO m, DOMTokenListClass self, GlibString string) =>
       self -> Word -> m (Maybe string)
item self index
  = liftIO
      (((\(DOMTokenList arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_dom_token_list_item argPtr1 arg2) (toDOMTokenList self)
          (fromIntegral index))
         >>=
         maybePeek readUTFString)
 
contains ::
         (MonadIO m, DOMTokenListClass self, GlibString string) =>
           self -> string -> m Bool
contains self token
  = liftIO
      (toBool <$>
         (propagateGError $
            \ errorPtr_ ->
              withUTFString token $
                \ tokenPtr ->
                  (\(DOMTokenList arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_dom_token_list_contains argPtr1 arg2 arg3) (toDOMTokenList self)
                    tokenPtr
                errorPtr_))
 
add ::
    (MonadIO m, DOMTokenListClass self, GlibString string) =>
      self -> string -> m ()
add self tokens
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString tokens $
             \ tokensPtr ->
               (\(DOMTokenList arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_dom_token_list_add argPtr1 arg2 arg3) (toDOMTokenList self)
                 tokensPtr
             errorPtr_)
 
remove ::
       (MonadIO m, DOMTokenListClass self, GlibString string) =>
         self -> string -> m ()
remove self tokens
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           withUTFString tokens $
             \ tokensPtr ->
               (\(DOMTokenList arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_dom_token_list_remove argPtr1 arg2 arg3) (toDOMTokenList self)
                 tokensPtr
             errorPtr_)

toggle ::
       (MonadIO m, DOMTokenListClass self, GlibString string) =>
         self -> string -> Bool -> m Bool
toggle self token force
  = liftIO
      (toBool <$>
         (propagateGError $
            \ errorPtr_ ->
              withUTFString token $
                \ tokenPtr ->
                  (\(DOMTokenList arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_dom_token_list_toggle argPtr1 arg2 arg3 arg4) (toDOMTokenList self)
                    tokenPtr
                (fromBool force)
                errorPtr_))
 
getLength :: (MonadIO m, DOMTokenListClass self) => self -> m Word
getLength self
  = liftIO
      (fromIntegral <$>
         ((\(DOMTokenList arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_dom_token_list_get_length argPtr1)
{-# LINE 102 "./Graphics/UI/Gtk/WebKit/DOM/DOMTokenList.chs" #-}
            (toDOMTokenList self)))

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/DOMTokenList.h webkit_dom_dom_token_list_item"
  webkit_dom_dom_token_list_item :: ((Ptr DOMTokenList) -> (CULong -> (IO (Ptr CChar))))

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

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

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

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

foreign import ccall safe "dist/build/Graphics/UI/Gtk/WebKit/DOM/DOMTokenList.h webkit_dom_dom_token_list_get_length"
  webkit_dom_dom_token_list_get_length :: ((Ptr DOMTokenList) -> (IO CULong))