{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Objects.CustomLayout
(
CustomLayout(..) ,
IsCustomLayout ,
toCustomLayout ,
#if defined(ENABLE_OVERLOADING)
ResolveCustomLayoutMethod ,
#endif
customLayoutNew ,
) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gtk.Callbacks as Gtk.Callbacks
import {-# SOURCE #-} qualified GI.Gtk.Objects.LayoutManager as Gtk.LayoutManager
newtype CustomLayout = CustomLayout (SP.ManagedPtr CustomLayout)
deriving (CustomLayout -> CustomLayout -> Bool
(CustomLayout -> CustomLayout -> Bool)
-> (CustomLayout -> CustomLayout -> Bool) -> Eq CustomLayout
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: CustomLayout -> CustomLayout -> Bool
== :: CustomLayout -> CustomLayout -> Bool
$c/= :: CustomLayout -> CustomLayout -> Bool
/= :: CustomLayout -> CustomLayout -> Bool
Eq)
instance SP.ManagedPtrNewtype CustomLayout where
toManagedPtr :: CustomLayout -> ManagedPtr CustomLayout
toManagedPtr (CustomLayout ManagedPtr CustomLayout
p) = ManagedPtr CustomLayout
p
foreign import ccall "gtk_custom_layout_get_type"
c_gtk_custom_layout_get_type :: IO B.Types.GType
instance B.Types.TypedObject CustomLayout where
glibType :: IO GType
glibType = IO GType
c_gtk_custom_layout_get_type
instance B.Types.GObject CustomLayout
class (SP.GObject o, O.IsDescendantOf CustomLayout o) => IsCustomLayout o
instance (SP.GObject o, O.IsDescendantOf CustomLayout o) => IsCustomLayout o
instance O.HasParentTypes CustomLayout
type instance O.ParentTypes CustomLayout = '[Gtk.LayoutManager.LayoutManager, GObject.Object.Object]
toCustomLayout :: (MIO.MonadIO m, IsCustomLayout o) => o -> m CustomLayout
toCustomLayout :: forall (m :: * -> *) o.
(MonadIO m, IsCustomLayout o) =>
o -> m CustomLayout
toCustomLayout = IO CustomLayout -> m CustomLayout
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO CustomLayout -> m CustomLayout)
-> (o -> IO CustomLayout) -> o -> m CustomLayout
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr CustomLayout -> CustomLayout) -> o -> IO CustomLayout
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr CustomLayout -> CustomLayout
CustomLayout
instance B.GValue.IsGValue (Maybe CustomLayout) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_custom_layout_get_type
gvalueSet_ :: Ptr GValue -> Maybe CustomLayout -> IO ()
gvalueSet_ Ptr GValue
gv Maybe CustomLayout
P.Nothing = Ptr GValue -> Ptr CustomLayout -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr CustomLayout
forall a. Ptr a
FP.nullPtr :: FP.Ptr CustomLayout)
gvalueSet_ Ptr GValue
gv (P.Just CustomLayout
obj) = CustomLayout -> (Ptr CustomLayout -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr CustomLayout
obj (Ptr GValue -> Ptr CustomLayout -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe CustomLayout)
gvalueGet_ Ptr GValue
gv = do
Ptr CustomLayout
ptr <- Ptr GValue -> IO (Ptr CustomLayout)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr CustomLayout)
if Ptr CustomLayout
ptr Ptr CustomLayout -> Ptr CustomLayout -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr CustomLayout
forall a. Ptr a
FP.nullPtr
then CustomLayout -> Maybe CustomLayout
forall a. a -> Maybe a
P.Just (CustomLayout -> Maybe CustomLayout)
-> IO CustomLayout -> IO (Maybe CustomLayout)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr CustomLayout -> CustomLayout)
-> Ptr CustomLayout -> IO CustomLayout
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr CustomLayout -> CustomLayout
CustomLayout Ptr CustomLayout
ptr
else Maybe CustomLayout -> IO (Maybe CustomLayout)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe CustomLayout
forall a. Maybe a
P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveCustomLayoutMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveCustomLayoutMethod "allocate" o = Gtk.LayoutManager.LayoutManagerAllocateMethodInfo
ResolveCustomLayoutMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveCustomLayoutMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveCustomLayoutMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveCustomLayoutMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveCustomLayoutMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveCustomLayoutMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveCustomLayoutMethod "layoutChanged" o = Gtk.LayoutManager.LayoutManagerLayoutChangedMethodInfo
ResolveCustomLayoutMethod "measure" o = Gtk.LayoutManager.LayoutManagerMeasureMethodInfo
ResolveCustomLayoutMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveCustomLayoutMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveCustomLayoutMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveCustomLayoutMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveCustomLayoutMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveCustomLayoutMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveCustomLayoutMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveCustomLayoutMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveCustomLayoutMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveCustomLayoutMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveCustomLayoutMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveCustomLayoutMethod "getLayoutChild" o = Gtk.LayoutManager.LayoutManagerGetLayoutChildMethodInfo
ResolveCustomLayoutMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveCustomLayoutMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveCustomLayoutMethod "getRequestMode" o = Gtk.LayoutManager.LayoutManagerGetRequestModeMethodInfo
ResolveCustomLayoutMethod "getWidget" o = Gtk.LayoutManager.LayoutManagerGetWidgetMethodInfo
ResolveCustomLayoutMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveCustomLayoutMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveCustomLayoutMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveCustomLayoutMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveCustomLayoutMethod t CustomLayout, O.OverloadedMethod info CustomLayout p) => OL.IsLabel t (CustomLayout -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveCustomLayoutMethod t CustomLayout, O.OverloadedMethod info CustomLayout p, R.HasField t CustomLayout p) => R.HasField t CustomLayout p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveCustomLayoutMethod t CustomLayout, O.OverloadedMethodInfo info CustomLayout) => OL.IsLabel t (O.MethodProxy info CustomLayout) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList CustomLayout
type instance O.AttributeList CustomLayout = CustomLayoutAttributeList
type CustomLayoutAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList CustomLayout = CustomLayoutSignalList
type CustomLayoutSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "gtk_custom_layout_new" gtk_custom_layout_new ::
FunPtr Gtk.Callbacks.C_CustomRequestModeFunc ->
FunPtr Gtk.Callbacks.C_CustomMeasureFunc ->
FunPtr Gtk.Callbacks.C_CustomAllocateFunc ->
IO (Ptr CustomLayout)
customLayoutNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Maybe (Gtk.Callbacks.CustomRequestModeFunc)
-> Gtk.Callbacks.CustomMeasureFunc
-> Gtk.Callbacks.CustomAllocateFunc
-> m CustomLayout
customLayoutNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Maybe CustomRequestModeFunc
-> CustomMeasureFunc -> CustomAllocateFunc -> m CustomLayout
customLayoutNew Maybe CustomRequestModeFunc
requestMode CustomMeasureFunc
measure CustomAllocateFunc
allocate = IO CustomLayout -> m CustomLayout
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CustomLayout -> m CustomLayout)
-> IO CustomLayout -> m CustomLayout
forall a b. (a -> b) -> a -> b
$ do
FunPtr C_CustomRequestModeFunc
maybeRequestMode <- case Maybe CustomRequestModeFunc
requestMode of
Maybe CustomRequestModeFunc
Nothing -> FunPtr C_CustomRequestModeFunc
-> IO (FunPtr C_CustomRequestModeFunc)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr Any -> FunPtr C_CustomRequestModeFunc
forall a b. Ptr a -> FunPtr b
castPtrToFunPtr Ptr Any
forall a. Ptr a
nullPtr)
Just CustomRequestModeFunc
jRequestMode -> do
FunPtr C_CustomRequestModeFunc
jRequestMode' <- C_CustomRequestModeFunc -> IO (FunPtr C_CustomRequestModeFunc)
Gtk.Callbacks.mk_CustomRequestModeFunc (Maybe (Ptr (FunPtr C_CustomRequestModeFunc))
-> CustomRequestModeFunc -> C_CustomRequestModeFunc
Gtk.Callbacks.wrap_CustomRequestModeFunc Maybe (Ptr (FunPtr C_CustomRequestModeFunc))
forall a. Maybe a
Nothing CustomRequestModeFunc
jRequestMode)
FunPtr C_CustomRequestModeFunc
-> IO (FunPtr C_CustomRequestModeFunc)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return FunPtr C_CustomRequestModeFunc
jRequestMode'
FunPtr C_CustomMeasureFunc
measure' <- C_CustomMeasureFunc -> IO (FunPtr C_CustomMeasureFunc)
Gtk.Callbacks.mk_CustomMeasureFunc (Maybe (Ptr (FunPtr C_CustomMeasureFunc))
-> CustomMeasureFunc -> C_CustomMeasureFunc
Gtk.Callbacks.wrap_CustomMeasureFunc Maybe (Ptr (FunPtr C_CustomMeasureFunc))
forall a. Maybe a
Nothing CustomMeasureFunc
measure)
FunPtr C_CustomAllocateFunc
allocate' <- C_CustomAllocateFunc -> IO (FunPtr C_CustomAllocateFunc)
Gtk.Callbacks.mk_CustomAllocateFunc (Maybe (Ptr (FunPtr C_CustomAllocateFunc))
-> CustomAllocateFunc -> C_CustomAllocateFunc
Gtk.Callbacks.wrap_CustomAllocateFunc Maybe (Ptr (FunPtr C_CustomAllocateFunc))
forall a. Maybe a
Nothing CustomAllocateFunc
allocate)
Ptr CustomLayout
result <- FunPtr C_CustomRequestModeFunc
-> FunPtr C_CustomMeasureFunc
-> FunPtr C_CustomAllocateFunc
-> IO (Ptr CustomLayout)
gtk_custom_layout_new FunPtr C_CustomRequestModeFunc
maybeRequestMode FunPtr C_CustomMeasureFunc
measure' FunPtr C_CustomAllocateFunc
allocate'
Text -> Ptr CustomLayout -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"customLayoutNew" Ptr CustomLayout
result
CustomLayout
result' <- ((ManagedPtr CustomLayout -> CustomLayout)
-> Ptr CustomLayout -> IO CustomLayout
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr CustomLayout -> CustomLayout
CustomLayout) Ptr CustomLayout
result
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_CustomRequestModeFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_CustomRequestModeFunc
maybeRequestMode
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_CustomMeasureFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_CustomMeasureFunc
measure'
Ptr Any -> IO ()
forall a. Ptr a -> IO ()
safeFreeFunPtr (Ptr Any -> IO ()) -> Ptr Any -> IO ()
forall a b. (a -> b) -> a -> b
$ FunPtr C_CustomAllocateFunc -> Ptr Any
forall a b. FunPtr a -> Ptr b
castFunPtrToPtr FunPtr C_CustomAllocateFunc
allocate'
CustomLayout -> IO CustomLayout
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return CustomLayout
result'
#if defined(ENABLE_OVERLOADING)
#endif