{- |
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.Atk.Objects.Plug
    ( 

-- * Exported types
    Plug(..)                                ,
    PlugK                                   ,
    toPlug                                  ,
    noPlug                                  ,


 -- * Methods
-- ** plugGetId
    plugGetId                               ,


-- ** plugNew
    plugNew                                 ,




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

newtype Plug = Plug (ForeignPtr Plug)
foreign import ccall "atk_plug_get_type"
    c_atk_plug_get_type :: IO GType

type instance ParentTypes Plug = PlugParentTypes
type PlugParentTypes = '[Object, GObject.Object, Component]

instance GObject Plug where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_atk_plug_get_type
    

class GObject o => PlugK o
instance (GObject o, IsDescendantOf Plug o) => PlugK o

toPlug :: PlugK o => o -> IO Plug
toPlug = unsafeCastTo Plug

noPlug :: Maybe Plug
noPlug = Nothing

type instance AttributeList Plug = PlugAttributeList
type PlugAttributeList = ('[ '("accessible-component-layer", ObjectAccessibleComponentLayerPropertyInfo), '("accessible-component-mdi-zorder", ObjectAccessibleComponentMdiZorderPropertyInfo), '("accessible-description", ObjectAccessibleDescriptionPropertyInfo), '("accessible-hypertext-nlinks", ObjectAccessibleHypertextNlinksPropertyInfo), '("accessible-name", ObjectAccessibleNamePropertyInfo), '("accessible-parent", ObjectAccessibleParentPropertyInfo), '("accessible-role", ObjectAccessibleRolePropertyInfo), '("accessible-table-caption", ObjectAccessibleTableCaptionPropertyInfo), '("accessible-table-caption-object", ObjectAccessibleTableCaptionObjectPropertyInfo), '("accessible-table-column-description", ObjectAccessibleTableColumnDescriptionPropertyInfo), '("accessible-table-column-header", ObjectAccessibleTableColumnHeaderPropertyInfo), '("accessible-table-row-description", ObjectAccessibleTableRowDescriptionPropertyInfo), '("accessible-table-row-header", ObjectAccessibleTableRowHeaderPropertyInfo), '("accessible-table-summary", ObjectAccessibleTableSummaryPropertyInfo), '("accessible-value", ObjectAccessibleValuePropertyInfo)] :: [(Symbol, *)])

type instance SignalList Plug = PlugSignalList
type PlugSignalList = ('[ '("active-descendant-changed", ObjectActiveDescendantChangedSignalInfo), '("bounds-changed", ComponentBoundsChangedSignalInfo), '("children-changed", ObjectChildrenChangedSignalInfo), '("focus-event", ObjectFocusEventSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("property-change", ObjectPropertyChangeSignalInfo), '("state-change", ObjectStateChangeSignalInfo), '("visible-data-changed", ObjectVisibleDataChangedSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Plug::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Atk" "Plug"
-- throws : False
-- Skip return : False

foreign import ccall "atk_plug_new" atk_plug_new :: 
    IO (Ptr Plug)


plugNew ::
    (MonadIO m) =>
    m Plug
plugNew  = liftIO $ do
    result <- atk_plug_new
    checkUnexpectedReturnNULL "atk_plug_new" result
    result' <- (wrapObject Plug) result
    return result'

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

foreign import ccall "atk_plug_get_id" atk_plug_get_id :: 
    Ptr Plug ->                             -- _obj : TInterface "Atk" "Plug"
    IO CString


plugGetId ::
    (MonadIO m, PlugK a) =>
    a ->                                    -- _obj
    m T.Text
plugGetId _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_plug_get_id _obj'
    checkUnexpectedReturnNULL "atk_plug_get_id" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'