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

-- * Exported types
    GestureSingle(..)                       ,
    GestureSingleK                          ,
    toGestureSingle                         ,
    noGestureSingle                         ,


 -- * Methods
-- ** gestureSingleGetButton
    gestureSingleGetButton                  ,


-- ** gestureSingleGetCurrentButton
    gestureSingleGetCurrentButton           ,


-- ** gestureSingleGetCurrentSequence
    gestureSingleGetCurrentSequence         ,


-- ** gestureSingleGetExclusive
    gestureSingleGetExclusive               ,


-- ** gestureSingleGetTouchOnly
    gestureSingleGetTouchOnly               ,


-- ** gestureSingleSetButton
    gestureSingleSetButton                  ,


-- ** gestureSingleSetExclusive
    gestureSingleSetExclusive               ,


-- ** gestureSingleSetTouchOnly
    gestureSingleSetTouchOnly               ,




 -- * Properties
-- ** Button
    GestureSingleButtonPropertyInfo         ,
    constructGestureSingleButton            ,
    getGestureSingleButton                  ,
    setGestureSingleButton                  ,


-- ** Exclusive
    GestureSingleExclusivePropertyInfo      ,
    constructGestureSingleExclusive         ,
    getGestureSingleExclusive               ,
    setGestureSingleExclusive               ,


-- ** TouchOnly
    GestureSingleTouchOnlyPropertyInfo      ,
    constructGestureSingleTouchOnly         ,
    getGestureSingleTouchOnly               ,
    setGestureSingleTouchOnly               ,




    ) 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
import qualified GI.Gdk as Gdk

newtype GestureSingle = GestureSingle (ForeignPtr GestureSingle)
foreign import ccall "gtk_gesture_single_get_type"
    c_gtk_gesture_single_get_type :: IO GType

type instance ParentTypes GestureSingle = GestureSingleParentTypes
type GestureSingleParentTypes = '[Gesture, EventController, GObject.Object]

instance GObject GestureSingle where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_gesture_single_get_type
    

class GObject o => GestureSingleK o
instance (GObject o, IsDescendantOf GestureSingle o) => GestureSingleK o

toGestureSingle :: GestureSingleK o => o -> IO GestureSingle
toGestureSingle = unsafeCastTo GestureSingle

noGestureSingle :: Maybe GestureSingle
noGestureSingle = Nothing

-- VVV Prop "button"
   -- Type: TBasicType TUInt32
   -- Flags: [PropertyReadable,PropertyWritable]

getGestureSingleButton :: (MonadIO m, GestureSingleK o) => o -> m Word32
getGestureSingleButton obj = liftIO $ getObjectPropertyCUInt obj "button"

setGestureSingleButton :: (MonadIO m, GestureSingleK o) => o -> Word32 -> m ()
setGestureSingleButton obj val = liftIO $ setObjectPropertyCUInt obj "button" val

constructGestureSingleButton :: Word32 -> IO ([Char], GValue)
constructGestureSingleButton val = constructObjectPropertyCUInt "button" val

data GestureSingleButtonPropertyInfo
instance AttrInfo GestureSingleButtonPropertyInfo where
    type AttrAllowedOps GestureSingleButtonPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint GestureSingleButtonPropertyInfo = (~) Word32
    type AttrBaseTypeConstraint GestureSingleButtonPropertyInfo = GestureSingleK
    type AttrGetType GestureSingleButtonPropertyInfo = Word32
    type AttrLabel GestureSingleButtonPropertyInfo = "GestureSingle::button"
    attrGet _ = getGestureSingleButton
    attrSet _ = setGestureSingleButton
    attrConstruct _ = constructGestureSingleButton

-- VVV Prop "exclusive"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getGestureSingleExclusive :: (MonadIO m, GestureSingleK o) => o -> m Bool
getGestureSingleExclusive obj = liftIO $ getObjectPropertyBool obj "exclusive"

setGestureSingleExclusive :: (MonadIO m, GestureSingleK o) => o -> Bool -> m ()
setGestureSingleExclusive obj val = liftIO $ setObjectPropertyBool obj "exclusive" val

constructGestureSingleExclusive :: Bool -> IO ([Char], GValue)
constructGestureSingleExclusive val = constructObjectPropertyBool "exclusive" val

data GestureSingleExclusivePropertyInfo
instance AttrInfo GestureSingleExclusivePropertyInfo where
    type AttrAllowedOps GestureSingleExclusivePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint GestureSingleExclusivePropertyInfo = (~) Bool
    type AttrBaseTypeConstraint GestureSingleExclusivePropertyInfo = GestureSingleK
    type AttrGetType GestureSingleExclusivePropertyInfo = Bool
    type AttrLabel GestureSingleExclusivePropertyInfo = "GestureSingle::exclusive"
    attrGet _ = getGestureSingleExclusive
    attrSet _ = setGestureSingleExclusive
    attrConstruct _ = constructGestureSingleExclusive

-- VVV Prop "touch-only"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getGestureSingleTouchOnly :: (MonadIO m, GestureSingleK o) => o -> m Bool
getGestureSingleTouchOnly obj = liftIO $ getObjectPropertyBool obj "touch-only"

setGestureSingleTouchOnly :: (MonadIO m, GestureSingleK o) => o -> Bool -> m ()
setGestureSingleTouchOnly obj val = liftIO $ setObjectPropertyBool obj "touch-only" val

constructGestureSingleTouchOnly :: Bool -> IO ([Char], GValue)
constructGestureSingleTouchOnly val = constructObjectPropertyBool "touch-only" val

data GestureSingleTouchOnlyPropertyInfo
instance AttrInfo GestureSingleTouchOnlyPropertyInfo where
    type AttrAllowedOps GestureSingleTouchOnlyPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint GestureSingleTouchOnlyPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint GestureSingleTouchOnlyPropertyInfo = GestureSingleK
    type AttrGetType GestureSingleTouchOnlyPropertyInfo = Bool
    type AttrLabel GestureSingleTouchOnlyPropertyInfo = "GestureSingle::touch-only"
    attrGet _ = getGestureSingleTouchOnly
    attrSet _ = setGestureSingleTouchOnly
    attrConstruct _ = constructGestureSingleTouchOnly

type instance AttributeList GestureSingle = GestureSingleAttributeList
type GestureSingleAttributeList = ('[ '("button", GestureSingleButtonPropertyInfo), '("exclusive", GestureSingleExclusivePropertyInfo), '("n-points", GestureNPointsPropertyInfo), '("propagation-phase", EventControllerPropagationPhasePropertyInfo), '("touch-only", GestureSingleTouchOnlyPropertyInfo), '("widget", EventControllerWidgetPropertyInfo), '("window", GestureWindowPropertyInfo)] :: [(Symbol, *)])

type instance SignalList GestureSingle = GestureSingleSignalList
type GestureSingleSignalList = ('[ '("begin", GestureBeginSignalInfo), '("cancel", GestureCancelSignalInfo), '("end", GestureEndSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("sequence-state-changed", GestureSequenceStateChangedSignalInfo), '("update", GestureUpdateSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "gtk_gesture_single_get_button" gtk_gesture_single_get_button :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    IO Word32


gestureSingleGetButton ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    m Word32
gestureSingleGetButton _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_gesture_single_get_button _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_gesture_single_get_current_button" gtk_gesture_single_get_current_button :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    IO Word32


gestureSingleGetCurrentButton ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    m Word32
gestureSingleGetCurrentButton _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_gesture_single_get_current_button _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "gtk_gesture_single_get_current_sequence" gtk_gesture_single_get_current_sequence :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    IO (Ptr Gdk.EventSequence)


gestureSingleGetCurrentSequence ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    m Gdk.EventSequence
gestureSingleGetCurrentSequence _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_gesture_single_get_current_sequence _obj'
    checkUnexpectedReturnNULL "gtk_gesture_single_get_current_sequence" result
    result' <- (wrapBoxed Gdk.EventSequence) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_gesture_single_get_exclusive" gtk_gesture_single_get_exclusive :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    IO CInt


gestureSingleGetExclusive ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    m Bool
gestureSingleGetExclusive _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_gesture_single_get_exclusive _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_gesture_single_get_touch_only" gtk_gesture_single_get_touch_only :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    IO CInt


gestureSingleGetTouchOnly ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    m Bool
gestureSingleGetTouchOnly _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_gesture_single_get_touch_only _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method GestureSingle::set_button
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "GestureSingle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "button", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "GestureSingle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "button", 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 "gtk_gesture_single_set_button" gtk_gesture_single_set_button :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    Word32 ->                               -- button : TBasicType TUInt32
    IO ()


gestureSingleSetButton ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    Word32 ->                               -- button
    m ()
gestureSingleSetButton _obj button = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_gesture_single_set_button _obj' button
    touchManagedPtr _obj
    return ()

-- method GestureSingle::set_exclusive
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "GestureSingle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "exclusive", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "GestureSingle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "exclusive", 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_gesture_single_set_exclusive" gtk_gesture_single_set_exclusive :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    CInt ->                                 -- exclusive : TBasicType TBoolean
    IO ()


gestureSingleSetExclusive ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- exclusive
    m ()
gestureSingleSetExclusive _obj exclusive = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let exclusive' = (fromIntegral . fromEnum) exclusive
    gtk_gesture_single_set_exclusive _obj' exclusive'
    touchManagedPtr _obj
    return ()

-- method GestureSingle::set_touch_only
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "GestureSingle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "touch_only", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "GestureSingle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "touch_only", 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_gesture_single_set_touch_only" gtk_gesture_single_set_touch_only :: 
    Ptr GestureSingle ->                    -- _obj : TInterface "Gtk" "GestureSingle"
    CInt ->                                 -- touch_only : TBasicType TBoolean
    IO ()


gestureSingleSetTouchOnly ::
    (MonadIO m, GestureSingleK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- touch_only
    m ()
gestureSingleSetTouchOnly _obj touch_only = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let touch_only' = (fromIntegral . fromEnum) touch_only
    gtk_gesture_single_set_touch_only _obj' touch_only'
    touchManagedPtr _obj
    return ()