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

-- * Exported types
    EmblemedIcon(..)                        ,
    EmblemedIconK                           ,
    toEmblemedIcon                          ,
    noEmblemedIcon                          ,


 -- * Methods
-- ** emblemedIconAddEmblem
    emblemedIconAddEmblem                   ,


-- ** emblemedIconClearEmblems
    emblemedIconClearEmblems                ,


-- ** emblemedIconGetEmblems
    emblemedIconGetEmblems                  ,


-- ** emblemedIconGetIcon
    emblemedIconGetIcon                     ,


-- ** emblemedIconNew
    emblemedIconNew                         ,




 -- * Properties
-- ** Gicon
    EmblemedIconGiconPropertyInfo           ,
    constructEmblemedIconGicon              ,
    getEmblemedIconGicon                    ,




    ) 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.Gio.Types
import GI.Gio.Callbacks
import qualified GI.GObject as GObject

newtype EmblemedIcon = EmblemedIcon (ForeignPtr EmblemedIcon)
foreign import ccall "g_emblemed_icon_get_type"
    c_g_emblemed_icon_get_type :: IO GType

type instance ParentTypes EmblemedIcon = EmblemedIconParentTypes
type EmblemedIconParentTypes = '[GObject.Object, Icon]

instance GObject EmblemedIcon where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_emblemed_icon_get_type
    

class GObject o => EmblemedIconK o
instance (GObject o, IsDescendantOf EmblemedIcon o) => EmblemedIconK o

toEmblemedIcon :: EmblemedIconK o => o -> IO EmblemedIcon
toEmblemedIcon = unsafeCastTo EmblemedIcon

noEmblemedIcon :: Maybe EmblemedIcon
noEmblemedIcon = Nothing

-- VVV Prop "gicon"
   -- Type: TInterface "Gio" "Icon"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getEmblemedIconGicon :: (MonadIO m, EmblemedIconK o) => o -> m Icon
getEmblemedIconGicon obj = liftIO $ getObjectPropertyObject obj "gicon" Icon

constructEmblemedIconGicon :: (IconK a) => a -> IO ([Char], GValue)
constructEmblemedIconGicon val = constructObjectPropertyObject "gicon" val

data EmblemedIconGiconPropertyInfo
instance AttrInfo EmblemedIconGiconPropertyInfo where
    type AttrAllowedOps EmblemedIconGiconPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint EmblemedIconGiconPropertyInfo = IconK
    type AttrBaseTypeConstraint EmblemedIconGiconPropertyInfo = EmblemedIconK
    type AttrGetType EmblemedIconGiconPropertyInfo = Icon
    type AttrLabel EmblemedIconGiconPropertyInfo = "EmblemedIcon::gicon"
    attrGet _ = getEmblemedIconGicon
    attrSet _ = undefined
    attrConstruct _ = constructEmblemedIconGicon

type instance AttributeList EmblemedIcon = EmblemedIconAttributeList
type EmblemedIconAttributeList = ('[ '("gicon", EmblemedIconGiconPropertyInfo)] :: [(Symbol, *)])

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

-- method EmblemedIcon::new
-- method type : Constructor
-- Args : [Arg {argName = "icon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "emblem", argType = TInterface "Gio" "Emblem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "icon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "emblem", argType = TInterface "Gio" "Emblem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "EmblemedIcon"
-- throws : False
-- Skip return : False

foreign import ccall "g_emblemed_icon_new" g_emblemed_icon_new :: 
    Ptr Icon ->                             -- icon : TInterface "Gio" "Icon"
    Ptr Emblem ->                           -- emblem : TInterface "Gio" "Emblem"
    IO (Ptr EmblemedIcon)


emblemedIconNew ::
    (MonadIO m, IconK a, EmblemK b) =>
    a ->                                    -- icon
    Maybe (b) ->                            -- emblem
    m EmblemedIcon
emblemedIconNew icon emblem = liftIO $ do
    let icon' = unsafeManagedPtrCastPtr icon
    maybeEmblem <- case emblem of
        Nothing -> return nullPtr
        Just jEmblem -> do
            let jEmblem' = unsafeManagedPtrCastPtr jEmblem
            return jEmblem'
    result <- g_emblemed_icon_new icon' maybeEmblem
    checkUnexpectedReturnNULL "g_emblemed_icon_new" result
    result' <- (wrapObject EmblemedIcon) result
    touchManagedPtr icon
    whenJust emblem touchManagedPtr
    return result'

-- method EmblemedIcon::add_emblem
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "EmblemedIcon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "emblem", argType = TInterface "Gio" "Emblem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "EmblemedIcon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "emblem", argType = TInterface "Gio" "Emblem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "g_emblemed_icon_add_emblem" g_emblemed_icon_add_emblem :: 
    Ptr EmblemedIcon ->                     -- _obj : TInterface "Gio" "EmblemedIcon"
    Ptr Emblem ->                           -- emblem : TInterface "Gio" "Emblem"
    IO ()


emblemedIconAddEmblem ::
    (MonadIO m, EmblemedIconK a, EmblemK b) =>
    a ->                                    -- _obj
    b ->                                    -- emblem
    m ()
emblemedIconAddEmblem _obj emblem = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let emblem' = unsafeManagedPtrCastPtr emblem
    g_emblemed_icon_add_emblem _obj' emblem'
    touchManagedPtr _obj
    touchManagedPtr emblem
    return ()

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

foreign import ccall "g_emblemed_icon_clear_emblems" g_emblemed_icon_clear_emblems :: 
    Ptr EmblemedIcon ->                     -- _obj : TInterface "Gio" "EmblemedIcon"
    IO ()


emblemedIconClearEmblems ::
    (MonadIO m, EmblemedIconK a) =>
    a ->                                    -- _obj
    m ()
emblemedIconClearEmblems _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    g_emblemed_icon_clear_emblems _obj'
    touchManagedPtr _obj
    return ()

-- method EmblemedIcon::get_emblems
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "EmblemedIcon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "EmblemedIcon", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TInterface "Gio" "Emblem")
-- throws : False
-- Skip return : False

foreign import ccall "g_emblemed_icon_get_emblems" g_emblemed_icon_get_emblems :: 
    Ptr EmblemedIcon ->                     -- _obj : TInterface "Gio" "EmblemedIcon"
    IO (Ptr (GList (Ptr Emblem)))


emblemedIconGetEmblems ::
    (MonadIO m, EmblemedIconK a) =>
    a ->                                    -- _obj
    m [Emblem]
emblemedIconGetEmblems _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_emblemed_icon_get_emblems _obj'
    checkUnexpectedReturnNULL "g_emblemed_icon_get_emblems" result
    result' <- unpackGList result
    result'' <- mapM (newObject Emblem) result'
    touchManagedPtr _obj
    return result''

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

foreign import ccall "g_emblemed_icon_get_icon" g_emblemed_icon_get_icon :: 
    Ptr EmblemedIcon ->                     -- _obj : TInterface "Gio" "EmblemedIcon"
    IO (Ptr Icon)


emblemedIconGetIcon ::
    (MonadIO m, EmblemedIconK a) =>
    a ->                                    -- _obj
    m Icon
emblemedIconGetIcon _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_emblemed_icon_get_icon _obj'
    checkUnexpectedReturnNULL "g_emblemed_icon_get_icon" result
    result' <- (newObject Icon) result
    touchManagedPtr _obj
    return result'