{- |
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.Emblem
    ( 

-- * Exported types
    Emblem(..)                              ,
    EmblemK                                 ,
    toEmblem                                ,
    noEmblem                                ,


 -- * Methods
-- ** emblemGetIcon
    emblemGetIcon                           ,


-- ** emblemGetOrigin
    emblemGetOrigin                         ,


-- ** emblemNew
    emblemNew                               ,


-- ** emblemNewWithOrigin
    emblemNewWithOrigin                     ,




 -- * Properties
-- ** Icon
    EmblemIconPropertyInfo                  ,
    constructEmblemIcon                     ,
    getEmblemIcon                           ,


-- ** Origin
    EmblemOriginPropertyInfo                ,
    constructEmblemOrigin                   ,
    getEmblemOrigin                         ,




    ) 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 Emblem = Emblem (ForeignPtr Emblem)
foreign import ccall "g_emblem_get_type"
    c_g_emblem_get_type :: IO GType

type instance ParentTypes Emblem = EmblemParentTypes
type EmblemParentTypes = '[GObject.Object, Icon]

instance GObject Emblem where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_emblem_get_type
    

class GObject o => EmblemK o
instance (GObject o, IsDescendantOf Emblem o) => EmblemK o

toEmblem :: EmblemK o => o -> IO Emblem
toEmblem = unsafeCastTo Emblem

noEmblem :: Maybe Emblem
noEmblem = Nothing

-- VVV Prop "icon"
   -- Type: TInterface "GObject" "Object"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getEmblemIcon :: (MonadIO m, EmblemK o) => o -> m GObject.Object
getEmblemIcon obj = liftIO $ getObjectPropertyObject obj "icon" GObject.Object

constructEmblemIcon :: (GObject.ObjectK a) => a -> IO ([Char], GValue)
constructEmblemIcon val = constructObjectPropertyObject "icon" val

data EmblemIconPropertyInfo
instance AttrInfo EmblemIconPropertyInfo where
    type AttrAllowedOps EmblemIconPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint EmblemIconPropertyInfo = GObject.ObjectK
    type AttrBaseTypeConstraint EmblemIconPropertyInfo = EmblemK
    type AttrGetType EmblemIconPropertyInfo = GObject.Object
    type AttrLabel EmblemIconPropertyInfo = "Emblem::icon"
    attrGet _ = getEmblemIcon
    attrSet _ = undefined
    attrConstruct _ = constructEmblemIcon

-- VVV Prop "origin"
   -- Type: TInterface "Gio" "EmblemOrigin"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getEmblemOrigin :: (MonadIO m, EmblemK o) => o -> m EmblemOrigin
getEmblemOrigin obj = liftIO $ getObjectPropertyEnum obj "origin"

constructEmblemOrigin :: EmblemOrigin -> IO ([Char], GValue)
constructEmblemOrigin val = constructObjectPropertyEnum "origin" val

data EmblemOriginPropertyInfo
instance AttrInfo EmblemOriginPropertyInfo where
    type AttrAllowedOps EmblemOriginPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint EmblemOriginPropertyInfo = (~) EmblemOrigin
    type AttrBaseTypeConstraint EmblemOriginPropertyInfo = EmblemK
    type AttrGetType EmblemOriginPropertyInfo = EmblemOrigin
    type AttrLabel EmblemOriginPropertyInfo = "Emblem::origin"
    attrGet _ = getEmblemOrigin
    attrSet _ = undefined
    attrConstruct _ = constructEmblemOrigin

type instance AttributeList Emblem = EmblemAttributeList
type EmblemAttributeList = ('[ '("icon", EmblemIconPropertyInfo), '("origin", EmblemOriginPropertyInfo)] :: [(Symbol, *)])

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

-- method Emblem::new
-- method type : Constructor
-- Args : [Arg {argName = "icon", argType = TInterface "Gio" "Icon", direction = DirectionIn, mayBeNull = False, 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}]
-- returnType : TInterface "Gio" "Emblem"
-- throws : False
-- Skip return : False

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


emblemNew ::
    (MonadIO m, IconK a) =>
    a ->                                    -- icon
    m Emblem
emblemNew icon = liftIO $ do
    let icon' = unsafeManagedPtrCastPtr icon
    result <- g_emblem_new icon'
    checkUnexpectedReturnNULL "g_emblem_new" result
    result' <- (wrapObject Emblem) result
    touchManagedPtr icon
    return result'

-- method Emblem::new_with_origin
-- 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 = "origin", argType = TInterface "Gio" "EmblemOrigin", direction = DirectionIn, mayBeNull = False, 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 = "origin", argType = TInterface "Gio" "EmblemOrigin", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "Emblem"
-- throws : False
-- Skip return : False

foreign import ccall "g_emblem_new_with_origin" g_emblem_new_with_origin :: 
    Ptr Icon ->                             -- icon : TInterface "Gio" "Icon"
    CUInt ->                                -- origin : TInterface "Gio" "EmblemOrigin"
    IO (Ptr Emblem)


emblemNewWithOrigin ::
    (MonadIO m, IconK a) =>
    a ->                                    -- icon
    EmblemOrigin ->                         -- origin
    m Emblem
emblemNewWithOrigin icon origin = liftIO $ do
    let icon' = unsafeManagedPtrCastPtr icon
    let origin' = (fromIntegral . fromEnum) origin
    result <- g_emblem_new_with_origin icon' origin'
    checkUnexpectedReturnNULL "g_emblem_new_with_origin" result
    result' <- (wrapObject Emblem) result
    touchManagedPtr icon
    return result'

-- method Emblem::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "Emblem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "Emblem", 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_emblem_get_icon" g_emblem_get_icon :: 
    Ptr Emblem ->                           -- _obj : TInterface "Gio" "Emblem"
    IO (Ptr Icon)


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

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

foreign import ccall "g_emblem_get_origin" g_emblem_get_origin :: 
    Ptr Emblem ->                           -- _obj : TInterface "Gio" "Emblem"
    IO CUInt


emblemGetOrigin ::
    (MonadIO m, EmblemK a) =>
    a ->                                    -- _obj
    m EmblemOrigin
emblemGetOrigin _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- g_emblem_get_origin _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'