{- |
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.Interfaces.Activatable
    ( 

-- * Exported types
    Activatable(..)                         ,
    noActivatable                           ,
    ActivatableK                            ,
    toActivatable                           ,


 -- * Methods
-- ** activatableDoSetRelatedAction
    activatableDoSetRelatedAction           ,


-- ** activatableGetRelatedAction
    activatableGetRelatedAction             ,


-- ** activatableGetUseActionAppearance
    activatableGetUseActionAppearance       ,


-- ** activatableSetRelatedAction
    activatableSetRelatedAction             ,


-- ** activatableSetUseActionAppearance
    activatableSetUseActionAppearance       ,


-- ** activatableSyncActionProperties
    activatableSyncActionProperties         ,




 -- * Properties
-- ** RelatedAction
    ActivatableRelatedActionPropertyInfo    ,
    constructActivatableRelatedAction       ,
    getActivatableRelatedAction             ,
    setActivatableRelatedAction             ,


-- ** UseActionAppearance
    ActivatableUseActionAppearancePropertyInfo,
    constructActivatableUseActionAppearance ,
    getActivatableUseActionAppearance       ,
    setActivatableUseActionAppearance       ,




    ) 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.GObject as GObject

-- interface Activatable 

newtype Activatable = Activatable (ForeignPtr Activatable)
noActivatable :: Maybe Activatable
noActivatable = Nothing

-- VVV Prop "related-action"
   -- Type: TInterface "Gtk" "Action"
   -- Flags: [PropertyReadable,PropertyWritable]

getActivatableRelatedAction :: (MonadIO m, ActivatableK o) => o -> m Action
getActivatableRelatedAction obj = liftIO $ getObjectPropertyObject obj "related-action" Action

setActivatableRelatedAction :: (MonadIO m, ActivatableK o, ActionK a) => o -> a -> m ()
setActivatableRelatedAction obj val = liftIO $ setObjectPropertyObject obj "related-action" val

constructActivatableRelatedAction :: (ActionK a) => a -> IO ([Char], GValue)
constructActivatableRelatedAction val = constructObjectPropertyObject "related-action" val

data ActivatableRelatedActionPropertyInfo
instance AttrInfo ActivatableRelatedActionPropertyInfo where
    type AttrAllowedOps ActivatableRelatedActionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ActivatableRelatedActionPropertyInfo = ActionK
    type AttrBaseTypeConstraint ActivatableRelatedActionPropertyInfo = ActivatableK
    type AttrGetType ActivatableRelatedActionPropertyInfo = Action
    type AttrLabel ActivatableRelatedActionPropertyInfo = "Activatable::related-action"
    attrGet _ = getActivatableRelatedAction
    attrSet _ = setActivatableRelatedAction
    attrConstruct _ = constructActivatableRelatedAction

-- VVV Prop "use-action-appearance"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getActivatableUseActionAppearance :: (MonadIO m, ActivatableK o) => o -> m Bool
getActivatableUseActionAppearance obj = liftIO $ getObjectPropertyBool obj "use-action-appearance"

setActivatableUseActionAppearance :: (MonadIO m, ActivatableK o) => o -> Bool -> m ()
setActivatableUseActionAppearance obj val = liftIO $ setObjectPropertyBool obj "use-action-appearance" val

constructActivatableUseActionAppearance :: Bool -> IO ([Char], GValue)
constructActivatableUseActionAppearance val = constructObjectPropertyBool "use-action-appearance" val

data ActivatableUseActionAppearancePropertyInfo
instance AttrInfo ActivatableUseActionAppearancePropertyInfo where
    type AttrAllowedOps ActivatableUseActionAppearancePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint ActivatableUseActionAppearancePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint ActivatableUseActionAppearancePropertyInfo = ActivatableK
    type AttrGetType ActivatableUseActionAppearancePropertyInfo = Bool
    type AttrLabel ActivatableUseActionAppearancePropertyInfo = "Activatable::use-action-appearance"
    attrGet _ = getActivatableUseActionAppearance
    attrSet _ = setActivatableUseActionAppearance
    attrConstruct _ = constructActivatableUseActionAppearance

type instance AttributeList Activatable = ActivatableAttributeList
type ActivatableAttributeList = ('[ '("related-action", ActivatableRelatedActionPropertyInfo), '("use-action-appearance", ActivatableUseActionAppearancePropertyInfo)] :: [(Symbol, *)])

type instance SignalList Activatable = ActivatableSignalList
type ActivatableSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

foreign import ccall "gtk_activatable_get_type"
    c_gtk_activatable_get_type :: IO GType

type instance ParentTypes Activatable = ActivatableParentTypes
type ActivatableParentTypes = '[GObject.Object]

instance GObject Activatable where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_activatable_get_type
    

class GObject o => ActivatableK o
instance (GObject o, IsDescendantOf Activatable o) => ActivatableK o

toActivatable :: ActivatableK o => o -> IO Activatable
toActivatable = unsafeCastTo Activatable

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

foreign import ccall "gtk_activatable_do_set_related_action" gtk_activatable_do_set_related_action :: 
    Ptr Activatable ->                      -- _obj : TInterface "Gtk" "Activatable"
    Ptr Action ->                           -- action : TInterface "Gtk" "Action"
    IO ()

{-# DEPRECATED activatableDoSetRelatedAction ["(Since version 3.10)"]#-}
activatableDoSetRelatedAction ::
    (MonadIO m, ActivatableK a, ActionK b) =>
    a ->                                    -- _obj
    b ->                                    -- action
    m ()
activatableDoSetRelatedAction _obj action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let action' = unsafeManagedPtrCastPtr action
    gtk_activatable_do_set_related_action _obj' action'
    touchManagedPtr _obj
    touchManagedPtr action
    return ()

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

foreign import ccall "gtk_activatable_get_related_action" gtk_activatable_get_related_action :: 
    Ptr Activatable ->                      -- _obj : TInterface "Gtk" "Activatable"
    IO (Ptr Action)

{-# DEPRECATED activatableGetRelatedAction ["(Since version 3.10)"]#-}
activatableGetRelatedAction ::
    (MonadIO m, ActivatableK a) =>
    a ->                                    -- _obj
    m Action
activatableGetRelatedAction _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_activatable_get_related_action _obj'
    checkUnexpectedReturnNULL "gtk_activatable_get_related_action" result
    result' <- (newObject Action) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_activatable_get_use_action_appearance" gtk_activatable_get_use_action_appearance :: 
    Ptr Activatable ->                      -- _obj : TInterface "Gtk" "Activatable"
    IO CInt

{-# DEPRECATED activatableGetUseActionAppearance ["(Since version 3.10)"]#-}
activatableGetUseActionAppearance ::
    (MonadIO m, ActivatableK a) =>
    a ->                                    -- _obj
    m Bool
activatableGetUseActionAppearance _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_activatable_get_use_action_appearance _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_activatable_set_related_action" gtk_activatable_set_related_action :: 
    Ptr Activatable ->                      -- _obj : TInterface "Gtk" "Activatable"
    Ptr Action ->                           -- action : TInterface "Gtk" "Action"
    IO ()

{-# DEPRECATED activatableSetRelatedAction ["(Since version 3.10)"]#-}
activatableSetRelatedAction ::
    (MonadIO m, ActivatableK a, ActionK b) =>
    a ->                                    -- _obj
    b ->                                    -- action
    m ()
activatableSetRelatedAction _obj action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let action' = unsafeManagedPtrCastPtr action
    gtk_activatable_set_related_action _obj' action'
    touchManagedPtr _obj
    touchManagedPtr action
    return ()

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

foreign import ccall "gtk_activatable_set_use_action_appearance" gtk_activatable_set_use_action_appearance :: 
    Ptr Activatable ->                      -- _obj : TInterface "Gtk" "Activatable"
    CInt ->                                 -- use_appearance : TBasicType TBoolean
    IO ()

{-# DEPRECATED activatableSetUseActionAppearance ["(Since version 3.10)"]#-}
activatableSetUseActionAppearance ::
    (MonadIO m, ActivatableK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- use_appearance
    m ()
activatableSetUseActionAppearance _obj use_appearance = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let use_appearance' = (fromIntegral . fromEnum) use_appearance
    gtk_activatable_set_use_action_appearance _obj' use_appearance'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "gtk_activatable_sync_action_properties" gtk_activatable_sync_action_properties :: 
    Ptr Activatable ->                      -- _obj : TInterface "Gtk" "Activatable"
    Ptr Action ->                           -- action : TInterface "Gtk" "Action"
    IO ()

{-# DEPRECATED activatableSyncActionProperties ["(Since version 3.10)"]#-}
activatableSyncActionProperties ::
    (MonadIO m, ActivatableK a, ActionK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- action
    m ()
activatableSyncActionProperties _obj action = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeAction <- case action of
        Nothing -> return nullPtr
        Just jAction -> do
            let jAction' = unsafeManagedPtrCastPtr jAction
            return jAction'
    gtk_activatable_sync_action_properties _obj' maybeAction
    touchManagedPtr _obj
    whenJust action touchManagedPtr
    return ()