module Graphics.UI.Gtk.WebKit.DOM.Event(
stopPropagation,
preventDefault,
initEvent,
stopImmediatePropagation,
pattern NONE,
pattern CAPTURING_PHASE,
pattern AT_TARGET,
pattern BUBBLING_PHASE,
pattern MOUSEDOWN,
pattern MOUSEUP,
pattern MOUSEOVER,
pattern MOUSEOUT,
pattern MOUSEMOVE,
pattern MOUSEDRAG,
pattern CLICK,
pattern DBLCLICK,
pattern KEYDOWN,
pattern KEYUP,
pattern KEYPRESS,
pattern DRAGDROP,
pattern FOCUS,
pattern BLUR,
pattern SELECT,
pattern CHANGE,
getTarget,
getCurrentTarget,
getEventPhase,
getBubbles,
getCancelable,
getTimeStamp,
getDefaultPrevented,
getSrcElement,
setReturnValue,
getReturnValue,
setCancelBubble,
getCancelBubble,
Event,
castToEvent,
gTypeEvent,
EventClass,
toEvent,
) 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
import Graphics.UI.Gtk.WebKit.DOM.Enums
stopPropagation :: (MonadIO m, EventClass self) => self -> m ()
stopPropagation self
= liftIO
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_stop_propagation argPtr1) (toEvent self))
preventDefault :: (MonadIO m, EventClass self) => self -> m ()
preventDefault self
= liftIO
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_prevent_default argPtr1) (toEvent self))
initEvent ::
(MonadIO m, EventClass self, GlibString string) =>
self -> string -> Bool -> Bool -> m ()
initEvent self eventTypeArg canBubbleArg cancelableArg
= liftIO
(withUTFString eventTypeArg $
\ eventTypeArgPtr ->
(\(Event arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_init_event argPtr1 arg2 arg3 arg4) (toEvent self)
eventTypeArgPtr
(fromBool canBubbleArg)
(fromBool cancelableArg))
stopImmediatePropagation ::
(MonadIO m, EventClass self) => self -> m ()
stopImmediatePropagation self
= liftIO
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_stop_immediate_propagation argPtr1)
(toEvent self))
pattern NONE = 0
pattern CAPTURING_PHASE = 1
pattern AT_TARGET = 2
pattern BUBBLING_PHASE = 3
pattern MOUSEDOWN = 1
pattern MOUSEUP = 2
pattern MOUSEOVER = 4
pattern MOUSEOUT = 8
pattern MOUSEMOVE = 16
pattern MOUSEDRAG = 32
pattern CLICK = 64
pattern DBLCLICK = 128
pattern KEYDOWN = 256
pattern KEYUP = 512
pattern KEYPRESS = 1024
pattern DRAGDROP = 2048
pattern FOCUS = 4096
pattern BLUR = 8192
pattern SELECT = 16384
pattern CHANGE = 32768
getTarget ::
(MonadIO m, EventClass self) => self -> m (Maybe EventTarget)
getTarget self
= liftIO
(maybeNull (makeNewGObject mkEventTarget)
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_target argPtr1) (toEvent self)))
getCurrentTarget ::
(MonadIO m, EventClass self) => self -> m (Maybe EventTarget)
getCurrentTarget self
= liftIO
(maybeNull (makeNewGObject mkEventTarget)
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_current_target argPtr1) (toEvent self)))
getEventPhase :: (MonadIO m, EventClass self) => self -> m Word
getEventPhase self
= liftIO
(fromIntegral <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_event_phase argPtr1) (toEvent self)))
getBubbles :: (MonadIO m, EventClass self) => self -> m Bool
getBubbles self
= liftIO
(toBool <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_bubbles argPtr1) (toEvent self)))
getCancelable :: (MonadIO m, EventClass self) => self -> m Bool
getCancelable self
= liftIO
(toBool <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_cancelable argPtr1) (toEvent self)))
getTimeStamp :: (MonadIO m, EventClass self) => self -> m Word
getTimeStamp self
= liftIO
(fromIntegral <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_time_stamp argPtr1) (toEvent self)))
getDefaultPrevented ::
(MonadIO m, EventClass self) => self -> m Bool
getDefaultPrevented self
= liftIO
(toBool <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_default_prevented argPtr1) (toEvent self)))
getSrcElement ::
(MonadIO m, EventClass self) => self -> m (Maybe EventTarget)
getSrcElement self
= liftIO
(maybeNull (makeNewGObject mkEventTarget)
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_src_element argPtr1) (toEvent self)))
setReturnValue ::
(MonadIO m, EventClass self) => self -> Bool -> m ()
setReturnValue self val
= liftIO
((\(Event arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_set_return_value argPtr1 arg2) (toEvent self)
(fromBool val))
getReturnValue :: (MonadIO m, EventClass self) => self -> m Bool
getReturnValue self
= liftIO
(toBool <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_return_value argPtr1) (toEvent self)))
setCancelBubble ::
(MonadIO m, EventClass self) => self -> Bool -> m ()
setCancelBubble self val
= liftIO
((\(Event arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_set_cancel_bubble argPtr1 arg2) (toEvent self)
(fromBool val))
getCancelBubble :: (MonadIO m, EventClass self) => self -> m Bool
getCancelBubble self
= liftIO
(toBool <$>
((\(Event arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_dom_event_get_cancel_bubble argPtr1) (toEvent self)))
foreign import ccall safe "webkit_dom_event_stop_propagation"
webkit_dom_event_stop_propagation :: ((Ptr Event) -> (IO ()))
foreign import ccall safe "webkit_dom_event_prevent_default"
webkit_dom_event_prevent_default :: ((Ptr Event) -> (IO ()))
foreign import ccall safe "webkit_dom_event_init_event"
webkit_dom_event_init_event :: ((Ptr Event) -> ((Ptr CChar) -> (CInt -> (CInt -> (IO ())))))
foreign import ccall safe "webkit_dom_event_stop_immediate_propagation"
webkit_dom_event_stop_immediate_propagation :: ((Ptr Event) -> (IO ()))
foreign import ccall safe "webkit_dom_event_get_target"
webkit_dom_event_get_target :: ((Ptr Event) -> (IO (Ptr EventTarget)))
foreign import ccall safe "webkit_dom_event_get_current_target"
webkit_dom_event_get_current_target :: ((Ptr Event) -> (IO (Ptr EventTarget)))
foreign import ccall safe "webkit_dom_event_get_event_phase"
webkit_dom_event_get_event_phase :: ((Ptr Event) -> (IO CUShort))
foreign import ccall safe "webkit_dom_event_get_bubbles"
webkit_dom_event_get_bubbles :: ((Ptr Event) -> (IO CInt))
foreign import ccall safe "webkit_dom_event_get_cancelable"
webkit_dom_event_get_cancelable :: ((Ptr Event) -> (IO CInt))
foreign import ccall safe "webkit_dom_event_get_time_stamp"
webkit_dom_event_get_time_stamp :: ((Ptr Event) -> (IO CUInt))
foreign import ccall safe "webkit_dom_event_get_default_prevented"
webkit_dom_event_get_default_prevented :: ((Ptr Event) -> (IO CInt))
foreign import ccall safe "webkit_dom_event_get_src_element"
webkit_dom_event_get_src_element :: ((Ptr Event) -> (IO (Ptr EventTarget)))
foreign import ccall safe "webkit_dom_event_set_return_value"
webkit_dom_event_set_return_value :: ((Ptr Event) -> (CInt -> (IO ())))
foreign import ccall safe "webkit_dom_event_get_return_value"
webkit_dom_event_get_return_value :: ((Ptr Event) -> (IO CInt))
foreign import ccall safe "webkit_dom_event_set_cancel_bubble"
webkit_dom_event_set_cancel_bubble :: ((Ptr Event) -> (CInt -> (IO ())))
foreign import ccall safe "webkit_dom_event_get_cancel_bubble"
webkit_dom_event_get_cancel_bubble :: ((Ptr Event) -> (IO CInt))