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

/No description available in the introspection data./
-}

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

module GI.Poppler.Objects.AnnotCircle
    (

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


 -- * Methods
-- ** getInteriorColor #method:getInteriorColor#

#if ENABLE_OVERLOADING
    AnnotCircleGetInteriorColorMethodInfo   ,
#endif
    annotCircleGetInteriorColor             ,


-- ** new #method:new#

    annotCircleNew                          ,


-- ** setInteriorColor #method:setInteriorColor#

#if ENABLE_OVERLOADING
    AnnotCircleSetInteriorColorMethodInfo   ,
#endif
    annotCircleSetInteriorColor             ,




    ) 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 qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Poppler.Objects.Annot as Poppler.Annot
import {-# SOURCE #-} qualified GI.Poppler.Objects.AnnotMarkup as Poppler.AnnotMarkup
import {-# SOURCE #-} qualified GI.Poppler.Objects.Document as Poppler.Document
import {-# SOURCE #-} qualified GI.Poppler.Structs.Color as Poppler.Color
import {-# SOURCE #-} qualified GI.Poppler.Structs.Rectangle as Poppler.Rectangle

-- | Memory-managed wrapper type.
newtype AnnotCircle = AnnotCircle (ManagedPtr AnnotCircle)
foreign import ccall "poppler_annot_circle_get_type"
    c_poppler_annot_circle_get_type :: IO GType

instance GObject AnnotCircle where
    gobjectType = c_poppler_annot_circle_get_type


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

instance O.HasParentTypes AnnotCircle
type instance O.ParentTypes AnnotCircle = '[Poppler.AnnotMarkup.AnnotMarkup, Poppler.Annot.Annot, GObject.Object.Object]

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

-- | A convenience alias for `Nothing` :: `Maybe` `AnnotCircle`.
noAnnotCircle :: Maybe AnnotCircle
noAnnotCircle = Nothing

#if ENABLE_OVERLOADING
type family ResolveAnnotCircleMethod (t :: Symbol) (o :: *) :: * where
    ResolveAnnotCircleMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAnnotCircleMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAnnotCircleMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAnnotCircleMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAnnotCircleMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAnnotCircleMethod "hasPopup" o = Poppler.AnnotMarkup.AnnotMarkupHasPopupMethodInfo
    ResolveAnnotCircleMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAnnotCircleMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAnnotCircleMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAnnotCircleMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAnnotCircleMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAnnotCircleMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAnnotCircleMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAnnotCircleMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAnnotCircleMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAnnotCircleMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAnnotCircleMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAnnotCircleMethod "getAnnotType" o = Poppler.Annot.AnnotGetAnnotTypeMethodInfo
    ResolveAnnotCircleMethod "getColor" o = Poppler.Annot.AnnotGetColorMethodInfo
    ResolveAnnotCircleMethod "getContents" o = Poppler.Annot.AnnotGetContentsMethodInfo
    ResolveAnnotCircleMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAnnotCircleMethod "getDate" o = Poppler.AnnotMarkup.AnnotMarkupGetDateMethodInfo
    ResolveAnnotCircleMethod "getExternalData" o = Poppler.AnnotMarkup.AnnotMarkupGetExternalDataMethodInfo
    ResolveAnnotCircleMethod "getFlags" o = Poppler.Annot.AnnotGetFlagsMethodInfo
    ResolveAnnotCircleMethod "getInteriorColor" o = AnnotCircleGetInteriorColorMethodInfo
    ResolveAnnotCircleMethod "getLabel" o = Poppler.AnnotMarkup.AnnotMarkupGetLabelMethodInfo
    ResolveAnnotCircleMethod "getModified" o = Poppler.Annot.AnnotGetModifiedMethodInfo
    ResolveAnnotCircleMethod "getName" o = Poppler.Annot.AnnotGetNameMethodInfo
    ResolveAnnotCircleMethod "getOpacity" o = Poppler.AnnotMarkup.AnnotMarkupGetOpacityMethodInfo
    ResolveAnnotCircleMethod "getPageIndex" o = Poppler.Annot.AnnotGetPageIndexMethodInfo
    ResolveAnnotCircleMethod "getPopupIsOpen" o = Poppler.AnnotMarkup.AnnotMarkupGetPopupIsOpenMethodInfo
    ResolveAnnotCircleMethod "getPopupRectangle" o = Poppler.AnnotMarkup.AnnotMarkupGetPopupRectangleMethodInfo
    ResolveAnnotCircleMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAnnotCircleMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAnnotCircleMethod "getRectangle" o = Poppler.Annot.AnnotGetRectangleMethodInfo
    ResolveAnnotCircleMethod "getReplyTo" o = Poppler.AnnotMarkup.AnnotMarkupGetReplyToMethodInfo
    ResolveAnnotCircleMethod "getSubject" o = Poppler.AnnotMarkup.AnnotMarkupGetSubjectMethodInfo
    ResolveAnnotCircleMethod "setColor" o = Poppler.Annot.AnnotSetColorMethodInfo
    ResolveAnnotCircleMethod "setContents" o = Poppler.Annot.AnnotSetContentsMethodInfo
    ResolveAnnotCircleMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAnnotCircleMethod "setFlags" o = Poppler.Annot.AnnotSetFlagsMethodInfo
    ResolveAnnotCircleMethod "setInteriorColor" o = AnnotCircleSetInteriorColorMethodInfo
    ResolveAnnotCircleMethod "setLabel" o = Poppler.AnnotMarkup.AnnotMarkupSetLabelMethodInfo
    ResolveAnnotCircleMethod "setOpacity" o = Poppler.AnnotMarkup.AnnotMarkupSetOpacityMethodInfo
    ResolveAnnotCircleMethod "setPopup" o = Poppler.AnnotMarkup.AnnotMarkupSetPopupMethodInfo
    ResolveAnnotCircleMethod "setPopupIsOpen" o = Poppler.AnnotMarkup.AnnotMarkupSetPopupIsOpenMethodInfo
    ResolveAnnotCircleMethod "setPopupRectangle" o = Poppler.AnnotMarkup.AnnotMarkupSetPopupRectangleMethodInfo
    ResolveAnnotCircleMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAnnotCircleMethod "setRectangle" o = Poppler.Annot.AnnotSetRectangleMethodInfo
    ResolveAnnotCircleMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAnnotCircleMethod t AnnotCircle, O.MethodInfo info AnnotCircle p) => OL.IsLabel t (AnnotCircle -> 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

#if ENABLE_OVERLOADING
instance O.HasAttributeList AnnotCircle
type instance O.AttributeList AnnotCircle = AnnotCircleAttributeList
type AnnotCircleAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type instance O.SignalList AnnotCircle = AnnotCircleSignalList
type AnnotCircleSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method AnnotCircle::new
-- method type : Constructor
-- Args : [Arg {argCName = "doc", argType = TInterface (Name {namespace = "Poppler", name = "Document"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerDocument", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rect", argType = TInterface (Name {namespace = "Poppler", name = "Rectangle"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerRectangle", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Poppler", name = "AnnotCircle"}))
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_circle_new" poppler_annot_circle_new ::
    Ptr Poppler.Document.Document ->        -- doc : TInterface (Name {namespace = "Poppler", name = "Document"})
    Ptr Poppler.Rectangle.Rectangle ->      -- rect : TInterface (Name {namespace = "Poppler", name = "Rectangle"})
    IO (Ptr AnnotCircle)

{- |
Creates a new Circle annotation that will be
located on /@rect@/ when added to a page. See
'GI.Poppler.Objects.Page.pageAddAnnot'

/Since: 0.26/
-}
annotCircleNew ::
    (B.CallStack.HasCallStack, MonadIO m, Poppler.Document.IsDocument a) =>
    a
    {- ^ /@doc@/: a 'GI.Poppler.Objects.Document.Document' -}
    -> Poppler.Rectangle.Rectangle
    {- ^ /@rect@/: a 'GI.Poppler.Structs.Rectangle.Rectangle' -}
    -> m AnnotCircle
    {- ^ __Returns:__ a newly created 'GI.Poppler.Objects.AnnotCircle.AnnotCircle' annotation -}
annotCircleNew doc rect = liftIO $ do
    doc' <- unsafeManagedPtrCastPtr doc
    rect' <- unsafeManagedPtrGetPtr rect
    result <- poppler_annot_circle_new doc' rect'
    checkUnexpectedReturnNULL "annotCircleNew" result
    result' <- (wrapObject AnnotCircle) result
    touchManagedPtr doc
    touchManagedPtr rect
    return result'

#if ENABLE_OVERLOADING
#endif

-- method AnnotCircle::get_interior_color
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotCircle"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotCircle", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Poppler", name = "Color"}))
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_circle_get_interior_color" poppler_annot_circle_get_interior_color ::
    Ptr AnnotCircle ->                      -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotCircle"})
    IO (Ptr Poppler.Color.Color)

{- |
Retrieves the interior color of /@popplerAnnot@/.

/Since: 0.26/
-}
annotCircleGetInteriorColor ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotCircle a) =>
    a
    {- ^ /@popplerAnnot@/: a 'GI.Poppler.Objects.AnnotCircle.AnnotCircle' -}
    -> m Poppler.Color.Color
    {- ^ __Returns:__ a new allocated 'GI.Poppler.Structs.Color.Color' with the color values of
              /@popplerAnnot@/, or 'Nothing'. It must be freed with 'GI.GLib.Functions.free' when done. -}
annotCircleGetInteriorColor popplerAnnot = liftIO $ do
    popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
    result <- poppler_annot_circle_get_interior_color popplerAnnot'
    checkUnexpectedReturnNULL "annotCircleGetInteriorColor" result
    result' <- (wrapBoxed Poppler.Color.Color) result
    touchManagedPtr popplerAnnot
    return result'

#if ENABLE_OVERLOADING
data AnnotCircleGetInteriorColorMethodInfo
instance (signature ~ (m Poppler.Color.Color), MonadIO m, IsAnnotCircle a) => O.MethodInfo AnnotCircleGetInteriorColorMethodInfo a signature where
    overloadedMethod _ = annotCircleGetInteriorColor

#endif

-- method AnnotCircle::set_interior_color
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotCircle"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotCircle", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "poppler_color", argType = TInterface (Name {namespace = "Poppler", name = "Color"}), direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "a #PopplerColor, or %NULL", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_circle_set_interior_color" poppler_annot_circle_set_interior_color ::
    Ptr AnnotCircle ->                      -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotCircle"})
    Ptr Poppler.Color.Color ->              -- poppler_color : TInterface (Name {namespace = "Poppler", name = "Color"})
    IO ()

{- |
Sets the interior color of /@popplerAnnot@/.

/Since: 0.26/
-}
annotCircleSetInteriorColor ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotCircle a) =>
    a
    {- ^ /@popplerAnnot@/: a 'GI.Poppler.Objects.AnnotCircle.AnnotCircle' -}
    -> Maybe (Poppler.Color.Color)
    {- ^ /@popplerColor@/: a 'GI.Poppler.Structs.Color.Color', or 'Nothing' -}
    -> m ()
annotCircleSetInteriorColor popplerAnnot popplerColor = liftIO $ do
    popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
    maybePopplerColor <- case popplerColor of
        Nothing -> return nullPtr
        Just jPopplerColor -> do
            jPopplerColor' <- unsafeManagedPtrGetPtr jPopplerColor
            return jPopplerColor'
    poppler_annot_circle_set_interior_color popplerAnnot' maybePopplerColor
    touchManagedPtr popplerAnnot
    whenJust popplerColor touchManagedPtr
    return ()

#if ENABLE_OVERLOADING
data AnnotCircleSetInteriorColorMethodInfo
instance (signature ~ (Maybe (Poppler.Color.Color) -> m ()), MonadIO m, IsAnnotCircle a) => O.MethodInfo AnnotCircleSetInteriorColorMethodInfo a signature where
    overloadedMethod _ = annotCircleSetInteriorColor

#endif