{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

Public instance data for a 'GI.Dbusmenu.Objects.MenuitemProxy.MenuitemProxy'.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Dbusmenu.Objects.MenuitemProxy
    (

-- * Exported types
    MenuitemProxy(..)                       ,
    IsMenuitemProxy                         ,
    toMenuitemProxy                         ,
    noMenuitemProxy                         ,


 -- * Methods
-- ** getWrapped #method:getWrapped#

#if ENABLE_OVERLOADING
    MenuitemProxyGetWrappedMethodInfo       ,
#endif
    menuitemProxyGetWrapped                 ,


-- ** new #method:new#

    menuitemProxyNew                        ,




 -- * Properties
-- ** menuItem #attr:menuItem#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    MenuitemProxyMenuItemPropertyInfo       ,
#endif
    constructMenuitemProxyMenuItem          ,
    getMenuitemProxyMenuItem                ,
#if ENABLE_OVERLOADING
    menuitemProxyMenuItem                   ,
#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.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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 {-# SOURCE #-} qualified GI.Dbusmenu.Objects.Menuitem as Dbusmenu.Menuitem
import qualified GI.GObject.Objects.Object as GObject.Object

-- | Memory-managed wrapper type.
newtype MenuitemProxy = MenuitemProxy (ManagedPtr MenuitemProxy)
foreign import ccall "dbusmenu_menuitem_proxy_get_type"
    c_dbusmenu_menuitem_proxy_get_type :: IO GType

instance GObject MenuitemProxy where
    gobjectType = c_dbusmenu_menuitem_proxy_get_type


-- | Type class for types which can be safely cast to `MenuitemProxy`, for instance with `toMenuitemProxy`.
class (GObject o, O.IsDescendantOf MenuitemProxy o) => IsMenuitemProxy o
instance (GObject o, O.IsDescendantOf MenuitemProxy o) => IsMenuitemProxy o

instance O.HasParentTypes MenuitemProxy
type instance O.ParentTypes MenuitemProxy = '[Dbusmenu.Menuitem.Menuitem, GObject.Object.Object]

-- | Cast to `MenuitemProxy`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toMenuitemProxy :: (MonadIO m, IsMenuitemProxy o) => o -> m MenuitemProxy
toMenuitemProxy = liftIO . unsafeCastTo MenuitemProxy

-- | A convenience alias for `Nothing` :: `Maybe` `MenuitemProxy`.
noMenuitemProxy :: Maybe MenuitemProxy
noMenuitemProxy = Nothing

#if ENABLE_OVERLOADING
type family ResolveMenuitemProxyMethod (t :: Symbol) (o :: *) :: * where
    ResolveMenuitemProxyMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveMenuitemProxyMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveMenuitemProxyMethod "childAddPosition" o = Dbusmenu.Menuitem.MenuitemChildAddPositionMethodInfo
    ResolveMenuitemProxyMethod "childAppend" o = Dbusmenu.Menuitem.MenuitemChildAppendMethodInfo
    ResolveMenuitemProxyMethod "childDelete" o = Dbusmenu.Menuitem.MenuitemChildDeleteMethodInfo
    ResolveMenuitemProxyMethod "childFind" o = Dbusmenu.Menuitem.MenuitemChildFindMethodInfo
    ResolveMenuitemProxyMethod "childPrepend" o = Dbusmenu.Menuitem.MenuitemChildPrependMethodInfo
    ResolveMenuitemProxyMethod "childReorder" o = Dbusmenu.Menuitem.MenuitemChildReorderMethodInfo
    ResolveMenuitemProxyMethod "findId" o = Dbusmenu.Menuitem.MenuitemFindIdMethodInfo
    ResolveMenuitemProxyMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveMenuitemProxyMethod "foreach" o = Dbusmenu.Menuitem.MenuitemForeachMethodInfo
    ResolveMenuitemProxyMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveMenuitemProxyMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveMenuitemProxyMethod "handleEvent" o = Dbusmenu.Menuitem.MenuitemHandleEventMethodInfo
    ResolveMenuitemProxyMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveMenuitemProxyMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveMenuitemProxyMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveMenuitemProxyMethod "propertiesCopy" o = Dbusmenu.Menuitem.MenuitemPropertiesCopyMethodInfo
    ResolveMenuitemProxyMethod "propertiesList" o = Dbusmenu.Menuitem.MenuitemPropertiesListMethodInfo
    ResolveMenuitemProxyMethod "propertyExist" o = Dbusmenu.Menuitem.MenuitemPropertyExistMethodInfo
    ResolveMenuitemProxyMethod "propertyGet" o = Dbusmenu.Menuitem.MenuitemPropertyGetMethodInfo
    ResolveMenuitemProxyMethod "propertyGetBool" o = Dbusmenu.Menuitem.MenuitemPropertyGetBoolMethodInfo
    ResolveMenuitemProxyMethod "propertyGetByteArray" o = Dbusmenu.Menuitem.MenuitemPropertyGetByteArrayMethodInfo
    ResolveMenuitemProxyMethod "propertyGetInt" o = Dbusmenu.Menuitem.MenuitemPropertyGetIntMethodInfo
    ResolveMenuitemProxyMethod "propertyGetVariant" o = Dbusmenu.Menuitem.MenuitemPropertyGetVariantMethodInfo
    ResolveMenuitemProxyMethod "propertyRemove" o = Dbusmenu.Menuitem.MenuitemPropertyRemoveMethodInfo
    ResolveMenuitemProxyMethod "propertySet" o = Dbusmenu.Menuitem.MenuitemPropertySetMethodInfo
    ResolveMenuitemProxyMethod "propertySetBool" o = Dbusmenu.Menuitem.MenuitemPropertySetBoolMethodInfo
    ResolveMenuitemProxyMethod "propertySetByteArray" o = Dbusmenu.Menuitem.MenuitemPropertySetByteArrayMethodInfo
    ResolveMenuitemProxyMethod "propertySetInt" o = Dbusmenu.Menuitem.MenuitemPropertySetIntMethodInfo
    ResolveMenuitemProxyMethod "propertySetVariant" o = Dbusmenu.Menuitem.MenuitemPropertySetVariantMethodInfo
    ResolveMenuitemProxyMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveMenuitemProxyMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveMenuitemProxyMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveMenuitemProxyMethod "sendAboutToShow" o = Dbusmenu.Menuitem.MenuitemSendAboutToShowMethodInfo
    ResolveMenuitemProxyMethod "showToUser" o = Dbusmenu.Menuitem.MenuitemShowToUserMethodInfo
    ResolveMenuitemProxyMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveMenuitemProxyMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveMenuitemProxyMethod "takeChildren" o = Dbusmenu.Menuitem.MenuitemTakeChildrenMethodInfo
    ResolveMenuitemProxyMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveMenuitemProxyMethod "unparent" o = Dbusmenu.Menuitem.MenuitemUnparentMethodInfo
    ResolveMenuitemProxyMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveMenuitemProxyMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveMenuitemProxyMethod "getChildren" o = Dbusmenu.Menuitem.MenuitemGetChildrenMethodInfo
    ResolveMenuitemProxyMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveMenuitemProxyMethod "getId" o = Dbusmenu.Menuitem.MenuitemGetIdMethodInfo
    ResolveMenuitemProxyMethod "getParent" o = Dbusmenu.Menuitem.MenuitemGetParentMethodInfo
    ResolveMenuitemProxyMethod "getPosition" o = Dbusmenu.Menuitem.MenuitemGetPositionMethodInfo
    ResolveMenuitemProxyMethod "getPositionRealized" o = Dbusmenu.Menuitem.MenuitemGetPositionRealizedMethodInfo
    ResolveMenuitemProxyMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveMenuitemProxyMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveMenuitemProxyMethod "getRoot" o = Dbusmenu.Menuitem.MenuitemGetRootMethodInfo
    ResolveMenuitemProxyMethod "getWrapped" o = MenuitemProxyGetWrappedMethodInfo
    ResolveMenuitemProxyMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveMenuitemProxyMethod "setParent" o = Dbusmenu.Menuitem.MenuitemSetParentMethodInfo
    ResolveMenuitemProxyMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveMenuitemProxyMethod "setRoot" o = Dbusmenu.Menuitem.MenuitemSetRootMethodInfo
    ResolveMenuitemProxyMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveMenuitemProxyMethod t MenuitemProxy, O.MethodInfo info MenuitemProxy p) => OL.IsLabel t (MenuitemProxy -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

-- VVV Prop "menu-item"
   -- Type: TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Nothing,Nothing)

{- |
Get the value of the “@menu-item@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' menuitemProxy #menuItem
@
-}
getMenuitemProxyMenuItem :: (MonadIO m, IsMenuitemProxy o) => o -> m (Maybe Dbusmenu.Menuitem.Menuitem)
getMenuitemProxyMenuItem obj = liftIO $ B.Properties.getObjectPropertyObject obj "menu-item" Dbusmenu.Menuitem.Menuitem

{- |
Construct a `GValueConstruct` with valid value for the “@menu-item@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructMenuitemProxyMenuItem :: (IsMenuitemProxy o, Dbusmenu.Menuitem.IsMenuitem a) => a -> IO (GValueConstruct o)
constructMenuitemProxyMenuItem val = B.Properties.constructObjectPropertyObject "menu-item" (Just val)

#if ENABLE_OVERLOADING
data MenuitemProxyMenuItemPropertyInfo
instance AttrInfo MenuitemProxyMenuItemPropertyInfo where
    type AttrAllowedOps MenuitemProxyMenuItemPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MenuitemProxyMenuItemPropertyInfo = Dbusmenu.Menuitem.IsMenuitem
    type AttrBaseTypeConstraint MenuitemProxyMenuItemPropertyInfo = IsMenuitemProxy
    type AttrGetType MenuitemProxyMenuItemPropertyInfo = (Maybe Dbusmenu.Menuitem.Menuitem)
    type AttrLabel MenuitemProxyMenuItemPropertyInfo = "menu-item"
    type AttrOrigin MenuitemProxyMenuItemPropertyInfo = MenuitemProxy
    attrGet _ = getMenuitemProxyMenuItem
    attrSet _ = undefined
    attrConstruct _ = constructMenuitemProxyMenuItem
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList MenuitemProxy
type instance O.AttributeList MenuitemProxy = MenuitemProxyAttributeList
type MenuitemProxyAttributeList = ('[ '("id", Dbusmenu.Menuitem.MenuitemIdPropertyInfo), '("menuItem", MenuitemProxyMenuItemPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
menuitemProxyMenuItem :: AttrLabelProxy "menuItem"
menuitemProxyMenuItem = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList MenuitemProxy = MenuitemProxySignalList
type MenuitemProxySignalList = ('[ '("aboutToShow", Dbusmenu.Menuitem.MenuitemAboutToShowSignalInfo), '("childAdded", Dbusmenu.Menuitem.MenuitemChildAddedSignalInfo), '("childMoved", Dbusmenu.Menuitem.MenuitemChildMovedSignalInfo), '("childRemoved", Dbusmenu.Menuitem.MenuitemChildRemovedSignalInfo), '("event", Dbusmenu.Menuitem.MenuitemEventSignalInfo), '("itemActivated", Dbusmenu.Menuitem.MenuitemItemActivatedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("propertyChanged", Dbusmenu.Menuitem.MenuitemPropertyChangedSignalInfo), '("realized", Dbusmenu.Menuitem.MenuitemRealizedSignalInfo), '("showToUser", Dbusmenu.Menuitem.MenuitemShowToUserSignalInfo)] :: [(Symbol, *)])

#endif

-- method MenuitemProxy::new
-- method type : Constructor
-- Args : [Arg {argCName = "mi", argType = TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #DbusmenuMenuitem to proxy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "MenuitemProxy"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_proxy_new" dbusmenu_menuitem_proxy_new ::
    Ptr Dbusmenu.Menuitem.Menuitem ->       -- mi : TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"})
    IO (Ptr MenuitemProxy)

{- |
Builds a new 'GI.Dbusmenu.Objects.MenuitemProxy.MenuitemProxy' object that proxies
all of the values for /@mi@/.
-}
menuitemProxyNew ::
    (B.CallStack.HasCallStack, MonadIO m, Dbusmenu.Menuitem.IsMenuitem a) =>
    a
    {- ^ /@mi@/: The 'GI.Dbusmenu.Objects.Menuitem.Menuitem' to proxy -}
    -> m MenuitemProxy
    {- ^ __Returns:__ A new 'GI.Dbusmenu.Objects.MenuitemProxy.MenuitemProxy' object. -}
menuitemProxyNew mi = liftIO $ do
    mi' <- unsafeManagedPtrCastPtr mi
    result <- dbusmenu_menuitem_proxy_new mi'
    checkUnexpectedReturnNULL "menuitemProxyNew" result
    result' <- (wrapObject MenuitemProxy) result
    touchManagedPtr mi
    return result'

#if ENABLE_OVERLOADING
#endif

-- method MenuitemProxy::get_wrapped
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pmi", argType = TInterface (Name {namespace = "Dbusmenu", name = "MenuitemProxy"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "#DbusmenuMenuitemProxy to look into", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Dbusmenu", name = "Menuitem"}))
-- throws : False
-- Skip return : False

foreign import ccall "dbusmenu_menuitem_proxy_get_wrapped" dbusmenu_menuitem_proxy_get_wrapped ::
    Ptr MenuitemProxy ->                    -- pmi : TInterface (Name {namespace = "Dbusmenu", name = "MenuitemProxy"})
    IO (Ptr Dbusmenu.Menuitem.Menuitem)

{- |
Accesses the private variable of which 'GI.Dbusmenu.Objects.Menuitem.Menuitem'
we are doing the proxying for.
-}
menuitemProxyGetWrapped ::
    (B.CallStack.HasCallStack, MonadIO m, IsMenuitemProxy a) =>
    a
    {- ^ /@pmi@/: 'GI.Dbusmenu.Objects.MenuitemProxy.MenuitemProxy' to look into -}
    -> m Dbusmenu.Menuitem.Menuitem
    {- ^ __Returns:__ A 'GI.Dbusmenu.Objects.Menuitem.Menuitem' object or a @/NULL/@ if we
	don\'t have one or there is an error. -}
menuitemProxyGetWrapped pmi = liftIO $ do
    pmi' <- unsafeManagedPtrCastPtr pmi
    result <- dbusmenu_menuitem_proxy_get_wrapped pmi'
    checkUnexpectedReturnNULL "menuitemProxyGetWrapped" result
    result' <- (newObject Dbusmenu.Menuitem.Menuitem) result
    touchManagedPtr pmi
    return result'

#if ENABLE_OVERLOADING
data MenuitemProxyGetWrappedMethodInfo
instance (signature ~ (m Dbusmenu.Menuitem.Menuitem), MonadIO m, IsMenuitemProxy a) => O.MethodInfo MenuitemProxyGetWrappedMethodInfo a signature where
    overloadedMethod _ = menuitemProxyGetWrapped

#endif