-- 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/CSSStyleSheet.chs" #-}
module Graphics.UI.Gtk.WebKit.DOM.CSSStyleSheet(
insertRule,
deleteRule,
addRule,
removeRule,
getOwnerRule,
getCssRules,
getRules,
CSSStyleSheet,
castToCSSStyleSheet,
gTypeCSSStyleSheet,
CSSStyleSheetClass,
toCSSStyleSheet,
) 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 26 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
import Graphics.UI.Gtk.WebKit.DOM.Enums

 
insertRule ::
           (MonadIO m, CSSStyleSheetClass self, GlibString string) =>
             self -> string -> Word -> m Word
insertRule self rule index
  = liftIO
      (fromIntegral <$>
         (propagateGError $
            \ errorPtr_ ->
              withUTFString rule $
                \ rulePtr ->
                  (\(CSSStyleSheet arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_insert_rule argPtr1 arg2 arg3 arg4)
{-# LINE 40 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
                    (toCSSStyleSheet self)
                    rulePtr
                (fromIntegral index)
                errorPtr_))
 
deleteRule ::
           (MonadIO m, CSSStyleSheetClass self) => self -> Word -> m ()
deleteRule self index
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           (\(CSSStyleSheet arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_delete_rule argPtr1 arg2 arg3)
{-# LINE 52 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
             (toCSSStyleSheet self)
             (fromIntegral index)
             errorPtr_)
 
addRule ::
        (MonadIO m, CSSStyleSheetClass self, GlibString string) =>
          self -> string -> string -> Word -> m Int
addRule self selector style index
  = liftIO
      (fromIntegral <$>
         (propagateGError $
            \ errorPtr_ ->
              withUTFString style $
                \ stylePtr ->
                  withUTFString selector $
                    \ selectorPtr ->
                      (\(CSSStyleSheet arg1) arg2 arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_add_rule argPtr1 arg2 arg3 arg4 arg5)
{-# LINE 69 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
                        (toCSSStyleSheet self)
                        selectorPtr
                    stylePtr
                (fromIntegral index)
                errorPtr_))
 
removeRule ::
           (MonadIO m, CSSStyleSheetClass self) => self -> Word -> m ()
removeRule self index
  = liftIO
      (propagateGError $
         \ errorPtr_ ->
           (\(CSSStyleSheet arg1) arg2 arg3 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_remove_rule argPtr1 arg2 arg3)
{-# LINE 82 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
             (toCSSStyleSheet self)
             (fromIntegral index)
             errorPtr_)
 
getOwnerRule ::
             (MonadIO m, CSSStyleSheetClass self) => self -> m (Maybe CSSRule)
getOwnerRule self
  = liftIO
      (maybeNull (makeNewGObject mkCSSRule)
         ((\(CSSStyleSheet arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_get_owner_rule argPtr1)
{-# LINE 92 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
            (toCSSStyleSheet self)))
 
getCssRules ::
            (MonadIO m, CSSStyleSheetClass self) =>
              self -> m (Maybe CSSRuleList)
getCssRules self
  = liftIO
      (maybeNull (makeNewGObject mkCSSRuleList)
         ((\(CSSStyleSheet arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_get_css_rules argPtr1)
{-# LINE 101 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
            (toCSSStyleSheet self)))
 
getRules ::
         (MonadIO m, CSSStyleSheetClass self) =>
           self -> m (Maybe CSSRuleList)
getRules self
  = liftIO
      (maybeNull (makeNewGObject mkCSSRuleList)
         ((\(CSSStyleSheet arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_css_style_sheet_get_rules argPtr1)
{-# LINE 110 "./Graphics/UI/Gtk/WebKit/DOM/CSSStyleSheet.chs" #-}
            (toCSSStyleSheet self)))

foreign import ccall safe "webkit_dom_css_style_sheet_insert_rule"
  webkit_dom_css_style_sheet_insert_rule :: ((Ptr CSSStyleSheet) -> ((Ptr CChar) -> (CULong -> ((Ptr (Ptr ())) -> (IO CULong)))))

foreign import ccall safe "webkit_dom_css_style_sheet_delete_rule"
  webkit_dom_css_style_sheet_delete_rule :: ((Ptr CSSStyleSheet) -> (CULong -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_css_style_sheet_add_rule"
  webkit_dom_css_style_sheet_add_rule :: ((Ptr CSSStyleSheet) -> ((Ptr CChar) -> ((Ptr CChar) -> (CULong -> ((Ptr (Ptr ())) -> (IO CLong))))))

foreign import ccall safe "webkit_dom_css_style_sheet_remove_rule"
  webkit_dom_css_style_sheet_remove_rule :: ((Ptr CSSStyleSheet) -> (CULong -> ((Ptr (Ptr ())) -> (IO ()))))

foreign import ccall safe "webkit_dom_css_style_sheet_get_owner_rule"
  webkit_dom_css_style_sheet_get_owner_rule :: ((Ptr CSSStyleSheet) -> (IO (Ptr CSSRule)))

foreign import ccall safe "webkit_dom_css_style_sheet_get_css_rules"
  webkit_dom_css_style_sheet_get_css_rules :: ((Ptr CSSStyleSheet) -> (IO (Ptr CSSRuleList)))

foreign import ccall safe "webkit_dom_css_style_sheet_get_rules"
  webkit_dom_css_style_sheet_get_rules :: ((Ptr CSSStyleSheet) -> (IO (Ptr CSSRuleList)))