{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.WebKit2.Objects.PrintCustomWidget
    (

-- * Exported types
    PrintCustomWidget(..)                   ,
    IsPrintCustomWidget                     ,
    toPrintCustomWidget                     ,
    noPrintCustomWidget                     ,


 -- * Methods
-- ** getTitle #method:getTitle#

#if ENABLE_OVERLOADING
    PrintCustomWidgetGetTitleMethodInfo     ,
#endif
    printCustomWidgetGetTitle               ,


-- ** getWidget #method:getWidget#

#if ENABLE_OVERLOADING
    PrintCustomWidgetGetWidgetMethodInfo    ,
#endif
    printCustomWidgetGetWidget              ,


-- ** new #method:new#

    printCustomWidgetNew                    ,




 -- * Properties
-- ** title #attr:title#
{- | The title of the custom widget.

/Since: 2.16/
-}
#if ENABLE_OVERLOADING
    PrintCustomWidgetTitlePropertyInfo      ,
#endif
    constructPrintCustomWidgetTitle         ,
    getPrintCustomWidgetTitle               ,
#if ENABLE_OVERLOADING
    printCustomWidgetTitle                  ,
#endif


-- ** widget #attr:widget#
{- | The custom 'GI.Gtk.Objects.Widget.Widget' that will be embedded in the dialog.

/Since: 2.16/
-}
#if ENABLE_OVERLOADING
    PrintCustomWidgetWidgetPropertyInfo     ,
#endif
    constructPrintCustomWidgetWidget        ,
    getPrintCustomWidgetWidget              ,
#if ENABLE_OVERLOADING
    printCustomWidgetWidget                 ,
#endif




 -- * Signals
-- ** apply #signal:apply#

    C_PrintCustomWidgetApplyCallback        ,
    PrintCustomWidgetApplyCallback          ,
#if ENABLE_OVERLOADING
    PrintCustomWidgetApplySignalInfo        ,
#endif
    afterPrintCustomWidgetApply             ,
    genClosure_PrintCustomWidgetApply       ,
    mk_PrintCustomWidgetApplyCallback       ,
    noPrintCustomWidgetApplyCallback        ,
    onPrintCustomWidgetApply                ,
    wrap_PrintCustomWidgetApplyCallback     ,


-- ** update #signal:update#

    C_PrintCustomWidgetUpdateCallback       ,
    PrintCustomWidgetUpdateCallback         ,
#if ENABLE_OVERLOADING
    PrintCustomWidgetUpdateSignalInfo       ,
#endif
    afterPrintCustomWidgetUpdate            ,
    genClosure_PrintCustomWidgetUpdate      ,
    mk_PrintCustomWidgetUpdateCallback      ,
    noPrintCustomWidgetUpdateCallback       ,
    onPrintCustomWidgetUpdate               ,
    wrap_PrintCustomWidgetUpdateCallback    ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Objects.PageSetup as Gtk.PageSetup
import qualified GI.Gtk.Objects.PrintSettings as Gtk.PrintSettings
import qualified GI.Gtk.Objects.Widget as Gtk.Widget

-- | Memory-managed wrapper type.
newtype PrintCustomWidget = PrintCustomWidget (ManagedPtr PrintCustomWidget)
foreign import ccall "webkit_print_custom_widget_get_type"
    c_webkit_print_custom_widget_get_type :: IO GType

instance GObject PrintCustomWidget where
    gobjectType = c_webkit_print_custom_widget_get_type


-- | Type class for types which can be safely cast to `PrintCustomWidget`, for instance with `toPrintCustomWidget`.
class (GObject o, O.IsDescendantOf PrintCustomWidget o) => IsPrintCustomWidget o
instance (GObject o, O.IsDescendantOf PrintCustomWidget o) => IsPrintCustomWidget o

instance O.HasParentTypes PrintCustomWidget
type instance O.ParentTypes PrintCustomWidget = '[GObject.Object.Object]

-- | Cast to `PrintCustomWidget`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toPrintCustomWidget :: (MonadIO m, IsPrintCustomWidget o) => o -> m PrintCustomWidget
toPrintCustomWidget = liftIO . unsafeCastTo PrintCustomWidget

-- | A convenience alias for `Nothing` :: `Maybe` `PrintCustomWidget`.
noPrintCustomWidget :: Maybe PrintCustomWidget
noPrintCustomWidget = Nothing

#if ENABLE_OVERLOADING
type family ResolvePrintCustomWidgetMethod (t :: Symbol) (o :: *) :: * where
    ResolvePrintCustomWidgetMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolvePrintCustomWidgetMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolvePrintCustomWidgetMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolvePrintCustomWidgetMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolvePrintCustomWidgetMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolvePrintCustomWidgetMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolvePrintCustomWidgetMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolvePrintCustomWidgetMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolvePrintCustomWidgetMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolvePrintCustomWidgetMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolvePrintCustomWidgetMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolvePrintCustomWidgetMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolvePrintCustomWidgetMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolvePrintCustomWidgetMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolvePrintCustomWidgetMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolvePrintCustomWidgetMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolvePrintCustomWidgetMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolvePrintCustomWidgetMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolvePrintCustomWidgetMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolvePrintCustomWidgetMethod "getTitle" o = PrintCustomWidgetGetTitleMethodInfo
    ResolvePrintCustomWidgetMethod "getWidget" o = PrintCustomWidgetGetWidgetMethodInfo
    ResolvePrintCustomWidgetMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolvePrintCustomWidgetMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolvePrintCustomWidgetMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolvePrintCustomWidgetMethod t PrintCustomWidget, O.MethodInfo info PrintCustomWidget p) => OL.IsLabel t (PrintCustomWidget -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- signal PrintCustomWidget::apply
{- |
Emitted right before the printing will start. You should read the information
from the widget and update the content based on it if necessary. The widget
is not guaranteed to be valid at a later time.

/Since: 2.16/
-}
type PrintCustomWidgetApplyCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PrintCustomWidgetApplyCallback`@.
noPrintCustomWidgetApplyCallback :: Maybe PrintCustomWidgetApplyCallback
noPrintCustomWidgetApplyCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PrintCustomWidgetApplyCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PrintCustomWidgetApplyCallback`.
foreign import ccall "wrapper"
    mk_PrintCustomWidgetApplyCallback :: C_PrintCustomWidgetApplyCallback -> IO (FunPtr C_PrintCustomWidgetApplyCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PrintCustomWidgetApply :: MonadIO m => PrintCustomWidgetApplyCallback -> m (GClosure C_PrintCustomWidgetApplyCallback)
genClosure_PrintCustomWidgetApply cb = liftIO $ do
    let cb' = wrap_PrintCustomWidgetApplyCallback cb
    mk_PrintCustomWidgetApplyCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PrintCustomWidgetApplyCallback` into a `C_PrintCustomWidgetApplyCallback`.
wrap_PrintCustomWidgetApplyCallback ::
    PrintCustomWidgetApplyCallback ->
    C_PrintCustomWidgetApplyCallback
wrap_PrintCustomWidgetApplyCallback _cb _ _ = do
    _cb


{- |
Connect a signal handler for the “@apply@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' printCustomWidget #apply callback
@
-}
onPrintCustomWidgetApply :: (IsPrintCustomWidget a, MonadIO m) => a -> PrintCustomWidgetApplyCallback -> m SignalHandlerId
onPrintCustomWidgetApply obj cb = liftIO $ do
    let cb' = wrap_PrintCustomWidgetApplyCallback cb
    cb'' <- mk_PrintCustomWidgetApplyCallback cb'
    connectSignalFunPtr obj "apply" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@apply@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' printCustomWidget #apply callback
@
-}
afterPrintCustomWidgetApply :: (IsPrintCustomWidget a, MonadIO m) => a -> PrintCustomWidgetApplyCallback -> m SignalHandlerId
afterPrintCustomWidgetApply obj cb = liftIO $ do
    let cb' = wrap_PrintCustomWidgetApplyCallback cb
    cb'' <- mk_PrintCustomWidgetApplyCallback cb'
    connectSignalFunPtr obj "apply" cb'' SignalConnectAfter


-- signal PrintCustomWidget::update
{- |
Emitted after change of selected printer in the dialog. The actual page setup
and print settings are available and the custom widget can actualize itself
according to their values.

/Since: 2.16/
-}
type PrintCustomWidgetUpdateCallback =
    Gtk.PageSetup.PageSetup
    {- ^ /@pageSetup@/: actual page setup -}
    -> Gtk.PrintSettings.PrintSettings
    {- ^ /@printSettings@/: actual print settings -}
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `PrintCustomWidgetUpdateCallback`@.
noPrintCustomWidgetUpdateCallback :: Maybe PrintCustomWidgetUpdateCallback
noPrintCustomWidgetUpdateCallback = Nothing

-- | Type for the callback on the (unwrapped) C side.
type C_PrintCustomWidgetUpdateCallback =
    Ptr () ->                               -- object
    Ptr Gtk.PageSetup.PageSetup ->
    Ptr Gtk.PrintSettings.PrintSettings ->
    Ptr () ->                               -- user_data
    IO ()

-- | Generate a function pointer callable from C code, from a `C_PrintCustomWidgetUpdateCallback`.
foreign import ccall "wrapper"
    mk_PrintCustomWidgetUpdateCallback :: C_PrintCustomWidgetUpdateCallback -> IO (FunPtr C_PrintCustomWidgetUpdateCallback)

-- | Wrap the callback into a `GClosure`.
genClosure_PrintCustomWidgetUpdate :: MonadIO m => PrintCustomWidgetUpdateCallback -> m (GClosure C_PrintCustomWidgetUpdateCallback)
genClosure_PrintCustomWidgetUpdate cb = liftIO $ do
    let cb' = wrap_PrintCustomWidgetUpdateCallback cb
    mk_PrintCustomWidgetUpdateCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `PrintCustomWidgetUpdateCallback` into a `C_PrintCustomWidgetUpdateCallback`.
wrap_PrintCustomWidgetUpdateCallback ::
    PrintCustomWidgetUpdateCallback ->
    C_PrintCustomWidgetUpdateCallback
wrap_PrintCustomWidgetUpdateCallback _cb _ pageSetup printSettings _ = do
    pageSetup' <- (newObject Gtk.PageSetup.PageSetup) pageSetup
    printSettings' <- (newObject Gtk.PrintSettings.PrintSettings) printSettings
    _cb  pageSetup' printSettings'


{- |
Connect a signal handler for the “@update@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.on' printCustomWidget #update callback
@
-}
onPrintCustomWidgetUpdate :: (IsPrintCustomWidget a, MonadIO m) => a -> PrintCustomWidgetUpdateCallback -> m SignalHandlerId
onPrintCustomWidgetUpdate obj cb = liftIO $ do
    let cb' = wrap_PrintCustomWidgetUpdateCallback cb
    cb'' <- mk_PrintCustomWidgetUpdateCallback cb'
    connectSignalFunPtr obj "update" cb'' SignalConnectBefore

{- |
Connect a signal handler for the “@update@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Signals.after' printCustomWidget #update callback
@
-}
afterPrintCustomWidgetUpdate :: (IsPrintCustomWidget a, MonadIO m) => a -> PrintCustomWidgetUpdateCallback -> m SignalHandlerId
afterPrintCustomWidgetUpdate obj cb = liftIO $ do
    let cb' = wrap_PrintCustomWidgetUpdateCallback cb
    cb'' <- mk_PrintCustomWidgetUpdateCallback cb'
    connectSignalFunPtr obj "update" cb'' SignalConnectAfter


-- VVV Prop "title"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@title@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' printCustomWidget #title
@
-}
getPrintCustomWidgetTitle :: (MonadIO m, IsPrintCustomWidget o) => o -> m T.Text
getPrintCustomWidgetTitle obj = liftIO $ checkUnexpectedNothing "getPrintCustomWidgetTitle" $ B.Properties.getObjectPropertyString obj "title"

{- |
Construct a `GValueConstruct` with valid value for the “@title@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPrintCustomWidgetTitle :: (IsPrintCustomWidget o) => T.Text -> IO (GValueConstruct o)
constructPrintCustomWidgetTitle val = B.Properties.constructObjectPropertyString "title" (Just val)

#if ENABLE_OVERLOADING
data PrintCustomWidgetTitlePropertyInfo
instance AttrInfo PrintCustomWidgetTitlePropertyInfo where
    type AttrAllowedOps PrintCustomWidgetTitlePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint PrintCustomWidgetTitlePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint PrintCustomWidgetTitlePropertyInfo = IsPrintCustomWidget
    type AttrGetType PrintCustomWidgetTitlePropertyInfo = T.Text
    type AttrLabel PrintCustomWidgetTitlePropertyInfo = "title"
    type AttrOrigin PrintCustomWidgetTitlePropertyInfo = PrintCustomWidget
    attrGet _ = getPrintCustomWidgetTitle
    attrSet _ = undefined
    attrConstruct _ = constructPrintCustomWidgetTitle
    attrClear _ = undefined
#endif

-- VVV Prop "widget"
   -- Type: TInterface (Name {namespace = "Gtk", name = "Widget"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just True,Nothing)

{- |
Get the value of the “@widget@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' printCustomWidget #widget
@
-}
getPrintCustomWidgetWidget :: (MonadIO m, IsPrintCustomWidget o) => o -> m (Maybe Gtk.Widget.Widget)
getPrintCustomWidgetWidget obj = liftIO $ B.Properties.getObjectPropertyObject obj "widget" Gtk.Widget.Widget

{- |
Construct a `GValueConstruct` with valid value for the “@widget@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPrintCustomWidgetWidget :: (IsPrintCustomWidget o, Gtk.Widget.IsWidget a) => a -> IO (GValueConstruct o)
constructPrintCustomWidgetWidget val = B.Properties.constructObjectPropertyObject "widget" (Just val)

#if ENABLE_OVERLOADING
data PrintCustomWidgetWidgetPropertyInfo
instance AttrInfo PrintCustomWidgetWidgetPropertyInfo where
    type AttrAllowedOps PrintCustomWidgetWidgetPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint PrintCustomWidgetWidgetPropertyInfo = Gtk.Widget.IsWidget
    type AttrBaseTypeConstraint PrintCustomWidgetWidgetPropertyInfo = IsPrintCustomWidget
    type AttrGetType PrintCustomWidgetWidgetPropertyInfo = (Maybe Gtk.Widget.Widget)
    type AttrLabel PrintCustomWidgetWidgetPropertyInfo = "widget"
    type AttrOrigin PrintCustomWidgetWidgetPropertyInfo = PrintCustomWidget
    attrGet _ = getPrintCustomWidgetWidget
    attrSet _ = undefined
    attrConstruct _ = constructPrintCustomWidgetWidget
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList PrintCustomWidget
type instance O.AttributeList PrintCustomWidget = PrintCustomWidgetAttributeList
type PrintCustomWidgetAttributeList = ('[ '("title", PrintCustomWidgetTitlePropertyInfo), '("widget", PrintCustomWidgetWidgetPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
printCustomWidgetTitle :: AttrLabelProxy "title"
printCustomWidgetTitle = AttrLabelProxy

printCustomWidgetWidget :: AttrLabelProxy "widget"
printCustomWidgetWidget = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
data PrintCustomWidgetApplySignalInfo
instance SignalInfo PrintCustomWidgetApplySignalInfo where
    type HaskellCallbackType PrintCustomWidgetApplySignalInfo = PrintCustomWidgetApplyCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PrintCustomWidgetApplyCallback cb
        cb'' <- mk_PrintCustomWidgetApplyCallback cb'
        connectSignalFunPtr obj "apply" cb'' connectMode

data PrintCustomWidgetUpdateSignalInfo
instance SignalInfo PrintCustomWidgetUpdateSignalInfo where
    type HaskellCallbackType PrintCustomWidgetUpdateSignalInfo = PrintCustomWidgetUpdateCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_PrintCustomWidgetUpdateCallback cb
        cb'' <- mk_PrintCustomWidgetUpdateCallback cb'
        connectSignalFunPtr obj "update" cb'' connectMode

type instance O.SignalList PrintCustomWidget = PrintCustomWidgetSignalList
type PrintCustomWidgetSignalList = ('[ '("apply", PrintCustomWidgetApplySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("update", PrintCustomWidgetUpdateSignalInfo)] :: [(Symbol, *)])

#endif

-- method PrintCustomWidget::new
-- method type : Constructor
-- Args : [Arg {argCName = "widget", argType = TInterface (Name {namespace = "Gtk", name = "Widget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GtkWidget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "title", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a @widget's title", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2", name = "PrintCustomWidget"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_custom_widget_new" webkit_print_custom_widget_new ::
    Ptr Gtk.Widget.Widget ->                -- widget : TInterface (Name {namespace = "Gtk", name = "Widget"})
    CString ->                              -- title : TBasicType TUTF8
    IO (Ptr PrintCustomWidget)

{- |
Create a new 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget' with given /@widget@/ and /@title@/. The /@widget@/
ownership is taken and it is destroyed together with the dialog even if this
object could still be alive at that point. You typically want to pass a container
widget with multiple widgets in it.

/Since: 2.16/
-}
printCustomWidgetNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.Widget.IsWidget a) =>
    a
    {- ^ /@widget@/: a 'GI.Gtk.Objects.Widget.Widget' -}
    -> T.Text
    {- ^ /@title@/: a /@widget@/\'s title -}
    -> m PrintCustomWidget
    {- ^ __Returns:__ a new 'GI.WebKit2.Objects.PrintOperation.PrintOperation'. -}
printCustomWidgetNew widget title = liftIO $ do
    widget' <- unsafeManagedPtrCastPtr widget
    title' <- textToCString title
    result <- webkit_print_custom_widget_new widget' title'
    checkUnexpectedReturnNULL "printCustomWidgetNew" result
    result' <- (wrapObject PrintCustomWidget) result
    touchManagedPtr widget
    freeMem title'
    return result'

#if ENABLE_OVERLOADING
#endif

-- method PrintCustomWidget::get_title
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_custom_widget", argType = TInterface (Name {namespace = "WebKit2", name = "PrintCustomWidget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintCustomWidget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_custom_widget_get_title" webkit_print_custom_widget_get_title ::
    Ptr PrintCustomWidget ->                -- print_custom_widget : TInterface (Name {namespace = "WebKit2", name = "PrintCustomWidget"})
    IO CString

{- |
Return the value of 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget':@/title/@ property for the given
/@printCustomWidget@/ object.

/Since: 2.16/
-}
printCustomWidgetGetTitle ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintCustomWidget a) =>
    a
    {- ^ /@printCustomWidget@/: a 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget' -}
    -> m T.Text
    {- ^ __Returns:__ Title of the /@printCustomWidget@/. -}
printCustomWidgetGetTitle printCustomWidget = liftIO $ do
    printCustomWidget' <- unsafeManagedPtrCastPtr printCustomWidget
    result <- webkit_print_custom_widget_get_title printCustomWidget'
    checkUnexpectedReturnNULL "printCustomWidgetGetTitle" result
    result' <- cstringToText result
    touchManagedPtr printCustomWidget
    return result'

#if ENABLE_OVERLOADING
data PrintCustomWidgetGetTitleMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsPrintCustomWidget a) => O.MethodInfo PrintCustomWidgetGetTitleMethodInfo a signature where
    overloadedMethod _ = printCustomWidgetGetTitle

#endif

-- method PrintCustomWidget::get_widget
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "print_custom_widget", argType = TInterface (Name {namespace = "WebKit2", name = "PrintCustomWidget"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitPrintCustomWidget", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gtk", name = "Widget"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_print_custom_widget_get_widget" webkit_print_custom_widget_get_widget ::
    Ptr PrintCustomWidget ->                -- print_custom_widget : TInterface (Name {namespace = "WebKit2", name = "PrintCustomWidget"})
    IO (Ptr Gtk.Widget.Widget)

{- |
Return the value of 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget':@/widget/@ property for the given
/@printCustomWidget@/ object. The returned value will always be valid if called
from 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget'::@/apply/@ or 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget'::@/update/@
callbacks, but it will be 'Nothing' if called after the
'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget'::@/apply/@ signal is emitted.

/Since: 2.16/
-}
printCustomWidgetGetWidget ::
    (B.CallStack.HasCallStack, MonadIO m, IsPrintCustomWidget a) =>
    a
    {- ^ /@printCustomWidget@/: a 'GI.WebKit2.Objects.PrintCustomWidget.PrintCustomWidget' -}
    -> m (Maybe Gtk.Widget.Widget)
    {- ^ __Returns:__ a 'GI.Gtk.Objects.Widget.Widget'. -}
printCustomWidgetGetWidget printCustomWidget = liftIO $ do
    printCustomWidget' <- unsafeManagedPtrCastPtr printCustomWidget
    result <- webkit_print_custom_widget_get_widget printCustomWidget'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Gtk.Widget.Widget) result'
        return result''
    touchManagedPtr printCustomWidget
    return maybeResult

#if ENABLE_OVERLOADING
data PrintCustomWidgetGetWidgetMethodInfo
instance (signature ~ (m (Maybe Gtk.Widget.Widget)), MonadIO m, IsPrintCustomWidget a) => O.MethodInfo PrintCustomWidgetGetWidgetMethodInfo a signature where
    overloadedMethod _ = printCustomWidgetGetWidget

#endif