{- |
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.Poppler.Objects.AnnotCircle
    ( 

-- * Exported types
    AnnotCircle(..)                         ,
    AnnotCircleK                            ,
    toAnnotCircle                           ,
    noAnnotCircle                           ,


 -- * Methods
-- ** annotCircleGetInteriorColor
    annotCircleGetInteriorColor             ,


-- ** annotCircleNew
    annotCircleNew                          ,


-- ** annotCircleSetInteriorColor
    annotCircleSetInteriorColor             ,




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

newtype AnnotCircle = AnnotCircle (ForeignPtr AnnotCircle)
foreign import ccall "poppler_annot_circle_get_type"
    c_poppler_annot_circle_get_type :: IO GType

type instance ParentTypes AnnotCircle = AnnotCircleParentTypes
type AnnotCircleParentTypes = '[AnnotMarkup, Annot, GObject.Object]

instance GObject AnnotCircle where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_annot_circle_get_type
    

class GObject o => AnnotCircleK o
instance (GObject o, IsDescendantOf AnnotCircle o) => AnnotCircleK o

toAnnotCircle :: AnnotCircleK o => o -> IO AnnotCircle
toAnnotCircle = unsafeCastTo AnnotCircle

noAnnotCircle :: Maybe AnnotCircle
noAnnotCircle = Nothing

type instance AttributeList AnnotCircle = AnnotCircleAttributeList
type AnnotCircleAttributeList = ('[ ] :: [(Symbol, *)])

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

-- method AnnotCircle::new
-- method type : Constructor
-- Args : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotCircle"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_circle_new" poppler_annot_circle_new :: 
    Ptr Document ->                         -- doc : TInterface "Poppler" "Document"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    IO (Ptr AnnotCircle)


annotCircleNew ::
    (MonadIO m, DocumentK a) =>
    a ->                                    -- doc
    Rectangle ->                            -- rect
    m AnnotCircle
annotCircleNew doc rect = liftIO $ do
    let doc' = unsafeManagedPtrCastPtr doc
    let rect' = unsafeManagedPtrGetPtr rect
    result <- poppler_annot_circle_new doc' rect'
    checkUnexpectedReturnNULL "poppler_annot_circle_new" result
    result' <- (wrapObject AnnotCircle) result
    touchManagedPtr doc
    touchManagedPtr rect
    return result'

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

foreign import ccall "poppler_annot_circle_get_interior_color" poppler_annot_circle_get_interior_color :: 
    Ptr AnnotCircle ->                      -- _obj : TInterface "Poppler" "AnnotCircle"
    IO (Ptr Color)


annotCircleGetInteriorColor ::
    (MonadIO m, AnnotCircleK a) =>
    a ->                                    -- _obj
    m Color
annotCircleGetInteriorColor _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_annot_circle_get_interior_color _obj'
    checkUnexpectedReturnNULL "poppler_annot_circle_get_interior_color" result
    result' <- (wrapBoxed Color) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_annot_circle_set_interior_color" poppler_annot_circle_set_interior_color :: 
    Ptr AnnotCircle ->                      -- _obj : TInterface "Poppler" "AnnotCircle"
    Ptr Color ->                            -- poppler_color : TInterface "Poppler" "Color"
    IO ()


annotCircleSetInteriorColor ::
    (MonadIO m, AnnotCircleK a) =>
    a ->                                    -- _obj
    Maybe (Color) ->                        -- poppler_color
    m ()
annotCircleSetInteriorColor _obj poppler_color = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybePoppler_color <- case poppler_color of
        Nothing -> return nullPtr
        Just jPoppler_color -> do
            let jPoppler_color' = unsafeManagedPtrGetPtr jPoppler_color
            return jPoppler_color'
    poppler_annot_circle_set_interior_color _obj' maybePoppler_color
    touchManagedPtr _obj
    whenJust poppler_color touchManagedPtr
    return ()