module Graphics.UI.Gtk.WebKit.WebFrame (
WebFrame,
WebFrameClass,
LoadStatus,
webFrameNew,
webFrameGetWebView,
webFrameGetName,
webFrameGetNetworkResponse,
webFrameGetTitle,
webFrameGetUri,
webFrameGetParent,
webFrameGetLoadStatus,
webFrameLoadUri,
webFrameLoadString,
webFrameLoadAlternateString,
webFrameLoadRequest,
webFrameStopLoading,
webFrameReload,
webFrameFindFrame,
webFrameGetDataSource,
webFrameGetHorizontalScrollbarPolicy,
webFrameGetVerticalScrollbarPolicy,
webFrameGetProvisionalDataSource,
webFrameGetSecurityOrigin,
webFramePrint,
) where
import Control.Monad (liftM)
import Data.ByteString (ByteString, useAsCString)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.GList
import System.Glib.GError
import Graphics.UI.Gtk.Gdk.Events
import Graphics.UI.Gtk.General.Enums
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.WebKit.Types
import System.Glib.GObject
data LoadStatus = LoadProvisional
| LoadCommitted
| LoadFinished
| LoadFirstVisuallyNonEmptyLayout
| LoadFailed
deriving (Enum)
webFrameNew ::
WebViewClass webview => webview
-> IO WebFrame
webFrameNew webview =
wrapNewGObject mkWebFrame $ (\(WebView arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_new argPtr1) (toWebView webview)
webFrameGetWebView ::
WebFrameClass self => self
-> IO WebView
webFrameGetWebView webframe =
makeNewObject mkWebView $ liftM castPtr $ (\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_web_view argPtr1) (toWebFrame webframe)
webFrameGetName ::
(WebFrameClass self, GlibString string) => self
-> IO (Maybe string)
webFrameGetName webframe =
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_name argPtr1) (toWebFrame webframe) >>= maybePeek peekUTFString
webFrameGetNetworkResponse :: WebFrameClass self => self -> IO (Maybe NetworkResponse)
webFrameGetNetworkResponse frame =
maybeNull (makeNewGObject mkNetworkResponse) $
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_network_response argPtr1) (toWebFrame frame)
webFrameGetTitle ::
(WebFrameClass self, GlibString string) => self
-> IO (Maybe string)
webFrameGetTitle webframe =
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_title argPtr1) (toWebFrame webframe) >>= maybePeek peekUTFString
webFrameGetUri ::
(WebFrameClass self, GlibString string) => self
-> IO (Maybe string)
webFrameGetUri webframe =
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_uri argPtr1) (toWebFrame webframe) >>= maybePeek peekUTFString
webFrameGetParent ::
WebFrameClass self => self
-> IO (Maybe WebFrame)
webFrameGetParent webframe =
maybeNull (makeNewGObject mkWebFrame) $ (\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_parent argPtr1) (toWebFrame webframe)
webFrameGetLoadStatus ::
WebFrameClass self => self
-> IO LoadStatus
webFrameGetLoadStatus ls =
liftM (toEnum . fromIntegral) $ (\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_load_status argPtr1) (toWebFrame ls)
webFrameLoadUri ::
(WebFrameClass self, GlibString string) => self
-> string
-> IO ()
webFrameLoadUri webframe uri =
withUTFString uri $ \uriPtr -> (\(WebFrame arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_load_uri argPtr1 arg2)
(toWebFrame webframe)
uriPtr
webFrameLoadString ::
(WebFrameClass self, GlibString string) => self
-> string
-> (Maybe string)
-> string
-> IO()
webFrameLoadString webframe content mimetype baseuri =
withUTFString content $ \contentPtr ->
maybeWith withUTFString mimetype $ \mimetypePtr ->
withUTFString baseuri $ \baseuriPtr ->
(\(WebFrame arg1) arg2 arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_load_string argPtr1 arg2 arg3 arg4 arg5)
(toWebFrame webframe)
contentPtr
mimetypePtr
nullPtr
baseuriPtr
webFrameLoadByteString ::
(WebFrameClass self, GlibString string) => self
-> ByteString
-> (Maybe string)
-> (Maybe string)
-> string
-> IO()
webFrameLoadByteString webframe content mimetype encoding baseuri =
useAsCString content $ \contentPtr ->
maybeWith withUTFString mimetype $ \mimetypePtr ->
maybeWith withUTFString encoding $ \encodingPtr ->
withUTFString baseuri $ \baseuriPtr ->
(\(WebFrame arg1) arg2 arg3 arg4 arg5 -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_load_string argPtr1 arg2 arg3 arg4 arg5)
(toWebFrame webframe)
contentPtr
mimetypePtr
encodingPtr
baseuriPtr
webFrameLoadAlternateString ::
(WebFrameClass self, GlibString string) => self
-> string
-> string
-> string
-> IO()
webFrameLoadAlternateString webframe content baseurl unreachableurl =
withUTFString content $ \contentPtr ->
withUTFString baseurl $ \baseurlPtr ->
withUTFString unreachableurl $ \unreachableurlPtr ->
(\(WebFrame arg1) arg2 arg3 arg4 -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_load_alternate_string argPtr1 arg2 arg3 arg4)
(toWebFrame webframe)
contentPtr
baseurlPtr
unreachableurlPtr
webFrameLoadRequest ::
(WebFrameClass self, NetworkRequestClass requ) => self -> requ
-> IO ()
webFrameLoadRequest webframe request =
(\(WebFrame arg1) (NetworkRequest arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->webkit_web_frame_load_request argPtr1 argPtr2) (toWebFrame webframe) (toNetworkRequest request)
webFrameStopLoading ::
WebFrameClass self => self
-> IO()
webFrameStopLoading webframe =
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_stop_loading argPtr1) (toWebFrame webframe)
webFrameReload ::
WebFrameClass self => self
-> IO()
webFrameReload webframe =
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_reload argPtr1) (toWebFrame webframe)
webFrameFindFrame::
(WebFrameClass self, GlibString string) => self
-> string
-> IO (Maybe WebFrame)
webFrameFindFrame webframe name =
withUTFString name $ \namePtr ->
maybeNull (makeNewGObject mkWebFrame) $
(\(WebFrame arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_find_frame argPtr1 arg2) (toWebFrame webframe) namePtr
webFrameGetDataSource ::
WebFrameClass self => self
-> IO WebDataSource
webFrameGetDataSource webframe =
makeNewGObject mkWebDataSource $ (\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_data_source argPtr1) (toWebFrame webframe)
webFrameGetHorizontalScrollbarPolicy ::
WebFrameClass self => self
-> IO PolicyType
webFrameGetHorizontalScrollbarPolicy webframe =
liftM (toEnum.fromIntegral) $
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_horizontal_scrollbar_policy argPtr1) (toWebFrame webframe)
webFrameGetVerticalScrollbarPolicy ::
WebFrameClass self => self
-> IO PolicyType
webFrameGetVerticalScrollbarPolicy webframe =
liftM (toEnum.fromIntegral) $
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_vertical_scrollbar_policy argPtr1) (toWebFrame webframe)
webFrameGetProvisionalDataSource ::
WebFrameClass self => self
-> IO WebDataSource
webFrameGetProvisionalDataSource webframe =
makeNewGObject mkWebDataSource $ (\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_provisional_data_source argPtr1) (toWebFrame webframe)
webFrameGetSecurityOrigin ::
WebFrameClass self => self
-> IO SecurityOrigin
webFrameGetSecurityOrigin webframe =
makeNewGObject mkSecurityOrigin $ (\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_get_security_origin argPtr1) (toWebFrame webframe)
webFramePrint::
WebFrameClass self => self
-> IO()
webFramePrint webframe =
(\(WebFrame arg1) -> withForeignPtr arg1 $ \argPtr1 ->webkit_web_frame_print argPtr1) (toWebFrame webframe)
foreign import ccall safe "webkit_web_frame_new"
webkit_web_frame_new :: ((Ptr WebView) -> (IO (Ptr WebFrame)))
foreign import ccall safe "webkit_web_frame_get_web_view"
webkit_web_frame_get_web_view :: ((Ptr WebFrame) -> (IO (Ptr WebView)))
foreign import ccall safe "webkit_web_frame_get_name"
webkit_web_frame_get_name :: ((Ptr WebFrame) -> (IO (Ptr CChar)))
foreign import ccall safe "webkit_web_frame_get_network_response"
webkit_web_frame_get_network_response :: ((Ptr WebFrame) -> (IO (Ptr NetworkResponse)))
foreign import ccall safe "webkit_web_frame_get_title"
webkit_web_frame_get_title :: ((Ptr WebFrame) -> (IO (Ptr CChar)))
foreign import ccall safe "webkit_web_frame_get_uri"
webkit_web_frame_get_uri :: ((Ptr WebFrame) -> (IO (Ptr CChar)))
foreign import ccall safe "webkit_web_frame_get_parent"
webkit_web_frame_get_parent :: ((Ptr WebFrame) -> (IO (Ptr WebFrame)))
foreign import ccall safe "webkit_web_frame_get_load_status"
webkit_web_frame_get_load_status :: ((Ptr WebFrame) -> (IO CInt))
foreign import ccall safe "webkit_web_frame_load_uri"
webkit_web_frame_load_uri :: ((Ptr WebFrame) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "webkit_web_frame_load_string"
webkit_web_frame_load_string :: ((Ptr WebFrame) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO ()))))))
foreign import ccall safe "webkit_web_frame_load_alternate_string"
webkit_web_frame_load_alternate_string :: ((Ptr WebFrame) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO ())))))
foreign import ccall safe "webkit_web_frame_load_request"
webkit_web_frame_load_request :: ((Ptr WebFrame) -> ((Ptr NetworkRequest) -> (IO ())))
foreign import ccall safe "webkit_web_frame_stop_loading"
webkit_web_frame_stop_loading :: ((Ptr WebFrame) -> (IO ()))
foreign import ccall safe "webkit_web_frame_reload"
webkit_web_frame_reload :: ((Ptr WebFrame) -> (IO ()))
foreign import ccall safe "webkit_web_frame_find_frame"
webkit_web_frame_find_frame :: ((Ptr WebFrame) -> ((Ptr CChar) -> (IO (Ptr WebFrame))))
foreign import ccall safe "webkit_web_frame_get_data_source"
webkit_web_frame_get_data_source :: ((Ptr WebFrame) -> (IO (Ptr WebDataSource)))
foreign import ccall safe "webkit_web_frame_get_horizontal_scrollbar_policy"
webkit_web_frame_get_horizontal_scrollbar_policy :: ((Ptr WebFrame) -> (IO CInt))
foreign import ccall safe "webkit_web_frame_get_vertical_scrollbar_policy"
webkit_web_frame_get_vertical_scrollbar_policy :: ((Ptr WebFrame) -> (IO CInt))
foreign import ccall safe "webkit_web_frame_get_provisional_data_source"
webkit_web_frame_get_provisional_data_source :: ((Ptr WebFrame) -> (IO (Ptr WebDataSource)))
foreign import ccall safe "webkit_web_frame_get_security_origin"
webkit_web_frame_get_security_origin :: ((Ptr WebFrame) -> (IO (Ptr SecurityOrigin)))
foreign import ccall safe "webkit_web_frame_print"
webkit_web_frame_print :: ((Ptr WebFrame) -> (IO ()))