{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gtk.Structs.SelectionData
    ( 

-- * Exported types
    SelectionData(..)                       ,
    noSelectionData                         ,


 -- * Methods
-- ** selectionDataCopy
    selectionDataCopy                       ,


-- ** selectionDataFree
    selectionDataFree                       ,


-- ** selectionDataGetData
    selectionDataGetData                    ,


-- ** selectionDataGetDataType
    selectionDataGetDataType                ,


-- ** selectionDataGetDisplay
    selectionDataGetDisplay                 ,


-- ** selectionDataGetFormat
    selectionDataGetFormat                  ,


-- ** selectionDataGetLength
    selectionDataGetLength                  ,


-- ** selectionDataGetPixbuf
    selectionDataGetPixbuf                  ,


-- ** selectionDataGetSelection
    selectionDataGetSelection               ,


-- ** selectionDataGetTarget
    selectionDataGetTarget                  ,


-- ** selectionDataGetTargets
    selectionDataGetTargets                 ,


-- ** selectionDataGetText
    selectionDataGetText                    ,


-- ** selectionDataGetUris
    selectionDataGetUris                    ,


-- ** selectionDataSet
    selectionDataSet                        ,


-- ** selectionDataSetPixbuf
    selectionDataSetPixbuf                  ,


-- ** selectionDataSetText
    selectionDataSetText                    ,


-- ** selectionDataSetUris
    selectionDataSetUris                    ,


-- ** selectionDataTargetsIncludeImage
    selectionDataTargetsIncludeImage        ,


-- ** selectionDataTargetsIncludeRichText
    selectionDataTargetsIncludeRichText     ,


-- ** selectionDataTargetsIncludeText
    selectionDataTargetsIncludeText         ,


-- ** selectionDataTargetsIncludeUri
    selectionDataTargetsIncludeUri          ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.Gdk as Gdk
import qualified GI.GdkPixbuf as GdkPixbuf

newtype SelectionData = SelectionData (ForeignPtr SelectionData)
foreign import ccall "gtk_selection_data_get_type" c_gtk_selection_data_get_type :: 
    IO GType

instance BoxedObject SelectionData where
    boxedType _ = c_gtk_selection_data_get_type

noSelectionData :: Maybe SelectionData
noSelectionData = Nothing

-- method SelectionData::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "SelectionData"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_copy" gtk_selection_data_copy :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr SelectionData)


selectionDataCopy ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m SelectionData
selectionDataCopy _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_copy _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_copy" result
    result' <- (wrapBoxed SelectionData) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_free" gtk_selection_data_free :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO ()


selectionDataFree ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m ()
selectionDataFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    gtk_selection_data_free _obj'
    touchManagedPtr _obj
    return ()

-- method SelectionData::get_data_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Atom"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_data_type" gtk_selection_data_get_data_type :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr Gdk.Atom)


selectionDataGetDataType ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Gdk.Atom
selectionDataGetDataType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_data_type _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_data_type" result
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    result' <- (\x -> Gdk.Atom <$> newForeignPtr_ x) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::get_data
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray False (-1) 1 (TBasicType TUInt8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_data_with_length" gtk_selection_data_get_data_with_length :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    Ptr Int32 ->                            -- length : TBasicType TInt32
    IO (Ptr Word8)


selectionDataGetData ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m ByteString
selectionDataGetData _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    length_ <- allocMem :: IO (Ptr Int32)
    result <- gtk_selection_data_get_data_with_length _obj' length_
    length_' <- peek length_
    checkUnexpectedReturnNULL "gtk_selection_data_get_data_with_length" result
    result' <- (unpackByteStringWithLength length_') result
    touchManagedPtr _obj
    freeMem length_
    return result'

-- method SelectionData::get_display
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Display"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_display" gtk_selection_data_get_display :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr Gdk.Display)


selectionDataGetDisplay ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Gdk.Display
selectionDataGetDisplay _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_display _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_display" result
    result' <- (newObject Gdk.Display) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::get_format
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_format" gtk_selection_data_get_format :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO Int32


selectionDataGetFormat ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Int32
selectionDataGetFormat _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_format _obj'
    touchManagedPtr _obj
    return result

-- method SelectionData::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_length" gtk_selection_data_get_length :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO Int32


selectionDataGetLength ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Int32
selectionDataGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_length _obj'
    touchManagedPtr _obj
    return result

-- method SelectionData::get_pixbuf
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GdkPixbuf" "Pixbuf"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_pixbuf" gtk_selection_data_get_pixbuf :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr GdkPixbuf.Pixbuf)


selectionDataGetPixbuf ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m GdkPixbuf.Pixbuf
selectionDataGetPixbuf _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_pixbuf _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_pixbuf" result
    result' <- (wrapObject GdkPixbuf.Pixbuf) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::get_selection
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Atom"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_selection" gtk_selection_data_get_selection :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr Gdk.Atom)


selectionDataGetSelection ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Gdk.Atom
selectionDataGetSelection _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_selection _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_selection" result
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    result' <- (\x -> Gdk.Atom <$> newForeignPtr_ x) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::get_target
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gdk" "Atom"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_target" gtk_selection_data_get_target :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr Gdk.Atom)


selectionDataGetTarget ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Gdk.Atom
selectionDataGetTarget _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_target _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_target" result
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    result' <- (\x -> Gdk.Atom <$> newForeignPtr_ x) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::get_targets
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "targets", argType = TCArray False (-1) 2 (TInterface "Gdk" "Atom"), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferContainer},Arg {argName = "n_atoms", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "n_atoms", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_targets" gtk_selection_data_get_targets :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    Ptr (Ptr (Ptr Gdk.Atom)) ->             -- targets : TCArray False (-1) 2 (TInterface "Gdk" "Atom")
    Ptr Int32 ->                            -- n_atoms : TBasicType TInt32
    IO CInt


selectionDataGetTargets ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m (Bool,[Gdk.Atom])
selectionDataGetTargets _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    targets <- allocMem :: IO (Ptr (Ptr (Ptr Gdk.Atom)))
    n_atoms <- allocMem :: IO (Ptr Int32)
    result <- gtk_selection_data_get_targets _obj' targets n_atoms
    n_atoms' <- peek n_atoms
    let result' = (/= 0) result
    targets' <- peek targets
    -- XXX Wrapping a foreign struct/union with no known destructor, leak?
    targets'' <- (unpackPtrArrayWithLength n_atoms') targets'
    targets''' <- mapM (\x -> Gdk.Atom <$> newForeignPtr_ x) targets''
    freeMem targets'
    touchManagedPtr _obj
    freeMem targets
    freeMem n_atoms
    return (result', targets''')

-- method SelectionData::get_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_text" gtk_selection_data_get_text :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO CString


selectionDataGetText ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m T.Text
selectionDataGetText _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_text _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_text" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method SelectionData::get_uris
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_get_uris" gtk_selection_data_get_uris :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO (Ptr CString)


selectionDataGetUris ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m [T.Text]
selectionDataGetUris _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_get_uris _obj'
    checkUnexpectedReturnNULL "gtk_selection_data_get_uris" result
    result' <- unpackZeroTerminatedUTF8CArray result
    mapZeroTerminatedCArray freeMem result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method SelectionData::set
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "format", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "length", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "type", argType = TInterface "Gdk" "Atom", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "format", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "data", argType = TCArray False (-1) 4 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_set" gtk_selection_data_set :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    Ptr Gdk.Atom ->                         -- type : TInterface "Gdk" "Atom"
    Int32 ->                                -- format : TBasicType TInt32
    Ptr Word8 ->                            -- data : TCArray False (-1) 4 (TBasicType TUInt8)
    Int32 ->                                -- length : TBasicType TInt32
    IO ()


selectionDataSet ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    Gdk.Atom ->                             -- type
    Int32 ->                                -- format
    ByteString ->                           -- data
    m ()
selectionDataSet _obj type_ format data_ = liftIO $ do
    let length_ = fromIntegral $ B.length data_
    let _obj' = unsafeManagedPtrGetPtr _obj
    let type_' = unsafeManagedPtrGetPtr type_
    data_' <- packByteString data_
    gtk_selection_data_set _obj' type_' format data_' length_
    touchManagedPtr _obj
    touchManagedPtr type_
    freeMem data_'
    return ()

-- method SelectionData::set_pixbuf
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_set_pixbuf" gtk_selection_data_set_pixbuf :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    Ptr GdkPixbuf.Pixbuf ->                 -- pixbuf : TInterface "GdkPixbuf" "Pixbuf"
    IO CInt


selectionDataSetPixbuf ::
    (MonadIO m, GdkPixbuf.PixbufK a) =>
    SelectionData ->                        -- _obj
    a ->                                    -- pixbuf
    m Bool
selectionDataSetPixbuf _obj pixbuf = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let pixbuf' = unsafeManagedPtrCastPtr pixbuf
    result <- gtk_selection_data_set_pixbuf _obj' pixbuf'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr pixbuf
    return result'

-- method SelectionData::set_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "str", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "len", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_set_text" gtk_selection_data_set_text :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    CString ->                              -- str : TBasicType TUTF8
    Int32 ->                                -- len : TBasicType TInt32
    IO CInt


selectionDataSetText ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    T.Text ->                               -- str
    Int32 ->                                -- len
    m Bool
selectionDataSetText _obj str len = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    str' <- textToCString str
    result <- gtk_selection_data_set_text _obj' str' len
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem str'
    return result'

-- method SelectionData::set_uris
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uris", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "uris", argType = TCArray True (-1) (-1) (TBasicType TUTF8), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_set_uris" gtk_selection_data_set_uris :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    Ptr CString ->                          -- uris : TCArray True (-1) (-1) (TBasicType TUTF8)
    IO CInt


selectionDataSetUris ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    [T.Text] ->                             -- uris
    m Bool
selectionDataSetUris _obj uris = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    uris' <- packZeroTerminatedUTF8CArray uris
    result <- gtk_selection_data_set_uris _obj' uris'
    let result' = (/= 0) result
    touchManagedPtr _obj
    mapZeroTerminatedCArray freeMem uris'
    freeMem uris'
    return result'

-- method SelectionData::targets_include_image
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "writable", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "writable", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_targets_include_image" gtk_selection_data_targets_include_image :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    CInt ->                                 -- writable : TBasicType TBoolean
    IO CInt


selectionDataTargetsIncludeImage ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    Bool ->                                 -- writable
    m Bool
selectionDataTargetsIncludeImage _obj writable = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let writable' = (fromIntegral . fromEnum) writable
    result <- gtk_selection_data_targets_include_image _obj' writable'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::targets_include_rich_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer", argType = TInterface "Gtk" "TextBuffer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "buffer", argType = TInterface "Gtk" "TextBuffer", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_targets_include_rich_text" gtk_selection_data_targets_include_rich_text :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    Ptr TextBuffer ->                       -- buffer : TInterface "Gtk" "TextBuffer"
    IO CInt


selectionDataTargetsIncludeRichText ::
    (MonadIO m, TextBufferK a) =>
    SelectionData ->                        -- _obj
    a ->                                    -- buffer
    m Bool
selectionDataTargetsIncludeRichText _obj buffer = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    let buffer' = unsafeManagedPtrCastPtr buffer
    result <- gtk_selection_data_targets_include_rich_text _obj' buffer'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr buffer
    return result'

-- method SelectionData::targets_include_text
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_targets_include_text" gtk_selection_data_targets_include_text :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO CInt


selectionDataTargetsIncludeText ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Bool
selectionDataTargetsIncludeText _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_targets_include_text _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method SelectionData::targets_include_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "SelectionData", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_selection_data_targets_include_uri" gtk_selection_data_targets_include_uri :: 
    Ptr SelectionData ->                    -- _obj : TInterface "Gtk" "SelectionData"
    IO CInt


selectionDataTargetsIncludeUri ::
    (MonadIO m) =>
    SelectionData ->                        -- _obj
    m Bool
selectionDataTargetsIncludeUri _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- gtk_selection_data_targets_include_uri _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'