{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Objects.PadController
(
PadController(..) ,
IsPadController ,
toPadController ,
#if defined(ENABLE_OVERLOADING)
ResolvePadControllerMethod ,
#endif
padControllerNew ,
#if defined(ENABLE_OVERLOADING)
PadControllerSetActionMethodInfo ,
#endif
padControllerSetAction ,
#if defined(ENABLE_OVERLOADING)
PadControllerSetActionEntriesMethodInfo ,
#endif
padControllerSetActionEntries ,
#if defined(ENABLE_OVERLOADING)
PadControllerActionGroupPropertyInfo ,
#endif
constructPadControllerActionGroup ,
getPadControllerActionGroup ,
#if defined(ENABLE_OVERLOADING)
padControllerActionGroup ,
#endif
#if defined(ENABLE_OVERLOADING)
PadControllerPadPropertyInfo ,
#endif
constructPadControllerPad ,
getPadControllerPad ,
#if defined(ENABLE_OVERLOADING)
padControllerPad ,
#endif
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gdk.Objects.Device as Gdk.Device
import qualified GI.Gio.Interfaces.ActionGroup as Gio.ActionGroup
import {-# SOURCE #-} qualified GI.Gtk.Enums as Gtk.Enums
import {-# SOURCE #-} qualified GI.Gtk.Objects.EventController as Gtk.EventController
import {-# SOURCE #-} qualified GI.Gtk.Objects.Window as Gtk.Window
import {-# SOURCE #-} qualified GI.Gtk.Structs.PadActionEntry as Gtk.PadActionEntry
newtype PadController = PadController (SP.ManagedPtr PadController)
deriving (PadController -> PadController -> Bool
(PadController -> PadController -> Bool)
-> (PadController -> PadController -> Bool) -> Eq PadController
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: PadController -> PadController -> Bool
== :: PadController -> PadController -> Bool
$c/= :: PadController -> PadController -> Bool
/= :: PadController -> PadController -> Bool
Eq)
instance SP.ManagedPtrNewtype PadController where
toManagedPtr :: PadController -> ManagedPtr PadController
toManagedPtr (PadController ManagedPtr PadController
p) = ManagedPtr PadController
p
foreign import ccall "gtk_pad_controller_get_type"
c_gtk_pad_controller_get_type :: IO B.Types.GType
instance B.Types.TypedObject PadController where
glibType :: IO GType
glibType = IO GType
c_gtk_pad_controller_get_type
instance B.Types.GObject PadController
class (SP.GObject o, O.IsDescendantOf PadController o) => IsPadController o
instance (SP.GObject o, O.IsDescendantOf PadController o) => IsPadController o
instance O.HasParentTypes PadController
type instance O.ParentTypes PadController = '[Gtk.EventController.EventController, GObject.Object.Object]
toPadController :: (MIO.MonadIO m, IsPadController o) => o -> m PadController
toPadController :: forall (m :: * -> *) o.
(MonadIO m, IsPadController o) =>
o -> m PadController
toPadController = IO PadController -> m PadController
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO PadController -> m PadController)
-> (o -> IO PadController) -> o -> m PadController
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr PadController -> PadController)
-> o -> IO PadController
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr PadController -> PadController
PadController
instance B.GValue.IsGValue (Maybe PadController) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_pad_controller_get_type
gvalueSet_ :: Ptr GValue -> Maybe PadController -> IO ()
gvalueSet_ Ptr GValue
gv Maybe PadController
P.Nothing = Ptr GValue -> Ptr PadController -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr PadController
forall a. Ptr a
FP.nullPtr :: FP.Ptr PadController)
gvalueSet_ Ptr GValue
gv (P.Just PadController
obj) = PadController -> (Ptr PadController -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr PadController
obj (Ptr GValue -> Ptr PadController -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe PadController)
gvalueGet_ Ptr GValue
gv = do
Ptr PadController
ptr <- Ptr GValue -> IO (Ptr PadController)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr PadController)
if Ptr PadController
ptr Ptr PadController -> Ptr PadController -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr PadController
forall a. Ptr a
FP.nullPtr
then PadController -> Maybe PadController
forall a. a -> Maybe a
P.Just (PadController -> Maybe PadController)
-> IO PadController -> IO (Maybe PadController)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr PadController -> PadController)
-> Ptr PadController -> IO PadController
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr PadController -> PadController
PadController Ptr PadController
ptr
else Maybe PadController -> IO (Maybe PadController)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe PadController
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolvePadControllerMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolvePadControllerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolvePadControllerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolvePadControllerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolvePadControllerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolvePadControllerMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolvePadControllerMethod "handleEvent" o = Gtk.EventController.EventControllerHandleEventMethodInfo
ResolvePadControllerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolvePadControllerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolvePadControllerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolvePadControllerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolvePadControllerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolvePadControllerMethod "reset" o = Gtk.EventController.EventControllerResetMethodInfo
ResolvePadControllerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolvePadControllerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolvePadControllerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolvePadControllerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolvePadControllerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolvePadControllerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolvePadControllerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolvePadControllerMethod "getPropagationPhase" o = Gtk.EventController.EventControllerGetPropagationPhaseMethodInfo
ResolvePadControllerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolvePadControllerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolvePadControllerMethod "getWidget" o = Gtk.EventController.EventControllerGetWidgetMethodInfo
ResolvePadControllerMethod "setAction" o = PadControllerSetActionMethodInfo
ResolvePadControllerMethod "setActionEntries" o = PadControllerSetActionEntriesMethodInfo
ResolvePadControllerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolvePadControllerMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolvePadControllerMethod "setPropagationPhase" o = Gtk.EventController.EventControllerSetPropagationPhaseMethodInfo
ResolvePadControllerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolvePadControllerMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePadControllerMethod t PadController, O.OverloadedMethod info PadController p) => OL.IsLabel t (PadController -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolvePadControllerMethod t PadController, O.OverloadedMethod info PadController p, R.HasField t PadController p) => R.HasField t PadController p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolvePadControllerMethod t PadController, O.OverloadedMethodInfo info PadController) => OL.IsLabel t (O.MethodProxy info PadController) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getPadControllerActionGroup :: (MonadIO m, IsPadController o) => o -> m (Maybe Gio.ActionGroup.ActionGroup)
getPadControllerActionGroup :: forall (m :: * -> *) o.
(MonadIO m, IsPadController o) =>
o -> m (Maybe ActionGroup)
getPadControllerActionGroup o
obj = IO (Maybe ActionGroup) -> m (Maybe ActionGroup)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe ActionGroup) -> m (Maybe ActionGroup))
-> IO (Maybe ActionGroup) -> m (Maybe ActionGroup)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr ActionGroup -> ActionGroup)
-> IO (Maybe ActionGroup)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"action-group" ManagedPtr ActionGroup -> ActionGroup
Gio.ActionGroup.ActionGroup
constructPadControllerActionGroup :: (IsPadController o, MIO.MonadIO m, Gio.ActionGroup.IsActionGroup a) => a -> m (GValueConstruct o)
constructPadControllerActionGroup :: forall o (m :: * -> *) a.
(IsPadController o, MonadIO m, IsActionGroup a) =>
a -> m (GValueConstruct o)
constructPadControllerActionGroup a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"action-group" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)
#if defined(ENABLE_OVERLOADING)
data PadControllerActionGroupPropertyInfo
instance AttrInfo PadControllerActionGroupPropertyInfo where
type AttrAllowedOps PadControllerActionGroupPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint PadControllerActionGroupPropertyInfo = IsPadController
type AttrSetTypeConstraint PadControllerActionGroupPropertyInfo = Gio.ActionGroup.IsActionGroup
type AttrTransferTypeConstraint PadControllerActionGroupPropertyInfo = Gio.ActionGroup.IsActionGroup
type AttrTransferType PadControllerActionGroupPropertyInfo = Gio.ActionGroup.ActionGroup
type AttrGetType PadControllerActionGroupPropertyInfo = (Maybe Gio.ActionGroup.ActionGroup)
type AttrLabel PadControllerActionGroupPropertyInfo = "action-group"
type AttrOrigin PadControllerActionGroupPropertyInfo = PadController
attrGet = getPadControllerActionGroup
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo Gio.ActionGroup.ActionGroup v
attrConstruct = constructPadControllerActionGroup
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Objects.PadController.actionGroup"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-PadController.html#g:attr:actionGroup"
})
#endif
getPadControllerPad :: (MonadIO m, IsPadController o) => o -> m (Maybe Gdk.Device.Device)
getPadControllerPad :: forall (m :: * -> *) o.
(MonadIO m, IsPadController o) =>
o -> m (Maybe Device)
getPadControllerPad o
obj = IO (Maybe Device) -> m (Maybe Device)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Device) -> m (Maybe Device))
-> IO (Maybe Device) -> m (Maybe Device)
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr Device -> Device) -> IO (Maybe Device)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"pad" ManagedPtr Device -> Device
Gdk.Device.Device
constructPadControllerPad :: (IsPadController o, MIO.MonadIO m, Gdk.Device.IsDevice a) => a -> m (GValueConstruct o)
constructPadControllerPad :: forall o (m :: * -> *) a.
(IsPadController o, MonadIO m, IsDevice a) =>
a -> m (GValueConstruct o)
constructPadControllerPad a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"pad" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)
#if defined(ENABLE_OVERLOADING)
data PadControllerPadPropertyInfo
instance AttrInfo PadControllerPadPropertyInfo where
type AttrAllowedOps PadControllerPadPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint PadControllerPadPropertyInfo = IsPadController
type AttrSetTypeConstraint PadControllerPadPropertyInfo = Gdk.Device.IsDevice
type AttrTransferTypeConstraint PadControllerPadPropertyInfo = Gdk.Device.IsDevice
type AttrTransferType PadControllerPadPropertyInfo = Gdk.Device.Device
type AttrGetType PadControllerPadPropertyInfo = (Maybe Gdk.Device.Device)
type AttrLabel PadControllerPadPropertyInfo = "pad"
type AttrOrigin PadControllerPadPropertyInfo = PadController
attrGet = getPadControllerPad
attrSet = undefined
attrTransfer _ v = do
unsafeCastTo Gdk.Device.Device v
attrConstruct = constructPadControllerPad
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Objects.PadController.pad"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-PadController.html#g:attr:pad"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList PadController
type instance O.AttributeList PadController = PadControllerAttributeList
type PadControllerAttributeList = ('[ '("actionGroup", PadControllerActionGroupPropertyInfo), '("pad", PadControllerPadPropertyInfo), '("propagationPhase", Gtk.EventController.EventControllerPropagationPhasePropertyInfo), '("widget", Gtk.EventController.EventControllerWidgetPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
padControllerActionGroup :: AttrLabelProxy "actionGroup"
padControllerActionGroup = AttrLabelProxy
padControllerPad :: AttrLabelProxy "pad"
padControllerPad = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList PadController = PadControllerSignalList
type PadControllerSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "gtk_pad_controller_new" gtk_pad_controller_new ::
Ptr Gtk.Window.Window ->
Ptr Gio.ActionGroup.ActionGroup ->
Ptr Gdk.Device.Device ->
IO (Ptr PadController)
padControllerNew ::
(B.CallStack.HasCallStack, MonadIO m, Gtk.Window.IsWindow a, Gio.ActionGroup.IsActionGroup b, Gdk.Device.IsDevice c) =>
a
-> b
-> Maybe (c)
-> m PadController
padControllerNew :: forall (m :: * -> *) a b c.
(HasCallStack, MonadIO m, IsWindow a, IsActionGroup b,
IsDevice c) =>
a -> b -> Maybe c -> m PadController
padControllerNew a
window b
group Maybe c
pad = IO PadController -> m PadController
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO PadController -> m PadController)
-> IO PadController -> m PadController
forall a b. (a -> b) -> a -> b
$ do
Ptr Window
window' <- a -> IO (Ptr Window)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
window
Ptr ActionGroup
group' <- b -> IO (Ptr ActionGroup)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
group
Ptr Device
maybePad <- case Maybe c
pad of
Maybe c
Nothing -> Ptr Device -> IO (Ptr Device)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Device
forall a. Ptr a
nullPtr
Just c
jPad -> do
Ptr Device
jPad' <- c -> IO (Ptr Device)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr c
jPad
Ptr Device -> IO (Ptr Device)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Device
jPad'
Ptr PadController
result <- Ptr Window
-> Ptr ActionGroup -> Ptr Device -> IO (Ptr PadController)
gtk_pad_controller_new Ptr Window
window' Ptr ActionGroup
group' Ptr Device
maybePad
Text -> Ptr PadController -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"padControllerNew" Ptr PadController
result
PadController
result' <- ((ManagedPtr PadController -> PadController)
-> Ptr PadController -> IO PadController
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr PadController -> PadController
PadController) Ptr PadController
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
window
b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr b
group
Maybe c -> (c -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe c
pad c -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
PadController -> IO PadController
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return PadController
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_pad_controller_set_action" gtk_pad_controller_set_action ::
Ptr PadController ->
CUInt ->
Int32 ->
Int32 ->
CString ->
CString ->
IO ()
padControllerSetAction ::
(B.CallStack.HasCallStack, MonadIO m, IsPadController a) =>
a
-> Gtk.Enums.PadActionType
-> Int32
-> Int32
-> T.Text
-> T.Text
-> m ()
padControllerSetAction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsPadController a) =>
a -> PadActionType -> Int32 -> Int32 -> Text -> Text -> m ()
padControllerSetAction a
controller PadActionType
type_ Int32
index Int32
mode Text
label Text
actionName = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr PadController
controller' <- a -> IO (Ptr PadController)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
controller
let type_' :: CUInt
type_' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (PadActionType -> Int) -> PadActionType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PadActionType -> Int
forall a. Enum a => a -> Int
fromEnum) PadActionType
type_
CString
label' <- Text -> IO CString
textToCString Text
label
CString
actionName' <- Text -> IO CString
textToCString Text
actionName
Ptr PadController
-> CUInt -> Int32 -> Int32 -> CString -> CString -> IO ()
gtk_pad_controller_set_action Ptr PadController
controller' CUInt
type_' Int32
index Int32
mode CString
label' CString
actionName'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
controller
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
label'
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
actionName'
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PadControllerSetActionMethodInfo
instance (signature ~ (Gtk.Enums.PadActionType -> Int32 -> Int32 -> T.Text -> T.Text -> m ()), MonadIO m, IsPadController a) => O.OverloadedMethod PadControllerSetActionMethodInfo a signature where
overloadedMethod = padControllerSetAction
instance O.OverloadedMethodInfo PadControllerSetActionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Objects.PadController.padControllerSetAction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-PadController.html#v:padControllerSetAction"
})
#endif
foreign import ccall "gtk_pad_controller_set_action_entries" gtk_pad_controller_set_action_entries ::
Ptr PadController ->
Ptr Gtk.PadActionEntry.PadActionEntry ->
Int32 ->
IO ()
padControllerSetActionEntries ::
(B.CallStack.HasCallStack, MonadIO m, IsPadController a) =>
a
-> [Gtk.PadActionEntry.PadActionEntry]
-> m ()
padControllerSetActionEntries :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsPadController a) =>
a -> [PadActionEntry] -> m ()
padControllerSetActionEntries a
controller [PadActionEntry]
entries = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let nEntries :: Int32
nEntries = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [PadActionEntry] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [PadActionEntry]
entries
Ptr PadController
controller' <- a -> IO (Ptr PadController)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
controller
[Ptr PadActionEntry]
entries' <- (PadActionEntry -> IO (Ptr PadActionEntry))
-> [PadActionEntry] -> IO [Ptr PadActionEntry]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM PadActionEntry -> IO (Ptr PadActionEntry)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [PadActionEntry]
entries
Ptr PadActionEntry
entries'' <- Int -> [Ptr PadActionEntry] -> IO (Ptr PadActionEntry)
forall a. Int -> [Ptr a] -> IO (Ptr a)
packBlockArray Int
32 [Ptr PadActionEntry]
entries'
Ptr PadController -> Ptr PadActionEntry -> Int32 -> IO ()
gtk_pad_controller_set_action_entries Ptr PadController
controller' Ptr PadActionEntry
entries'' Int32
nEntries
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
controller
(PadActionEntry -> IO ()) -> [PadActionEntry] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ PadActionEntry -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr [PadActionEntry]
entries
Ptr PadActionEntry -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr PadActionEntry
entries''
() -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data PadControllerSetActionEntriesMethodInfo
instance (signature ~ ([Gtk.PadActionEntry.PadActionEntry] -> m ()), MonadIO m, IsPadController a) => O.OverloadedMethod PadControllerSetActionEntriesMethodInfo a signature where
overloadedMethod = padControllerSetActionEntries
instance O.OverloadedMethodInfo PadControllerSetActionEntriesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Objects.PadController.padControllerSetActionEntries",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.41/docs/GI-Gtk-Objects-PadController.html#v:padControllerSetActionEntries"
})
#endif