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

GdkMonitor objects represent the individual outputs that are
associated with a 'GI.Gdk.Objects.Display.Display'. GdkDisplay has APIs to enumerate
monitors with @/gdk_display_get_monitors()/@ and to find particular
monitors with 'GI.Gdk.Objects.Display.displayGetPrimaryMonitor' or
'GI.Gdk.Objects.Display.displayGetMonitorAtWindow'.

GdkMonitor was introduced in GTK+ 3.22 and supersedes earlier
APIs in GdkScreen to obtain monitor-related information.
-}

module GI.Gdk.Objects.Monitor
    ( 

-- * Exported types
    Monitor(..)                             ,
    IsMonitor                               ,
    toMonitor                               ,
    noMonitor                               ,


 -- * Methods
-- ** getDisplay #method:getDisplay#
    MonitorGetDisplayMethodInfo             ,
    monitorGetDisplay                       ,


-- ** getGeometry #method:getGeometry#
    MonitorGetGeometryMethodInfo            ,
    monitorGetGeometry                      ,


-- ** getHeightMm #method:getHeightMm#
    MonitorGetHeightMmMethodInfo            ,
    monitorGetHeightMm                      ,


-- ** getManufacturer #method:getManufacturer#
    MonitorGetManufacturerMethodInfo        ,
    monitorGetManufacturer                  ,


-- ** getModel #method:getModel#
    MonitorGetModelMethodInfo               ,
    monitorGetModel                         ,


-- ** getRefreshRate #method:getRefreshRate#
    MonitorGetRefreshRateMethodInfo         ,
    monitorGetRefreshRate                   ,


-- ** getScaleFactor #method:getScaleFactor#
    MonitorGetScaleFactorMethodInfo         ,
    monitorGetScaleFactor                   ,


-- ** getSubpixelLayout #method:getSubpixelLayout#
    MonitorGetSubpixelLayoutMethodInfo      ,
    monitorGetSubpixelLayout                ,


-- ** getWidthMm #method:getWidthMm#
    MonitorGetWidthMmMethodInfo             ,
    monitorGetWidthMm                       ,


-- ** getWorkarea #method:getWorkarea#
    MonitorGetWorkareaMethodInfo            ,
    monitorGetWorkarea                      ,


-- ** isPrimary #method:isPrimary#
    MonitorIsPrimaryMethodInfo              ,
    monitorIsPrimary                        ,




 -- * Properties
-- ** display #attr:display#
    MonitorDisplayPropertyInfo              ,
    constructMonitorDisplay                 ,
    getMonitorDisplay                       ,
    monitorDisplay                          ,


-- ** geometry #attr:geometry#
    MonitorGeometryPropertyInfo             ,
    getMonitorGeometry                      ,
    monitorGeometry                         ,


-- ** heightMm #attr:heightMm#
    MonitorHeightMmPropertyInfo             ,
    getMonitorHeightMm                      ,
    monitorHeightMm                         ,


-- ** manufacturer #attr:manufacturer#
    MonitorManufacturerPropertyInfo         ,
    getMonitorManufacturer                  ,
    monitorManufacturer                     ,


-- ** model #attr:model#
    MonitorModelPropertyInfo                ,
    getMonitorModel                         ,
    monitorModel                            ,


-- ** refreshRate #attr:refreshRate#
    MonitorRefreshRatePropertyInfo          ,
    getMonitorRefreshRate                   ,
    monitorRefreshRate                      ,


-- ** scaleFactor #attr:scaleFactor#
    MonitorScaleFactorPropertyInfo          ,
    getMonitorScaleFactor                   ,
    monitorScaleFactor                      ,


-- ** subpixelLayout #attr:subpixelLayout#
    MonitorSubpixelLayoutPropertyInfo       ,
    getMonitorSubpixelLayout                ,
    monitorSubpixelLayout                   ,


-- ** widthMm #attr:widthMm#
    MonitorWidthMmPropertyInfo              ,
    getMonitorWidthMm                       ,
    monitorWidthMm                          ,


-- ** workarea #attr:workarea#
    MonitorWorkareaPropertyInfo             ,
    getMonitorWorkarea                      ,
    monitorWorkarea                         ,




 -- * Signals
-- ** invalidate #signal:invalidate#
    C_MonitorInvalidateCallback             ,
    MonitorInvalidateCallback               ,
    MonitorInvalidateSignalInfo             ,
    afterMonitorInvalidate                  ,
    genClosure_MonitorInvalidate            ,
    mk_MonitorInvalidateCallback            ,
    noMonitorInvalidateCallback             ,
    onMonitorInvalidate                     ,
    wrap_MonitorInvalidateCallback          ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Objects.Display as Gdk.Display
import {-# SOURCE #-} qualified GI.Gdk.Structs.Rectangle as Gdk.Rectangle

newtype Monitor = Monitor (ManagedPtr Monitor)
foreign import ccall "gdk_monitor_get_type"
    c_gdk_monitor_get_type :: IO GType

instance GObject Monitor where
    gobjectType _ = c_gdk_monitor_get_type
    

class GObject o => IsMonitor o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError Monitor a) =>
    IsMonitor a
#endif
instance IsMonitor Monitor
instance GObject.Object.IsObject Monitor

toMonitor :: IsMonitor o => o -> IO Monitor
toMonitor = unsafeCastTo Monitor

noMonitor :: Maybe Monitor
noMonitor = Nothing

type family ResolveMonitorMethod (t :: Symbol) (o :: *) :: * where
    ResolveMonitorMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveMonitorMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveMonitorMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveMonitorMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveMonitorMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveMonitorMethod "isPrimary" o = MonitorIsPrimaryMethodInfo
    ResolveMonitorMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveMonitorMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveMonitorMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveMonitorMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveMonitorMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveMonitorMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveMonitorMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveMonitorMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveMonitorMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveMonitorMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveMonitorMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveMonitorMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveMonitorMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveMonitorMethod "getDisplay" o = MonitorGetDisplayMethodInfo
    ResolveMonitorMethod "getGeometry" o = MonitorGetGeometryMethodInfo
    ResolveMonitorMethod "getHeightMm" o = MonitorGetHeightMmMethodInfo
    ResolveMonitorMethod "getManufacturer" o = MonitorGetManufacturerMethodInfo
    ResolveMonitorMethod "getModel" o = MonitorGetModelMethodInfo
    ResolveMonitorMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveMonitorMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveMonitorMethod "getRefreshRate" o = MonitorGetRefreshRateMethodInfo
    ResolveMonitorMethod "getScaleFactor" o = MonitorGetScaleFactorMethodInfo
    ResolveMonitorMethod "getSubpixelLayout" o = MonitorGetSubpixelLayoutMethodInfo
    ResolveMonitorMethod "getWidthMm" o = MonitorGetWidthMmMethodInfo
    ResolveMonitorMethod "getWorkarea" o = MonitorGetWorkareaMethodInfo
    ResolveMonitorMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveMonitorMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveMonitorMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveMonitorMethod t Monitor, O.MethodInfo info Monitor p) => O.IsLabelProxy t (Monitor -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveMonitorMethod t Monitor, O.MethodInfo info Monitor p) => O.IsLabel t (Monitor -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

-- signal Monitor::invalidate
type MonitorInvalidateCallback =
    IO ()

noMonitorInvalidateCallback :: Maybe MonitorInvalidateCallback
noMonitorInvalidateCallback = Nothing

type C_MonitorInvalidateCallback =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mk_MonitorInvalidateCallback :: C_MonitorInvalidateCallback -> IO (FunPtr C_MonitorInvalidateCallback)

genClosure_MonitorInvalidate :: MonitorInvalidateCallback -> IO Closure
genClosure_MonitorInvalidate cb = do
    let cb' = wrap_MonitorInvalidateCallback cb
    mk_MonitorInvalidateCallback cb' >>= newCClosure


wrap_MonitorInvalidateCallback ::
    MonitorInvalidateCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
wrap_MonitorInvalidateCallback _cb _ _ = do
    _cb 


onMonitorInvalidate :: (IsMonitor a, MonadIO m) => a -> MonitorInvalidateCallback -> m SignalHandlerId
onMonitorInvalidate obj cb = liftIO $ do
    let cb' = wrap_MonitorInvalidateCallback cb
    cb'' <- mk_MonitorInvalidateCallback cb'
    connectSignalFunPtr obj "invalidate" cb'' SignalConnectBefore

afterMonitorInvalidate :: (IsMonitor a, MonadIO m) => a -> MonitorInvalidateCallback -> m SignalHandlerId
afterMonitorInvalidate obj cb = liftIO $ do
    let cb' = wrap_MonitorInvalidateCallback cb
    cb'' <- mk_MonitorInvalidateCallback cb'
    connectSignalFunPtr obj "invalidate" cb'' SignalConnectAfter


-- VVV Prop "display"
   -- Type: TInterface (Name {namespace = "Gdk", name = "Display"})
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
   -- Nullable: (Just False,Nothing)

getMonitorDisplay :: (MonadIO m, IsMonitor o) => o -> m Gdk.Display.Display
getMonitorDisplay obj = liftIO $ checkUnexpectedNothing "getMonitorDisplay" $ getObjectPropertyObject obj "display" Gdk.Display.Display

constructMonitorDisplay :: (IsMonitor o, Gdk.Display.IsDisplay a) => a -> IO (GValueConstruct o)
constructMonitorDisplay val = constructObjectPropertyObject "display" (Just val)

data MonitorDisplayPropertyInfo
instance AttrInfo MonitorDisplayPropertyInfo where
    type AttrAllowedOps MonitorDisplayPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MonitorDisplayPropertyInfo = Gdk.Display.IsDisplay
    type AttrBaseTypeConstraint MonitorDisplayPropertyInfo = IsMonitor
    type AttrGetType MonitorDisplayPropertyInfo = Gdk.Display.Display
    type AttrLabel MonitorDisplayPropertyInfo = "display"
    type AttrOrigin MonitorDisplayPropertyInfo = Monitor
    attrGet _ = getMonitorDisplay
    attrSet _ = undefined
    attrConstruct _ = constructMonitorDisplay
    attrClear _ = undefined

-- VVV Prop "geometry"
   -- Type: TInterface (Name {namespace = "Gdk", name = "Rectangle"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMonitorGeometry :: (MonadIO m, IsMonitor o) => o -> m (Maybe Gdk.Rectangle.Rectangle)
getMonitorGeometry obj = liftIO $ getObjectPropertyBoxed obj "geometry" Gdk.Rectangle.Rectangle

data MonitorGeometryPropertyInfo
instance AttrInfo MonitorGeometryPropertyInfo where
    type AttrAllowedOps MonitorGeometryPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MonitorGeometryPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorGeometryPropertyInfo = IsMonitor
    type AttrGetType MonitorGeometryPropertyInfo = (Maybe Gdk.Rectangle.Rectangle)
    type AttrLabel MonitorGeometryPropertyInfo = "geometry"
    type AttrOrigin MonitorGeometryPropertyInfo = Monitor
    attrGet _ = getMonitorGeometry
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "height-mm"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getMonitorHeightMm :: (MonadIO m, IsMonitor o) => o -> m Int32
getMonitorHeightMm obj = liftIO $ getObjectPropertyInt32 obj "height-mm"

data MonitorHeightMmPropertyInfo
instance AttrInfo MonitorHeightMmPropertyInfo where
    type AttrAllowedOps MonitorHeightMmPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MonitorHeightMmPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorHeightMmPropertyInfo = IsMonitor
    type AttrGetType MonitorHeightMmPropertyInfo = Int32
    type AttrLabel MonitorHeightMmPropertyInfo = "height-mm"
    type AttrOrigin MonitorHeightMmPropertyInfo = Monitor
    attrGet _ = getMonitorHeightMm
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "manufacturer"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Nothing)

getMonitorManufacturer :: (MonadIO m, IsMonitor o) => o -> m (Maybe T.Text)
getMonitorManufacturer obj = liftIO $ getObjectPropertyString obj "manufacturer"

data MonitorManufacturerPropertyInfo
instance AttrInfo MonitorManufacturerPropertyInfo where
    type AttrAllowedOps MonitorManufacturerPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MonitorManufacturerPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorManufacturerPropertyInfo = IsMonitor
    type AttrGetType MonitorManufacturerPropertyInfo = (Maybe T.Text)
    type AttrLabel MonitorManufacturerPropertyInfo = "manufacturer"
    type AttrOrigin MonitorManufacturerPropertyInfo = Monitor
    attrGet _ = getMonitorManufacturer
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "model"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]
   -- Nullable: (Just True,Nothing)

getMonitorModel :: (MonadIO m, IsMonitor o) => o -> m (Maybe T.Text)
getMonitorModel obj = liftIO $ getObjectPropertyString obj "model"

data MonitorModelPropertyInfo
instance AttrInfo MonitorModelPropertyInfo where
    type AttrAllowedOps MonitorModelPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MonitorModelPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorModelPropertyInfo = IsMonitor
    type AttrGetType MonitorModelPropertyInfo = (Maybe T.Text)
    type AttrLabel MonitorModelPropertyInfo = "model"
    type AttrOrigin MonitorModelPropertyInfo = Monitor
    attrGet _ = getMonitorModel
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "refresh-rate"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getMonitorRefreshRate :: (MonadIO m, IsMonitor o) => o -> m Int32
getMonitorRefreshRate obj = liftIO $ getObjectPropertyInt32 obj "refresh-rate"

data MonitorRefreshRatePropertyInfo
instance AttrInfo MonitorRefreshRatePropertyInfo where
    type AttrAllowedOps MonitorRefreshRatePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MonitorRefreshRatePropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorRefreshRatePropertyInfo = IsMonitor
    type AttrGetType MonitorRefreshRatePropertyInfo = Int32
    type AttrLabel MonitorRefreshRatePropertyInfo = "refresh-rate"
    type AttrOrigin MonitorRefreshRatePropertyInfo = Monitor
    attrGet _ = getMonitorRefreshRate
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "scale-factor"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getMonitorScaleFactor :: (MonadIO m, IsMonitor o) => o -> m Int32
getMonitorScaleFactor obj = liftIO $ getObjectPropertyInt32 obj "scale-factor"

data MonitorScaleFactorPropertyInfo
instance AttrInfo MonitorScaleFactorPropertyInfo where
    type AttrAllowedOps MonitorScaleFactorPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MonitorScaleFactorPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorScaleFactorPropertyInfo = IsMonitor
    type AttrGetType MonitorScaleFactorPropertyInfo = Int32
    type AttrLabel MonitorScaleFactorPropertyInfo = "scale-factor"
    type AttrOrigin MonitorScaleFactorPropertyInfo = Monitor
    attrGet _ = getMonitorScaleFactor
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "subpixel-layout"
   -- Type: TInterface (Name {namespace = "Gdk", name = "SubpixelLayout"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getMonitorSubpixelLayout :: (MonadIO m, IsMonitor o) => o -> m Gdk.Enums.SubpixelLayout
getMonitorSubpixelLayout obj = liftIO $ getObjectPropertyEnum obj "subpixel-layout"

data MonitorSubpixelLayoutPropertyInfo
instance AttrInfo MonitorSubpixelLayoutPropertyInfo where
    type AttrAllowedOps MonitorSubpixelLayoutPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MonitorSubpixelLayoutPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorSubpixelLayoutPropertyInfo = IsMonitor
    type AttrGetType MonitorSubpixelLayoutPropertyInfo = Gdk.Enums.SubpixelLayout
    type AttrLabel MonitorSubpixelLayoutPropertyInfo = "subpixel-layout"
    type AttrOrigin MonitorSubpixelLayoutPropertyInfo = Monitor
    attrGet _ = getMonitorSubpixelLayout
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "width-mm"
   -- Type: TBasicType TInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getMonitorWidthMm :: (MonadIO m, IsMonitor o) => o -> m Int32
getMonitorWidthMm obj = liftIO $ getObjectPropertyInt32 obj "width-mm"

data MonitorWidthMmPropertyInfo
instance AttrInfo MonitorWidthMmPropertyInfo where
    type AttrAllowedOps MonitorWidthMmPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint MonitorWidthMmPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorWidthMmPropertyInfo = IsMonitor
    type AttrGetType MonitorWidthMmPropertyInfo = Int32
    type AttrLabel MonitorWidthMmPropertyInfo = "width-mm"
    type AttrOrigin MonitorWidthMmPropertyInfo = Monitor
    attrGet _ = getMonitorWidthMm
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "workarea"
   -- Type: TInterface (Name {namespace = "Gdk", name = "Rectangle"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getMonitorWorkarea :: (MonadIO m, IsMonitor o) => o -> m (Maybe Gdk.Rectangle.Rectangle)
getMonitorWorkarea obj = liftIO $ getObjectPropertyBoxed obj "workarea" Gdk.Rectangle.Rectangle

data MonitorWorkareaPropertyInfo
instance AttrInfo MonitorWorkareaPropertyInfo where
    type AttrAllowedOps MonitorWorkareaPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint MonitorWorkareaPropertyInfo = (~) ()
    type AttrBaseTypeConstraint MonitorWorkareaPropertyInfo = IsMonitor
    type AttrGetType MonitorWorkareaPropertyInfo = (Maybe Gdk.Rectangle.Rectangle)
    type AttrLabel MonitorWorkareaPropertyInfo = "workarea"
    type AttrOrigin MonitorWorkareaPropertyInfo = Monitor
    attrGet _ = getMonitorWorkarea
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList Monitor
type instance O.AttributeList Monitor = MonitorAttributeList
type MonitorAttributeList = ('[ '("display", MonitorDisplayPropertyInfo), '("geometry", MonitorGeometryPropertyInfo), '("heightMm", MonitorHeightMmPropertyInfo), '("manufacturer", MonitorManufacturerPropertyInfo), '("model", MonitorModelPropertyInfo), '("refreshRate", MonitorRefreshRatePropertyInfo), '("scaleFactor", MonitorScaleFactorPropertyInfo), '("subpixelLayout", MonitorSubpixelLayoutPropertyInfo), '("widthMm", MonitorWidthMmPropertyInfo), '("workarea", MonitorWorkareaPropertyInfo)] :: [(Symbol, *)])

monitorDisplay :: AttrLabelProxy "display"
monitorDisplay = AttrLabelProxy

monitorGeometry :: AttrLabelProxy "geometry"
monitorGeometry = AttrLabelProxy

monitorHeightMm :: AttrLabelProxy "heightMm"
monitorHeightMm = AttrLabelProxy

monitorManufacturer :: AttrLabelProxy "manufacturer"
monitorManufacturer = AttrLabelProxy

monitorModel :: AttrLabelProxy "model"
monitorModel = AttrLabelProxy

monitorRefreshRate :: AttrLabelProxy "refreshRate"
monitorRefreshRate = AttrLabelProxy

monitorScaleFactor :: AttrLabelProxy "scaleFactor"
monitorScaleFactor = AttrLabelProxy

monitorSubpixelLayout :: AttrLabelProxy "subpixelLayout"
monitorSubpixelLayout = AttrLabelProxy

monitorWidthMm :: AttrLabelProxy "widthMm"
monitorWidthMm = AttrLabelProxy

monitorWorkarea :: AttrLabelProxy "workarea"
monitorWorkarea = AttrLabelProxy

data MonitorInvalidateSignalInfo
instance SignalInfo MonitorInvalidateSignalInfo where
    type HaskellCallbackType MonitorInvalidateSignalInfo = MonitorInvalidateCallback
    connectSignal _ obj cb connectMode = do
        let cb' = wrap_MonitorInvalidateCallback cb
        cb'' <- mk_MonitorInvalidateCallback cb'
        connectSignalFunPtr obj "invalidate" cb'' connectMode

type instance O.SignalList Monitor = MonitorSignalList
type MonitorSignalList = ('[ '("invalidate", MonitorInvalidateSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Monitor::get_display
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "Display"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_display" gdk_monitor_get_display :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO (Ptr Gdk.Display.Display)

{- |
Gets the display that this monitor belongs to.

@since 3.22
-}
monitorGetDisplay ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Gdk.Display.Display
    {- ^ __Returns:__ the display -}
monitorGetDisplay monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_display monitor'
    checkUnexpectedReturnNULL "monitorGetDisplay" result
    result' <- (newObject Gdk.Display.Display) result
    touchManagedPtr monitor
    return result'

data MonitorGetDisplayMethodInfo
instance (signature ~ (m Gdk.Display.Display), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetDisplayMethodInfo a signature where
    overloadedMethod _ = monitorGetDisplay

-- method Monitor::get_geometry
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "geometry", argType = TInterface (Name {namespace = "Gdk", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkRectangle to be filled wiht the monitor geometry", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_geometry" gdk_monitor_get_geometry :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    Ptr Gdk.Rectangle.Rectangle ->          -- geometry : TInterface (Name {namespace = "Gdk", name = "Rectangle"})
    IO ()

{- |
Retrieves the size and position of an individual monitor within the
display coordinate space. The returned geometry is in  ”application pixels”,
not in ”device pixels” (see 'GI.Gdk.Objects.Monitor.monitorGetScaleFactor').

@since 3.22
-}
monitorGetGeometry ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m (Gdk.Rectangle.Rectangle)
monitorGetGeometry monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    geometry <- callocBoxedBytes 16 :: IO (Ptr Gdk.Rectangle.Rectangle)
    gdk_monitor_get_geometry monitor' geometry
    geometry' <- (wrapBoxed Gdk.Rectangle.Rectangle) geometry
    touchManagedPtr monitor
    return geometry'

data MonitorGetGeometryMethodInfo
instance (signature ~ (m (Gdk.Rectangle.Rectangle)), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetGeometryMethodInfo a signature where
    overloadedMethod _ = monitorGetGeometry

-- method Monitor::get_height_mm
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_height_mm" gdk_monitor_get_height_mm :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO Int32

{- |
Gets the height in millimeters of the monitor.

@since 3.22
-}
monitorGetHeightMm ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Int32
    {- ^ __Returns:__ the physical height of the monitor -}
monitorGetHeightMm monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_height_mm monitor'
    touchManagedPtr monitor
    return result

data MonitorGetHeightMmMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetHeightMmMethodInfo a signature where
    overloadedMethod _ = monitorGetHeightMm

-- method Monitor::get_manufacturer
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_manufacturer" gdk_monitor_get_manufacturer :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO CString

{- |
Gets the name of the monitor\'s manufacturer, if available.
-}
monitorGetManufacturer ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the name of the manufacturer, or 'Nothing' -}
monitorGetManufacturer monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_manufacturer monitor'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr monitor
    return maybeResult

data MonitorGetManufacturerMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetManufacturerMethodInfo a signature where
    overloadedMethod _ = monitorGetManufacturer

-- method Monitor::get_model
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_model" gdk_monitor_get_model :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO CString

{- |
Gets the a string identifying the monitor model, if available.
-}
monitorGetModel ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the monitor model, or 'Nothing' -}
monitorGetModel monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_model monitor'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr monitor
    return maybeResult

data MonitorGetModelMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetModelMethodInfo a signature where
    overloadedMethod _ = monitorGetModel

-- method Monitor::get_refresh_rate
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_refresh_rate" gdk_monitor_get_refresh_rate :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO Int32

{- |
Gets the refresh rate of the monitor, if available.

The value is in milli-Hertz, so a refresh rate of 60Hz
is returned as 60000.

@since 3.22
-}
monitorGetRefreshRate ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Int32
    {- ^ __Returns:__ the refresh rate in milli-Hertz, or 0 -}
monitorGetRefreshRate monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_refresh_rate monitor'
    touchManagedPtr monitor
    return result

data MonitorGetRefreshRateMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetRefreshRateMethodInfo a signature where
    overloadedMethod _ = monitorGetRefreshRate

-- method Monitor::get_scale_factor
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_scale_factor" gdk_monitor_get_scale_factor :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO Int32

{- |
Gets the internal scale factor that maps from monitor coordinates
to the actual device pixels. On traditional systems this is 1, but
on very high density outputs this can be a higher value (often 2).

This can be used if you want to create pixel based data for a
particular monitor, but most of the time you’re drawing to a window
where it is better to use 'GI.Gdk.Objects.Window.windowGetScaleFactor' instead.

@since 3.22
-}
monitorGetScaleFactor ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Int32
    {- ^ __Returns:__ the scale factor -}
monitorGetScaleFactor monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_scale_factor monitor'
    touchManagedPtr monitor
    return result

data MonitorGetScaleFactorMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetScaleFactorMethodInfo a signature where
    overloadedMethod _ = monitorGetScaleFactor

-- method Monitor::get_subpixel_layout
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gdk", name = "SubpixelLayout"}))
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_subpixel_layout" gdk_monitor_get_subpixel_layout :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO CUInt

{- |
Gets information about the layout of red, green and blue
primaries for each pixel in this monitor, if available.

@since 3.22
-}
monitorGetSubpixelLayout ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Gdk.Enums.SubpixelLayout
    {- ^ __Returns:__ the subpixel layout -}
monitorGetSubpixelLayout monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_subpixel_layout monitor'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr monitor
    return result'

data MonitorGetSubpixelLayoutMethodInfo
instance (signature ~ (m Gdk.Enums.SubpixelLayout), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetSubpixelLayoutMethodInfo a signature where
    overloadedMethod _ = monitorGetSubpixelLayout

-- method Monitor::get_width_mm
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_width_mm" gdk_monitor_get_width_mm :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO Int32

{- |
Gets the width in millimeters of the monitor.

@since 3.22
-}
monitorGetWidthMm ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Int32
    {- ^ __Returns:__ the physical width of the monitor -}
monitorGetWidthMm monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_get_width_mm monitor'
    touchManagedPtr monitor
    return result

data MonitorGetWidthMmMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetWidthMmMethodInfo a signature where
    overloadedMethod _ = monitorGetWidthMm

-- method Monitor::get_workarea
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "workarea", argType = TInterface (Name {namespace = "Gdk", name = "Rectangle"}), direction = DirectionOut, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkRectangle to be filled with\n    the monitor workarea", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = True, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_get_workarea" gdk_monitor_get_workarea :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    Ptr Gdk.Rectangle.Rectangle ->          -- workarea : TInterface (Name {namespace = "Gdk", name = "Rectangle"})
    IO ()

{- |
Retrieves the size and position of the “work area” on a monitor
within the display coordinate space. The returned geometry is in
”application pixels”, not in ”device pixels” (see
'GI.Gdk.Objects.Monitor.monitorGetScaleFactor').

The work area should be considered when positioning menus and
similar popups, to avoid placing them below panels, docks or other
desktop components.

Note that not all backends may have a concept of workarea. This
function will return the monitor geometry if a workarea is not
available, or does not apply.

@since 3.22
-}
monitorGetWorkarea ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m (Gdk.Rectangle.Rectangle)
monitorGetWorkarea monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    workarea <- callocBoxedBytes 16 :: IO (Ptr Gdk.Rectangle.Rectangle)
    gdk_monitor_get_workarea monitor' workarea
    workarea' <- (wrapBoxed Gdk.Rectangle.Rectangle) workarea
    touchManagedPtr monitor
    return workarea'

data MonitorGetWorkareaMethodInfo
instance (signature ~ (m (Gdk.Rectangle.Rectangle)), MonadIO m, IsMonitor a) => O.MethodInfo MonitorGetWorkareaMethodInfo a signature where
    overloadedMethod _ = monitorGetWorkarea

-- method Monitor::is_primary
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "monitor", argType = TInterface (Name {namespace = "Gdk", name = "Monitor"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkMonitor", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "gdk_monitor_is_primary" gdk_monitor_is_primary :: 
    Ptr Monitor ->                          -- monitor : TInterface (Name {namespace = "Gdk", name = "Monitor"})
    IO CInt

{- |
Gets whether this monitor should be considered primary
(see 'GI.Gdk.Objects.Display.displayGetPrimaryMonitor').

@since 3.22
-}
monitorIsPrimary ::
    (B.CallStack.HasCallStack, MonadIO m, IsMonitor a) =>
    a
    {- ^ /@monitor@/: a 'GI.Gdk.Objects.Monitor.Monitor' -}
    -> m Bool
    {- ^ __Returns:__ 'True' if /@monitor@/ is primary -}
monitorIsPrimary monitor = liftIO $ do
    monitor' <- unsafeManagedPtrCastPtr monitor
    result <- gdk_monitor_is_primary monitor'
    let result' = (/= 0) result
    touchManagedPtr monitor
    return result'

data MonitorIsPrimaryMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsMonitor a) => O.MethodInfo MonitorIsPrimaryMethodInfo a signature where
    overloadedMethod _ = monitorIsPrimary