{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A t'GI.Gio.Interfaces.ListModel.ListModel' representing values of a given enum.
-- 
-- @GtkEnumList@ contains objects of type t'GI.Gtk.Objects.EnumListItem.EnumListItem'.
-- 
-- A simple way to use a @GtkEnumList@ is to populate a t'GI.Gtk.Objects.DropDown.DropDown'
-- widget using the short name (or \"nick\") of the values of an
-- enumeration type:
-- 
-- 
-- === /c code/
-- >choices = gtk_drop_down_new (G_LIST_MODEL (gtk_enum_list_new (type)),
-- >                             gtk_property_expression_new (GTK_TYPE_ENUM_LIST_ITEM,
-- >                                                          NULL,
-- >                                                          "nick"));
-- 
-- 
-- /Since: 4.24/

#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif

module GI.Gtk.Objects.EnumList
    ( 

-- * Exported types
    EnumList(..)                            ,
    IsEnumList                              ,
    toEnumList                              ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [find]("GI.Gtk.Objects.EnumList#g:method:find"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [itemsChanged]("GI.Gio.Interfaces.ListModel#g:method:itemsChanged"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getEnumType]("GI.Gtk.Objects.EnumList#g:method:getEnumType"), [getItem]("GI.Gio.Interfaces.ListModel#g:method:getItem"), [getItemType]("GI.Gio.Interfaces.ListModel#g:method:getItemType"), [getNItems]("GI.Gio.Interfaces.ListModel#g:method:getNItems"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty").

#if defined(ENABLE_OVERLOADING)
    ResolveEnumListMethod                   ,
#endif

-- ** find #method:find#

#if defined(ENABLE_OVERLOADING)
    EnumListFindMethodInfo                  ,
#endif
    enumListFind                            ,


-- ** getEnumType #method:getEnumType#

#if defined(ENABLE_OVERLOADING)
    EnumListGetEnumTypeMethodInfo           ,
#endif
    enumListGetEnumType                     ,


-- ** new #method:new#

    enumListNew                             ,




 -- * Properties


-- ** enumType #attr:enumType#
-- | The type of the enum represented by the model.
-- 
-- /Since: 4.24/

#if defined(ENABLE_OVERLOADING)
    EnumListEnumTypePropertyInfo            ,
#endif
    constructEnumListEnumType               ,
#if defined(ENABLE_OVERLOADING)
    enumListEnumType                        ,
#endif
    getEnumListEnumType                     ,


-- ** itemType #attr:itemType#
-- | The type of the items. See 'GI.Gio.Interfaces.ListModel.listModelGetItemType'.
-- 
-- /Since: 4.24/

#if defined(ENABLE_OVERLOADING)
    EnumListItemTypePropertyInfo            ,
#endif
#if defined(ENABLE_OVERLOADING)
    enumListItemType                        ,
#endif
    getEnumListItemType                     ,


-- ** nItems #attr:nItems#
-- | The number of items. See 'GI.Gio.Interfaces.ListModel.listModelGetNItems'.
-- 
-- /Since: 4.24/

#if defined(ENABLE_OVERLOADING)
    EnumListNItemsPropertyInfo              ,
#endif
#if defined(ENABLE_OVERLOADING)
    enumListNItems                          ,
#endif
    getEnumListNItems                       ,




    ) 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 Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.ListModel as Gio.ListModel

#else
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Interfaces.ListModel as Gio.ListModel

#endif

-- | Memory-managed wrapper type.
newtype EnumList = EnumList (SP.ManagedPtr EnumList)
    deriving (EnumList -> EnumList -> Bool
(EnumList -> EnumList -> Bool)
-> (EnumList -> EnumList -> Bool) -> Eq EnumList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: EnumList -> EnumList -> Bool
== :: EnumList -> EnumList -> Bool
$c/= :: EnumList -> EnumList -> Bool
/= :: EnumList -> EnumList -> Bool
Eq)

instance SP.ManagedPtrNewtype EnumList where
    toManagedPtr :: EnumList -> ManagedPtr EnumList
toManagedPtr (EnumList ManagedPtr EnumList
p) = ManagedPtr EnumList
p

foreign import ccall "gtk_enum_list_get_type"
    c_gtk_enum_list_get_type :: IO B.Types.GType

instance B.Types.TypedObject EnumList where
    glibType :: IO GType
glibType = IO GType
c_gtk_enum_list_get_type

instance B.Types.GObject EnumList

-- | Type class for types which can be safely cast to t'EnumList', for instance with `toEnumList`.
class (SP.GObject o, O.IsDescendantOf EnumList o) => IsEnumList o
instance (SP.GObject o, O.IsDescendantOf EnumList o) => IsEnumList o

instance O.HasParentTypes EnumList
type instance O.ParentTypes EnumList = '[GObject.Object.Object, Gio.ListModel.ListModel]

-- | Cast to t'EnumList', for types for which this is known to be safe. For general casts, use 'Data.GI.Base.ManagedPtr.castTo'.
toEnumList :: (MIO.MonadIO m, IsEnumList o) => o -> m EnumList
toEnumList :: forall (m :: * -> *) o.
(MonadIO m, IsEnumList o) =>
o -> m EnumList
toEnumList = IO EnumList -> m EnumList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO EnumList -> m EnumList)
-> (o -> IO EnumList) -> o -> m EnumList
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr EnumList -> EnumList) -> o -> IO EnumList
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr EnumList -> EnumList
EnumList

-- | Convert t'EnumList' to and from t'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe EnumList) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_enum_list_get_type
    gvalueSet_ :: Ptr GValue -> Maybe EnumList -> IO ()
gvalueSet_ Ptr GValue
gv Maybe EnumList
P.Nothing = Ptr GValue -> Ptr EnumList -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr EnumList
forall a. Ptr a
FP.nullPtr :: FP.Ptr EnumList)
    gvalueSet_ Ptr GValue
gv (P.Just EnumList
obj) = EnumList -> (Ptr EnumList -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr EnumList
obj (Ptr GValue -> Ptr EnumList -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe EnumList)
gvalueGet_ Ptr GValue
gv = do
        ptr <- Ptr GValue -> IO (Ptr EnumList)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr EnumList)
        if ptr /= FP.nullPtr
        then P.Just <$> B.ManagedPtr.newObject EnumList ptr
        else return P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveEnumListMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
    ResolveEnumListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveEnumListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveEnumListMethod "find" o = EnumListFindMethodInfo
    ResolveEnumListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveEnumListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveEnumListMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveEnumListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveEnumListMethod "itemsChanged" o = Gio.ListModel.ListModelItemsChangedMethodInfo
    ResolveEnumListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveEnumListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveEnumListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveEnumListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveEnumListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveEnumListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveEnumListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveEnumListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveEnumListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveEnumListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveEnumListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveEnumListMethod "getEnumType" o = EnumListGetEnumTypeMethodInfo
    ResolveEnumListMethod "getItem" o = Gio.ListModel.ListModelGetItemMethodInfo
    ResolveEnumListMethod "getItemType" o = Gio.ListModel.ListModelGetItemTypeMethodInfo
    ResolveEnumListMethod "getNItems" o = Gio.ListModel.ListModelGetNItemsMethodInfo
    ResolveEnumListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveEnumListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveEnumListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveEnumListMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveEnumListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveEnumListMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveEnumListMethod t EnumList, O.OverloadedMethod info EnumList p) => OL.IsLabel t (EnumList -> 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 ~ ResolveEnumListMethod t EnumList, O.OverloadedMethod info EnumList p, R.HasField t EnumList p) => R.HasField t EnumList p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveEnumListMethod t EnumList, O.OverloadedMethodInfo info EnumList) => OL.IsLabel t (O.MethodProxy info EnumList) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- VVV Prop "enum-type"
   -- Type: TBasicType TGType
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@enum-type@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' enumList #enumType
-- @
getEnumListEnumType :: (MonadIO m, IsEnumList o) => o -> m GType
getEnumListEnumType :: forall (m :: * -> *) o. (MonadIO m, IsEnumList o) => o -> m GType
getEnumListEnumType o
obj = IO GType -> m GType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO GType
forall a. GObject a => a -> String -> IO GType
B.Properties.getObjectPropertyGType o
obj String
"enum-type"

-- | Construct a t'GValueConstruct' with valid value for the “@enum-type@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructEnumListEnumType :: (IsEnumList o, MIO.MonadIO m) => GType -> m (GValueConstruct o)
constructEnumListEnumType :: forall o (m :: * -> *).
(IsEnumList o, MonadIO m) =>
GType -> m (GValueConstruct o)
constructEnumListEnumType GType
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 -> GType -> IO (GValueConstruct o)
forall o. String -> GType -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyGType String
"enum-type" GType
val

#if defined(ENABLE_OVERLOADING)
data EnumListEnumTypePropertyInfo
instance AttrInfo EnumListEnumTypePropertyInfo where
    type AttrAllowedOps EnumListEnumTypePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrBaseTypeConstraint EnumListEnumTypePropertyInfo = IsEnumList
    type AttrSetTypeConstraint EnumListEnumTypePropertyInfo = (~) GType
    type AttrTransferTypeConstraint EnumListEnumTypePropertyInfo = (~) GType
    type AttrTransferType EnumListEnumTypePropertyInfo = GType
    type AttrGetType EnumListEnumTypePropertyInfo = GType
    type AttrLabel EnumListEnumTypePropertyInfo = "enum-type"
    type AttrOrigin EnumListEnumTypePropertyInfo = EnumList
    attrGet = getEnumListEnumType
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ v = do
        return v
    attrConstruct = constructEnumListEnumType
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.EnumList.enumType"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-EnumList.html#g:attr:enumType"
        })
#endif

-- VVV Prop "item-type"
   -- Type: TBasicType TGType
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@item-type@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' enumList #itemType
-- @
getEnumListItemType :: (MonadIO m, IsEnumList o) => o -> m GType
getEnumListItemType :: forall (m :: * -> *) o. (MonadIO m, IsEnumList o) => o -> m GType
getEnumListItemType o
obj = IO GType -> m GType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO GType
forall a. GObject a => a -> String -> IO GType
B.Properties.getObjectPropertyGType o
obj String
"item-type"

#if defined(ENABLE_OVERLOADING)
data EnumListItemTypePropertyInfo
instance AttrInfo EnumListItemTypePropertyInfo where
    type AttrAllowedOps EnumListItemTypePropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint EnumListItemTypePropertyInfo = IsEnumList
    type AttrSetTypeConstraint EnumListItemTypePropertyInfo = (~) ()
    type AttrTransferTypeConstraint EnumListItemTypePropertyInfo = (~) ()
    type AttrTransferType EnumListItemTypePropertyInfo = ()
    type AttrGetType EnumListItemTypePropertyInfo = GType
    type AttrLabel EnumListItemTypePropertyInfo = "item-type"
    type AttrOrigin EnumListItemTypePropertyInfo = EnumList
    attrGet = getEnumListItemType
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.EnumList.itemType"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-EnumList.html#g:attr:itemType"
        })
#endif

-- VVV Prop "n-items"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

-- | Get the value of the “@n-items@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' enumList #nItems
-- @
getEnumListNItems :: (MonadIO m, IsEnumList o) => o -> m Word32
getEnumListNItems :: forall (m :: * -> *) o. (MonadIO m, IsEnumList o) => o -> m Word32
getEnumListNItems o
obj = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ o -> String -> IO Word32
forall a. GObject a => a -> String -> IO Word32
B.Properties.getObjectPropertyUInt32 o
obj String
"n-items"

#if defined(ENABLE_OVERLOADING)
data EnumListNItemsPropertyInfo
instance AttrInfo EnumListNItemsPropertyInfo where
    type AttrAllowedOps EnumListNItemsPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint EnumListNItemsPropertyInfo = IsEnumList
    type AttrSetTypeConstraint EnumListNItemsPropertyInfo = (~) ()
    type AttrTransferTypeConstraint EnumListNItemsPropertyInfo = (~) ()
    type AttrTransferType EnumListNItemsPropertyInfo = ()
    type AttrGetType EnumListNItemsPropertyInfo = Word32
    type AttrLabel EnumListNItemsPropertyInfo = "n-items"
    type AttrOrigin EnumListNItemsPropertyInfo = EnumList
    attrGet = getEnumListNItems
    attrSet = undefined
    attrPut = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.EnumList.nItems"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-EnumList.html#g:attr:nItems"
        })
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList EnumList
type instance O.AttributeList EnumList = EnumListAttributeList
type EnumListAttributeList = ('[ '("enumType", EnumListEnumTypePropertyInfo), '("itemType", EnumListItemTypePropertyInfo), '("nItems", EnumListNItemsPropertyInfo)] :: [(Symbol, DK.Type)])
#endif

#if defined(ENABLE_OVERLOADING)
enumListEnumType :: AttrLabelProxy "enumType"
enumListEnumType = AttrLabelProxy

enumListItemType :: AttrLabelProxy "itemType"
enumListItemType = AttrLabelProxy

enumListNItems :: AttrLabelProxy "nItems"
enumListNItems = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList EnumList = EnumListSignalList
type EnumListSignalList = ('[ '("itemsChanged", Gio.ListModel.ListModelItemsChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])

#endif

-- method EnumList::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "enum_type"
--           , argType = TBasicType TGType
--           , argCType = Just "GType"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "the type of the enum to construct the model from"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "EnumList" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_enum_list_new" gtk_enum_list_new :: 
    CGType ->                               -- enum_type : TBasicType TGType
    IO (Ptr EnumList)

-- | Creates a new @GtkEnumList@ for /@enumType@/.
-- 
-- /Since: 4.24/
enumListNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    GType
    -- ^ /@enumType@/: the type of the enum to construct the model from
    -> m EnumList
    -- ^ __Returns:__ the newly created @GtkEnumList@
enumListNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
GType -> m EnumList
enumListNew GType
enumType = IO EnumList -> m EnumList
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EnumList -> m EnumList) -> IO EnumList -> m EnumList
forall a b. (a -> b) -> a -> b
$ do
    let enumType' :: CGType
enumType' = GType -> CGType
gtypeToCGType GType
enumType
    result <- CGType -> IO (Ptr EnumList)
gtk_enum_list_new CGType
enumType'
    checkUnexpectedReturnNULL "enumListNew" result
    result' <- (wrapObject EnumList) result
    return result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method EnumList::find
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "EnumList" }
--           , argCType = Just "GtkEnumList*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "value"
--           , argType = TBasicType TInt
--           , argCType = Just "int"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "an enum value" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TUInt)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_enum_list_find" gtk_enum_list_find :: 
    Ptr EnumList ->                         -- self : TInterface (Name {namespace = "Gtk", name = "EnumList"})
    Int32 ->                                -- value : TBasicType TInt
    IO Word32

-- | Finds the position of a given enum value in /@self@/.
-- 
-- If the value is not found, [const/@gtk@/.INVALID_LIST_POSITION] is returned.
-- 
-- /Since: 4.24/
enumListFind ::
    (B.CallStack.HasCallStack, MonadIO m, IsEnumList a) =>
    a
    -> Int32
    -- ^ /@value@/: an enum value
    -> m Word32
    -- ^ __Returns:__ the position of the value
enumListFind :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsEnumList a) =>
a -> Int32 -> m Word32
enumListFind a
self Int32
value = IO Word32 -> m Word32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ do
    self' <- a -> IO (Ptr EnumList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    result <- gtk_enum_list_find self' value
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING)
data EnumListFindMethodInfo
instance (signature ~ (Int32 -> m Word32), MonadIO m, IsEnumList a) => O.OverloadedMethod EnumListFindMethodInfo a signature where
    overloadedMethod = enumListFind

instance O.OverloadedMethodInfo EnumListFindMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.EnumList.enumListFind",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-EnumList.html#v:enumListFind"
        })


#endif

-- method EnumList::get_enum_type
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "EnumList" }
--           , argCType = Just "GtkEnumList*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation { rawDocText = Nothing , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TGType)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_enum_list_get_enum_type" gtk_enum_list_get_enum_type :: 
    Ptr EnumList ->                         -- self : TInterface (Name {namespace = "Gtk", name = "EnumList"})
    IO CGType

-- | Gets the type of the enum represented by /@self@/.
-- 
-- /Since: 4.24/
enumListGetEnumType ::
    (B.CallStack.HasCallStack, MonadIO m, IsEnumList a) =>
    a
    -> m GType
    -- ^ __Returns:__ the enum type
enumListGetEnumType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsEnumList a) =>
a -> m GType
enumListGetEnumType a
self = IO GType -> m GType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO GType -> m GType) -> IO GType -> m GType
forall a b. (a -> b) -> a -> b
$ do
    self' <- a -> IO (Ptr EnumList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    result <- gtk_enum_list_get_enum_type self'
    let result' = CGType -> GType
GType CGType
result
    touchManagedPtr self
    return result'

#if defined(ENABLE_OVERLOADING)
data EnumListGetEnumTypeMethodInfo
instance (signature ~ (m GType), MonadIO m, IsEnumList a) => O.OverloadedMethod EnumListGetEnumTypeMethodInfo a signature where
    overloadedMethod = enumListGetEnumType

instance O.OverloadedMethodInfo EnumListGetEnumTypeMethodInfo a where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Gtk.Objects.EnumList.enumListGetEnumType",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk4-4.0.12/docs/GI-Gtk-Objects-EnumList.html#v:enumListGetEnumType"
        })


#endif