{- |
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.Gdk.Objects.AppLaunchContext
    ( 

-- * Exported types
    AppLaunchContext(..)                    ,
    AppLaunchContextK                       ,
    toAppLaunchContext                      ,
    noAppLaunchContext                      ,


 -- * Methods
-- ** appLaunchContextNew
    appLaunchContextNew                     ,


-- ** appLaunchContextSetDesktop
    appLaunchContextSetDesktop              ,


-- ** appLaunchContextSetDisplay
    appLaunchContextSetDisplay              ,


-- ** appLaunchContextSetIcon
    appLaunchContextSetIcon                 ,


-- ** appLaunchContextSetIconName
    appLaunchContextSetIconName             ,


-- ** appLaunchContextSetScreen
    appLaunchContextSetScreen               ,


-- ** appLaunchContextSetTimestamp
    appLaunchContextSetTimestamp            ,




 -- * Properties
-- ** Display
    AppLaunchContextDisplayPropertyInfo     ,
    constructAppLaunchContextDisplay        ,
    getAppLaunchContextDisplay              ,




    ) 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.Gdk.Types
import GI.Gdk.Callbacks
import qualified GI.GObject as GObject
import qualified GI.Gio as Gio

newtype AppLaunchContext = AppLaunchContext (ForeignPtr AppLaunchContext)
foreign import ccall "gdk_app_launch_context_get_type"
    c_gdk_app_launch_context_get_type :: IO GType

type instance ParentTypes AppLaunchContext = AppLaunchContextParentTypes
type AppLaunchContextParentTypes = '[Gio.AppLaunchContext, GObject.Object]

instance GObject AppLaunchContext where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gdk_app_launch_context_get_type
    

class GObject o => AppLaunchContextK o
instance (GObject o, IsDescendantOf AppLaunchContext o) => AppLaunchContextK o

toAppLaunchContext :: AppLaunchContextK o => o -> IO AppLaunchContext
toAppLaunchContext = unsafeCastTo AppLaunchContext

noAppLaunchContext :: Maybe AppLaunchContext
noAppLaunchContext = Nothing

-- VVV Prop "display"
   -- Type: TInterface "Gdk" "Display"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getAppLaunchContextDisplay :: (MonadIO m, AppLaunchContextK o) => o -> m Display
getAppLaunchContextDisplay obj = liftIO $ getObjectPropertyObject obj "display" Display

constructAppLaunchContextDisplay :: (DisplayK a) => a -> IO ([Char], GValue)
constructAppLaunchContextDisplay val = constructObjectPropertyObject "display" val

data AppLaunchContextDisplayPropertyInfo
instance AttrInfo AppLaunchContextDisplayPropertyInfo where
    type AttrAllowedOps AppLaunchContextDisplayPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint AppLaunchContextDisplayPropertyInfo = DisplayK
    type AttrBaseTypeConstraint AppLaunchContextDisplayPropertyInfo = AppLaunchContextK
    type AttrGetType AppLaunchContextDisplayPropertyInfo = Display
    type AttrLabel AppLaunchContextDisplayPropertyInfo = "AppLaunchContext::display"
    attrGet _ = getAppLaunchContextDisplay
    attrSet _ = undefined
    attrConstruct _ = constructAppLaunchContextDisplay

type instance AttributeList AppLaunchContext = AppLaunchContextAttributeList
type AppLaunchContextAttributeList = ('[ '("display", AppLaunchContextDisplayPropertyInfo)] :: [(Symbol, *)])

type instance SignalList AppLaunchContext = AppLaunchContextSignalList
type AppLaunchContextSignalList = ('[ '("launch-failed", Gio.AppLaunchContextLaunchFailedSignalInfo), '("launched", Gio.AppLaunchContextLaunchedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method AppLaunchContext::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gdk" "AppLaunchContext"
-- throws : False
-- Skip return : False

foreign import ccall "gdk_app_launch_context_new" gdk_app_launch_context_new :: 
    IO (Ptr AppLaunchContext)

{-# DEPRECATED appLaunchContextNew ["(Since version 3.0)","Use gdk_display_get_app_launch_context() instead"]#-}
appLaunchContextNew ::
    (MonadIO m) =>
    m AppLaunchContext
appLaunchContextNew  = liftIO $ do
    result <- gdk_app_launch_context_new
    checkUnexpectedReturnNULL "gdk_app_launch_context_new" result
    result' <- (wrapObject AppLaunchContext) result
    return result'

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

foreign import ccall "gdk_app_launch_context_set_desktop" gdk_app_launch_context_set_desktop :: 
    Ptr AppLaunchContext ->                 -- _obj : TInterface "Gdk" "AppLaunchContext"
    Int32 ->                                -- desktop : TBasicType TInt32
    IO ()


appLaunchContextSetDesktop ::
    (MonadIO m, AppLaunchContextK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- desktop
    m ()
appLaunchContextSetDesktop _obj desktop = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_app_launch_context_set_desktop _obj' desktop
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gdk_app_launch_context_set_display" gdk_app_launch_context_set_display :: 
    Ptr AppLaunchContext ->                 -- _obj : TInterface "Gdk" "AppLaunchContext"
    Ptr Display ->                          -- display : TInterface "Gdk" "Display"
    IO ()

{-# DEPRECATED appLaunchContextSetDisplay ["(Since version 3.0)","Use gdk_display_get_app_launch_context() instead"]#-}
appLaunchContextSetDisplay ::
    (MonadIO m, AppLaunchContextK a, DisplayK b) =>
    a ->                                    -- _obj
    b ->                                    -- display
    m ()
appLaunchContextSetDisplay _obj display = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let display' = unsafeManagedPtrCastPtr display
    gdk_app_launch_context_set_display _obj' display'
    touchManagedPtr _obj
    touchManagedPtr display
    return ()

-- method AppLaunchContext::set_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gdk" "AppLaunchContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gdk" "AppLaunchContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gdk_app_launch_context_set_icon" gdk_app_launch_context_set_icon :: 
    Ptr AppLaunchContext ->                 -- _obj : TInterface "Gdk" "AppLaunchContext"
    Ptr Gio.Icon ->                         -- icon : TInterface "Gio" "Icon"
    IO ()


appLaunchContextSetIcon ::
    (MonadIO m, AppLaunchContextK a, Gio.IconK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- icon
    m ()
appLaunchContextSetIcon _obj icon = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeIcon <- case icon of
        Nothing -> return nullPtr
        Just jIcon -> do
            let jIcon' = unsafeManagedPtrCastPtr jIcon
            return jIcon'
    gdk_app_launch_context_set_icon _obj' maybeIcon
    touchManagedPtr _obj
    whenJust icon touchManagedPtr
    return ()

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

foreign import ccall "gdk_app_launch_context_set_icon_name" gdk_app_launch_context_set_icon_name :: 
    Ptr AppLaunchContext ->                 -- _obj : TInterface "Gdk" "AppLaunchContext"
    CString ->                              -- icon_name : TBasicType TUTF8
    IO ()


appLaunchContextSetIconName ::
    (MonadIO m, AppLaunchContextK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- icon_name
    m ()
appLaunchContextSetIconName _obj icon_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeIcon_name <- case icon_name of
        Nothing -> return nullPtr
        Just jIcon_name -> do
            jIcon_name' <- textToCString jIcon_name
            return jIcon_name'
    gdk_app_launch_context_set_icon_name _obj' maybeIcon_name
    touchManagedPtr _obj
    freeMem maybeIcon_name
    return ()

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

foreign import ccall "gdk_app_launch_context_set_screen" gdk_app_launch_context_set_screen :: 
    Ptr AppLaunchContext ->                 -- _obj : TInterface "Gdk" "AppLaunchContext"
    Ptr Screen ->                           -- screen : TInterface "Gdk" "Screen"
    IO ()


appLaunchContextSetScreen ::
    (MonadIO m, AppLaunchContextK a, ScreenK b) =>
    a ->                                    -- _obj
    b ->                                    -- screen
    m ()
appLaunchContextSetScreen _obj screen = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let screen' = unsafeManagedPtrCastPtr screen
    gdk_app_launch_context_set_screen _obj' screen'
    touchManagedPtr _obj
    touchManagedPtr screen
    return ()

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

foreign import ccall "gdk_app_launch_context_set_timestamp" gdk_app_launch_context_set_timestamp :: 
    Ptr AppLaunchContext ->                 -- _obj : TInterface "Gdk" "AppLaunchContext"
    Word32 ->                               -- timestamp : TBasicType TUInt32
    IO ()


appLaunchContextSetTimestamp ::
    (MonadIO m, AppLaunchContextK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- timestamp
    m ()
appLaunchContextSetTimestamp _obj timestamp = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gdk_app_launch_context_set_timestamp _obj' timestamp
    touchManagedPtr _obj
    return ()