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

-- * Exported types
    AnnotSquare(..)                         ,
    IsAnnotSquare                           ,
    toAnnotSquare                           ,
    noAnnotSquare                           ,


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

#if ENABLE_OVERLOADING
    AnnotSquareGetInteriorColorMethodInfo   ,
#endif
    annotSquareGetInteriorColor             ,


-- ** new #method:new#

    annotSquareNew                          ,


-- ** setInteriorColor #method:setInteriorColor#

#if ENABLE_OVERLOADING
    AnnotSquareSetInteriorColorMethodInfo   ,
#endif
    annotSquareSetInteriorColor             ,




    ) 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 AnnotSquare = AnnotSquare (ManagedPtr AnnotSquare)
foreign import ccall "poppler_annot_square_get_type"
    c_poppler_annot_square_get_type :: IO GType

instance GObject AnnotSquare where
    gobjectType = c_poppler_annot_square_get_type


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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `AnnotSquare`.
noAnnotSquare :: Maybe AnnotSquare
noAnnotSquare = Nothing

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

instance (info ~ ResolveAnnotSquareMethod t AnnotSquare, O.MethodInfo info AnnotSquare p) => OL.IsLabel t (AnnotSquare -> 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 AnnotSquare
type instance O.AttributeList AnnotSquare = AnnotSquareAttributeList
type AnnotSquareAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

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

#endif

-- method AnnotSquare::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 = "AnnotSquare"}))
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_square_new" poppler_annot_square_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 AnnotSquare)

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

/Since: 0.26/
-}
annotSquareNew ::
    (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 AnnotSquare
    {- ^ __Returns:__ a newly created 'GI.Poppler.Objects.AnnotSquare.AnnotSquare' annotation -}
annotSquareNew doc rect = liftIO $ do
    doc' <- unsafeManagedPtrCastPtr doc
    rect' <- unsafeManagedPtrGetPtr rect
    result <- poppler_annot_square_new doc' rect'
    checkUnexpectedReturnNULL "annotSquareNew" result
    result' <- (wrapObject AnnotSquare) result
    touchManagedPtr doc
    touchManagedPtr rect
    return result'

#if ENABLE_OVERLOADING
#endif

-- method AnnotSquare::get_interior_color
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotSquare"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotSquare", 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_square_get_interior_color" poppler_annot_square_get_interior_color ::
    Ptr AnnotSquare ->                      -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotSquare"})
    IO (Ptr Poppler.Color.Color)

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

/Since: 0.26/
-}
annotSquareGetInteriorColor ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotSquare a) =>
    a
    {- ^ /@popplerAnnot@/: a 'GI.Poppler.Objects.AnnotSquare.AnnotSquare' -}
    -> 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. -}
annotSquareGetInteriorColor popplerAnnot = liftIO $ do
    popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
    result <- poppler_annot_square_get_interior_color popplerAnnot'
    checkUnexpectedReturnNULL "annotSquareGetInteriorColor" result
    result' <- (wrapBoxed Poppler.Color.Color) result
    touchManagedPtr popplerAnnot
    return result'

#if ENABLE_OVERLOADING
data AnnotSquareGetInteriorColorMethodInfo
instance (signature ~ (m Poppler.Color.Color), MonadIO m, IsAnnotSquare a) => O.MethodInfo AnnotSquareGetInteriorColorMethodInfo a signature where
    overloadedMethod _ = annotSquareGetInteriorColor

#endif

-- method AnnotSquare::set_interior_color
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotSquare"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotSquare", 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_square_set_interior_color" poppler_annot_square_set_interior_color ::
    Ptr AnnotSquare ->                      -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotSquare"})
    Ptr Poppler.Color.Color ->              -- poppler_color : TInterface (Name {namespace = "Poppler", name = "Color"})
    IO ()

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

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

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

#endif