{- |
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.Gtk.Objects.Misc
    ( 

-- * Exported types
    Misc(..)                                ,
    MiscK                                   ,
    toMisc                                  ,
    noMisc                                  ,


 -- * Methods
-- ** miscGetAlignment
    miscGetAlignment                        ,


-- ** miscGetPadding
    miscGetPadding                          ,


-- ** miscSetAlignment
    miscSetAlignment                        ,


-- ** miscSetPadding
    miscSetPadding                          ,




 -- * Properties
-- ** Xalign
    MiscXalignPropertyInfo                  ,
    constructMiscXalign                     ,
    getMiscXalign                           ,
    setMiscXalign                           ,


-- ** Xpad
    MiscXpadPropertyInfo                    ,
    constructMiscXpad                       ,
    getMiscXpad                             ,
    setMiscXpad                             ,


-- ** Yalign
    MiscYalignPropertyInfo                  ,
    constructMiscYalign                     ,
    getMiscYalign                           ,
    setMiscYalign                           ,


-- ** Ypad
    MiscYpadPropertyInfo                    ,
    constructMiscYpad                       ,
    getMiscYpad                             ,
    setMiscYpad                             ,




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

newtype Misc = Misc (ForeignPtr Misc)
foreign import ccall "gtk_misc_get_type"
    c_gtk_misc_get_type :: IO GType

type instance ParentTypes Misc = MiscParentTypes
type MiscParentTypes = '[Widget, GObject.Object, Atk.ImplementorIface, Buildable]

instance GObject Misc where
    gobjectIsInitiallyUnowned _ = True
    gobjectType _ = c_gtk_misc_get_type
    

class GObject o => MiscK o
instance (GObject o, IsDescendantOf Misc o) => MiscK o

toMisc :: MiscK o => o -> IO Misc
toMisc = unsafeCastTo Misc

noMisc :: Maybe Misc
noMisc = Nothing

-- VVV Prop "xalign"
   -- Type: TBasicType TFloat
   -- Flags: [PropertyReadable,PropertyWritable]

getMiscXalign :: (MonadIO m, MiscK o) => o -> m Float
getMiscXalign obj = liftIO $ getObjectPropertyFloat obj "xalign"

setMiscXalign :: (MonadIO m, MiscK o) => o -> Float -> m ()
setMiscXalign obj val = liftIO $ setObjectPropertyFloat obj "xalign" val

constructMiscXalign :: Float -> IO ([Char], GValue)
constructMiscXalign val = constructObjectPropertyFloat "xalign" val

data MiscXalignPropertyInfo
instance AttrInfo MiscXalignPropertyInfo where
    type AttrAllowedOps MiscXalignPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MiscXalignPropertyInfo = (~) Float
    type AttrBaseTypeConstraint MiscXalignPropertyInfo = MiscK
    type AttrGetType MiscXalignPropertyInfo = Float
    type AttrLabel MiscXalignPropertyInfo = "Misc::xalign"
    attrGet _ = getMiscXalign
    attrSet _ = setMiscXalign
    attrConstruct _ = constructMiscXalign

-- VVV Prop "xpad"
   -- Type: TBasicType TInt32
   -- Flags: [PropertyReadable,PropertyWritable]

getMiscXpad :: (MonadIO m, MiscK o) => o -> m Int32
getMiscXpad obj = liftIO $ getObjectPropertyCInt obj "xpad"

setMiscXpad :: (MonadIO m, MiscK o) => o -> Int32 -> m ()
setMiscXpad obj val = liftIO $ setObjectPropertyCInt obj "xpad" val

constructMiscXpad :: Int32 -> IO ([Char], GValue)
constructMiscXpad val = constructObjectPropertyCInt "xpad" val

data MiscXpadPropertyInfo
instance AttrInfo MiscXpadPropertyInfo where
    type AttrAllowedOps MiscXpadPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MiscXpadPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint MiscXpadPropertyInfo = MiscK
    type AttrGetType MiscXpadPropertyInfo = Int32
    type AttrLabel MiscXpadPropertyInfo = "Misc::xpad"
    attrGet _ = getMiscXpad
    attrSet _ = setMiscXpad
    attrConstruct _ = constructMiscXpad

-- VVV Prop "yalign"
   -- Type: TBasicType TFloat
   -- Flags: [PropertyReadable,PropertyWritable]

getMiscYalign :: (MonadIO m, MiscK o) => o -> m Float
getMiscYalign obj = liftIO $ getObjectPropertyFloat obj "yalign"

setMiscYalign :: (MonadIO m, MiscK o) => o -> Float -> m ()
setMiscYalign obj val = liftIO $ setObjectPropertyFloat obj "yalign" val

constructMiscYalign :: Float -> IO ([Char], GValue)
constructMiscYalign val = constructObjectPropertyFloat "yalign" val

data MiscYalignPropertyInfo
instance AttrInfo MiscYalignPropertyInfo where
    type AttrAllowedOps MiscYalignPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MiscYalignPropertyInfo = (~) Float
    type AttrBaseTypeConstraint MiscYalignPropertyInfo = MiscK
    type AttrGetType MiscYalignPropertyInfo = Float
    type AttrLabel MiscYalignPropertyInfo = "Misc::yalign"
    attrGet _ = getMiscYalign
    attrSet _ = setMiscYalign
    attrConstruct _ = constructMiscYalign

-- VVV Prop "ypad"
   -- Type: TBasicType TInt32
   -- Flags: [PropertyReadable,PropertyWritable]

getMiscYpad :: (MonadIO m, MiscK o) => o -> m Int32
getMiscYpad obj = liftIO $ getObjectPropertyCInt obj "ypad"

setMiscYpad :: (MonadIO m, MiscK o) => o -> Int32 -> m ()
setMiscYpad obj val = liftIO $ setObjectPropertyCInt obj "ypad" val

constructMiscYpad :: Int32 -> IO ([Char], GValue)
constructMiscYpad val = constructObjectPropertyCInt "ypad" val

data MiscYpadPropertyInfo
instance AttrInfo MiscYpadPropertyInfo where
    type AttrAllowedOps MiscYpadPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint MiscYpadPropertyInfo = (~) Int32
    type AttrBaseTypeConstraint MiscYpadPropertyInfo = MiscK
    type AttrGetType MiscYpadPropertyInfo = Int32
    type AttrLabel MiscYpadPropertyInfo = "Misc::ypad"
    attrGet _ = getMiscYpad
    attrSet _ = setMiscYpad
    attrConstruct _ = constructMiscYpad

type instance AttributeList Misc = MiscAttributeList
type MiscAttributeList = ('[ '("app-paintable", WidgetAppPaintablePropertyInfo), '("can-default", WidgetCanDefaultPropertyInfo), '("can-focus", WidgetCanFocusPropertyInfo), '("composite-child", WidgetCompositeChildPropertyInfo), '("double-buffered", WidgetDoubleBufferedPropertyInfo), '("events", WidgetEventsPropertyInfo), '("expand", WidgetExpandPropertyInfo), '("halign", WidgetHalignPropertyInfo), '("has-default", WidgetHasDefaultPropertyInfo), '("has-focus", WidgetHasFocusPropertyInfo), '("has-tooltip", WidgetHasTooltipPropertyInfo), '("height-request", WidgetHeightRequestPropertyInfo), '("hexpand", WidgetHexpandPropertyInfo), '("hexpand-set", WidgetHexpandSetPropertyInfo), '("is-focus", WidgetIsFocusPropertyInfo), '("margin", WidgetMarginPropertyInfo), '("margin-bottom", WidgetMarginBottomPropertyInfo), '("margin-end", WidgetMarginEndPropertyInfo), '("margin-left", WidgetMarginLeftPropertyInfo), '("margin-right", WidgetMarginRightPropertyInfo), '("margin-start", WidgetMarginStartPropertyInfo), '("margin-top", WidgetMarginTopPropertyInfo), '("name", WidgetNamePropertyInfo), '("no-show-all", WidgetNoShowAllPropertyInfo), '("opacity", WidgetOpacityPropertyInfo), '("parent", WidgetParentPropertyInfo), '("receives-default", WidgetReceivesDefaultPropertyInfo), '("scale-factor", WidgetScaleFactorPropertyInfo), '("sensitive", WidgetSensitivePropertyInfo), '("style", WidgetStylePropertyInfo), '("tooltip-markup", WidgetTooltipMarkupPropertyInfo), '("tooltip-text", WidgetTooltipTextPropertyInfo), '("valign", WidgetValignPropertyInfo), '("vexpand", WidgetVexpandPropertyInfo), '("vexpand-set", WidgetVexpandSetPropertyInfo), '("visible", WidgetVisiblePropertyInfo), '("width-request", WidgetWidthRequestPropertyInfo), '("window", WidgetWindowPropertyInfo), '("xalign", MiscXalignPropertyInfo), '("xpad", MiscXpadPropertyInfo), '("yalign", MiscYalignPropertyInfo), '("ypad", MiscYpadPropertyInfo)] :: [(Symbol, *)])

type instance SignalList Misc = MiscSignalList
type MiscSignalList = ('[ '("accel-closures-changed", WidgetAccelClosuresChangedSignalInfo), '("button-press-event", WidgetButtonPressEventSignalInfo), '("button-release-event", WidgetButtonReleaseEventSignalInfo), '("can-activate-accel", WidgetCanActivateAccelSignalInfo), '("child-notify", WidgetChildNotifySignalInfo), '("composited-changed", WidgetCompositedChangedSignalInfo), '("configure-event", WidgetConfigureEventSignalInfo), '("damage-event", WidgetDamageEventSignalInfo), '("delete-event", WidgetDeleteEventSignalInfo), '("destroy", WidgetDestroySignalInfo), '("destroy-event", WidgetDestroyEventSignalInfo), '("direction-changed", WidgetDirectionChangedSignalInfo), '("drag-begin", WidgetDragBeginSignalInfo), '("drag-data-delete", WidgetDragDataDeleteSignalInfo), '("drag-data-get", WidgetDragDataGetSignalInfo), '("drag-data-received", WidgetDragDataReceivedSignalInfo), '("drag-drop", WidgetDragDropSignalInfo), '("drag-end", WidgetDragEndSignalInfo), '("drag-failed", WidgetDragFailedSignalInfo), '("drag-leave", WidgetDragLeaveSignalInfo), '("drag-motion", WidgetDragMotionSignalInfo), '("draw", WidgetDrawSignalInfo), '("enter-notify-event", WidgetEnterNotifyEventSignalInfo), '("event", WidgetEventSignalInfo), '("event-after", WidgetEventAfterSignalInfo), '("focus", WidgetFocusSignalInfo), '("focus-in-event", WidgetFocusInEventSignalInfo), '("focus-out-event", WidgetFocusOutEventSignalInfo), '("grab-broken-event", WidgetGrabBrokenEventSignalInfo), '("grab-focus", WidgetGrabFocusSignalInfo), '("grab-notify", WidgetGrabNotifySignalInfo), '("hide", WidgetHideSignalInfo), '("hierarchy-changed", WidgetHierarchyChangedSignalInfo), '("key-press-event", WidgetKeyPressEventSignalInfo), '("key-release-event", WidgetKeyReleaseEventSignalInfo), '("keynav-failed", WidgetKeynavFailedSignalInfo), '("leave-notify-event", WidgetLeaveNotifyEventSignalInfo), '("map", WidgetMapSignalInfo), '("map-event", WidgetMapEventSignalInfo), '("mnemonic-activate", WidgetMnemonicActivateSignalInfo), '("motion-notify-event", WidgetMotionNotifyEventSignalInfo), '("move-focus", WidgetMoveFocusSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("parent-set", WidgetParentSetSignalInfo), '("popup-menu", WidgetPopupMenuSignalInfo), '("property-notify-event", WidgetPropertyNotifyEventSignalInfo), '("proximity-in-event", WidgetProximityInEventSignalInfo), '("proximity-out-event", WidgetProximityOutEventSignalInfo), '("query-tooltip", WidgetQueryTooltipSignalInfo), '("realize", WidgetRealizeSignalInfo), '("screen-changed", WidgetScreenChangedSignalInfo), '("scroll-event", WidgetScrollEventSignalInfo), '("selection-clear-event", WidgetSelectionClearEventSignalInfo), '("selection-get", WidgetSelectionGetSignalInfo), '("selection-notify-event", WidgetSelectionNotifyEventSignalInfo), '("selection-received", WidgetSelectionReceivedSignalInfo), '("selection-request-event", WidgetSelectionRequestEventSignalInfo), '("show", WidgetShowSignalInfo), '("show-help", WidgetShowHelpSignalInfo), '("size-allocate", WidgetSizeAllocateSignalInfo), '("state-changed", WidgetStateChangedSignalInfo), '("state-flags-changed", WidgetStateFlagsChangedSignalInfo), '("style-set", WidgetStyleSetSignalInfo), '("style-updated", WidgetStyleUpdatedSignalInfo), '("touch-event", WidgetTouchEventSignalInfo), '("unmap", WidgetUnmapSignalInfo), '("unmap-event", WidgetUnmapEventSignalInfo), '("unrealize", WidgetUnrealizeSignalInfo), '("visibility-notify-event", WidgetVisibilityNotifyEventSignalInfo), '("window-state-event", WidgetWindowStateEventSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method Misc::get_alignment
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "xalign", argType = TBasicType TFloat, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "yalign", argType = TBasicType TFloat, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_misc_get_alignment" gtk_misc_get_alignment :: 
    Ptr Misc ->                             -- _obj : TInterface "Gtk" "Misc"
    Ptr CFloat ->                           -- xalign : TBasicType TFloat
    Ptr CFloat ->                           -- yalign : TBasicType TFloat
    IO ()

{-# DEPRECATED miscGetAlignment ["(Since version 3.14)","Use #GtkWidget alignment and margin properties."]#-}
miscGetAlignment ::
    (MonadIO m, MiscK a) =>
    a ->                                    -- _obj
    m (Float,Float)
miscGetAlignment _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    xalign <- allocMem :: IO (Ptr CFloat)
    yalign <- allocMem :: IO (Ptr CFloat)
    gtk_misc_get_alignment _obj' xalign yalign
    xalign' <- peek xalign
    let xalign'' = realToFrac xalign'
    yalign' <- peek yalign
    let yalign'' = realToFrac yalign'
    touchManagedPtr _obj
    freeMem xalign
    freeMem yalign
    return (xalign'', yalign'')

-- method Misc::get_padding
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "xpad", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "ypad", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_misc_get_padding" gtk_misc_get_padding :: 
    Ptr Misc ->                             -- _obj : TInterface "Gtk" "Misc"
    Ptr Int32 ->                            -- xpad : TBasicType TInt32
    Ptr Int32 ->                            -- ypad : TBasicType TInt32
    IO ()

{-# DEPRECATED miscGetPadding ["(Since version 3.14)","Use #GtkWidget alignment and margin properties."]#-}
miscGetPadding ::
    (MonadIO m, MiscK a) =>
    a ->                                    -- _obj
    m (Int32,Int32)
miscGetPadding _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    xpad <- allocMem :: IO (Ptr Int32)
    ypad <- allocMem :: IO (Ptr Int32)
    gtk_misc_get_padding _obj' xpad ypad
    xpad' <- peek xpad
    ypad' <- peek ypad
    touchManagedPtr _obj
    freeMem xpad
    freeMem ypad
    return (xpad', ypad')

-- method Misc::set_alignment
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "xalign", argType = TBasicType TFloat, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "yalign", argType = TBasicType TFloat, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "xalign", argType = TBasicType TFloat, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "yalign", argType = TBasicType TFloat, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_misc_set_alignment" gtk_misc_set_alignment :: 
    Ptr Misc ->                             -- _obj : TInterface "Gtk" "Misc"
    CFloat ->                               -- xalign : TBasicType TFloat
    CFloat ->                               -- yalign : TBasicType TFloat
    IO ()

{-# DEPRECATED miscSetAlignment ["(Since version 3.14)","Use #GtkWidget's alignment (#GtkWidget:halign and #GtkWidget:valign) and margin properties or #GtkLabel's #GtkLabel:xalign and #GtkLabel:yalign properties."]#-}
miscSetAlignment ::
    (MonadIO m, MiscK a) =>
    a ->                                    -- _obj
    Float ->                                -- xalign
    Float ->                                -- yalign
    m ()
miscSetAlignment _obj xalign yalign = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let xalign' = realToFrac xalign
    let yalign' = realToFrac yalign
    gtk_misc_set_alignment _obj' xalign' yalign'
    touchManagedPtr _obj
    return ()

-- method Misc::set_padding
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "xpad", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ypad", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Misc", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "xpad", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "ypad", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_misc_set_padding" gtk_misc_set_padding :: 
    Ptr Misc ->                             -- _obj : TInterface "Gtk" "Misc"
    Int32 ->                                -- xpad : TBasicType TInt32
    Int32 ->                                -- ypad : TBasicType TInt32
    IO ()

{-# DEPRECATED miscSetPadding ["(Since version 3.14)","Use #GtkWidget alignment and margin properties."]#-}
miscSetPadding ::
    (MonadIO m, MiscK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- xpad
    Int32 ->                                -- ypad
    m ()
miscSetPadding _obj xpad ypad = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_misc_set_padding _obj' xpad ypad
    touchManagedPtr _obj
    return ()