{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- t'GI.Gtk.Objects.TreeListRowSorter.TreeListRowSorter' is a special-purpose sorter that will apply a given
-- sorter to the levels in a tree, while respecting the tree structure.
-- 
-- Here is an example for setting up a column view with a tree model and
-- a GtkTreeListSorter:
-- 
-- >
-- >column_sorter = gtk_column_view_get_sorter (view);
-- >sorter = gtk_tree_list_row_sorter_new (g_object_ref (column_sorter));
-- >sort_model = gtk_sort_list_model_new (tree_model, sorter);
-- >selection = gtk_single_selection_new (sort_model);
-- >gtk_column_view_set_model (view, G_LIST_MODEL (selection));
-- 

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

module GI.Gtk.Objects.TreeListRowSorter
    ( 

-- * Exported types
    TreeListRowSorter(..)                   ,
    IsTreeListRowSorter                     ,
    toTreeListRowSorter                     ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [bindProperty]("GI.GObject.Objects.Object#g:method:bindProperty"), [bindPropertyFull]("GI.GObject.Objects.Object#g:method:bindPropertyFull"), [changed]("GI.Gtk.Objects.Sorter#g:method:changed"), [compare]("GI.Gtk.Objects.Sorter#g:method:compare"), [forceFloating]("GI.GObject.Objects.Object#g:method:forceFloating"), [freezeNotify]("GI.GObject.Objects.Object#g:method:freezeNotify"), [getv]("GI.GObject.Objects.Object#g:method:getv"), [isFloating]("GI.GObject.Objects.Object#g:method:isFloating"), [notify]("GI.GObject.Objects.Object#g:method:notify"), [notifyByPspec]("GI.GObject.Objects.Object#g:method:notifyByPspec"), [ref]("GI.GObject.Objects.Object#g:method:ref"), [refSink]("GI.GObject.Objects.Object#g:method:refSink"), [runDispose]("GI.GObject.Objects.Object#g:method:runDispose"), [stealData]("GI.GObject.Objects.Object#g:method:stealData"), [stealQdata]("GI.GObject.Objects.Object#g:method:stealQdata"), [thawNotify]("GI.GObject.Objects.Object#g:method:thawNotify"), [unref]("GI.GObject.Objects.Object#g:method:unref"), [watchClosure]("GI.GObject.Objects.Object#g:method:watchClosure").
-- 
-- ==== Getters
-- [getData]("GI.GObject.Objects.Object#g:method:getData"), [getOrder]("GI.Gtk.Objects.Sorter#g:method:getOrder"), [getProperty]("GI.GObject.Objects.Object#g:method:getProperty"), [getQdata]("GI.GObject.Objects.Object#g:method:getQdata"), [getSorter]("GI.Gtk.Objects.TreeListRowSorter#g:method:getSorter").
-- 
-- ==== Setters
-- [setData]("GI.GObject.Objects.Object#g:method:setData"), [setDataFull]("GI.GObject.Objects.Object#g:method:setDataFull"), [setProperty]("GI.GObject.Objects.Object#g:method:setProperty"), [setSorter]("GI.Gtk.Objects.TreeListRowSorter#g:method:setSorter").

#if defined(ENABLE_OVERLOADING)
    ResolveTreeListRowSorterMethod          ,
#endif

-- ** getSorter #method:getSorter#

#if defined(ENABLE_OVERLOADING)
    TreeListRowSorterGetSorterMethodInfo    ,
#endif
    treeListRowSorterGetSorter              ,


-- ** new #method:new#

    treeListRowSorterNew                    ,


-- ** setSorter #method:setSorter#

#if defined(ENABLE_OVERLOADING)
    TreeListRowSorterSetSorterMethodInfo    ,
#endif
    treeListRowSorterSetSorter              ,




 -- * Properties


-- ** sorter #attr:sorter#
-- | The underlying sorter

#if defined(ENABLE_OVERLOADING)
    TreeListRowSorterSorterPropertyInfo     ,
#endif
    clearTreeListRowSorterSorter            ,
    constructTreeListRowSorterSorter        ,
    getTreeListRowSorterSorter              ,
    setTreeListRowSorterSorter              ,
#if defined(ENABLE_OVERLOADING)
    treeListRowSorterSorter                 ,
#endif




    ) 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.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.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 GHC.Records as R

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Objects.Sorter as Gtk.Sorter

-- | Memory-managed wrapper type.
newtype TreeListRowSorter = TreeListRowSorter (SP.ManagedPtr TreeListRowSorter)
    deriving (TreeListRowSorter -> TreeListRowSorter -> Bool
(TreeListRowSorter -> TreeListRowSorter -> Bool)
-> (TreeListRowSorter -> TreeListRowSorter -> Bool)
-> Eq TreeListRowSorter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TreeListRowSorter -> TreeListRowSorter -> Bool
$c/= :: TreeListRowSorter -> TreeListRowSorter -> Bool
== :: TreeListRowSorter -> TreeListRowSorter -> Bool
$c== :: TreeListRowSorter -> TreeListRowSorter -> Bool
Eq)

instance SP.ManagedPtrNewtype TreeListRowSorter where
    toManagedPtr :: TreeListRowSorter -> ManagedPtr TreeListRowSorter
toManagedPtr (TreeListRowSorter ManagedPtr TreeListRowSorter
p) = ManagedPtr TreeListRowSorter
p

foreign import ccall "gtk_tree_list_row_sorter_get_type"
    c_gtk_tree_list_row_sorter_get_type :: IO B.Types.GType

instance B.Types.TypedObject TreeListRowSorter where
    glibType :: IO GType
glibType = IO GType
c_gtk_tree_list_row_sorter_get_type

instance B.Types.GObject TreeListRowSorter

-- | Type class for types which can be safely cast to `TreeListRowSorter`, for instance with `toTreeListRowSorter`.
class (SP.GObject o, O.IsDescendantOf TreeListRowSorter o) => IsTreeListRowSorter o
instance (SP.GObject o, O.IsDescendantOf TreeListRowSorter o) => IsTreeListRowSorter o

instance O.HasParentTypes TreeListRowSorter
type instance O.ParentTypes TreeListRowSorter = '[Gtk.Sorter.Sorter, GObject.Object.Object]

-- | Cast to `TreeListRowSorter`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toTreeListRowSorter :: (MIO.MonadIO m, IsTreeListRowSorter o) => o -> m TreeListRowSorter
toTreeListRowSorter :: forall (m :: * -> *) o.
(MonadIO m, IsTreeListRowSorter o) =>
o -> m TreeListRowSorter
toTreeListRowSorter = IO TreeListRowSorter -> m TreeListRowSorter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO TreeListRowSorter -> m TreeListRowSorter)
-> (o -> IO TreeListRowSorter) -> o -> m TreeListRowSorter
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr TreeListRowSorter -> TreeListRowSorter)
-> o -> IO TreeListRowSorter
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr TreeListRowSorter -> TreeListRowSorter
TreeListRowSorter

-- | Convert 'TreeListRowSorter' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe TreeListRowSorter) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gtk_tree_list_row_sorter_get_type
    gvalueSet_ :: Ptr GValue -> Maybe TreeListRowSorter -> IO ()
gvalueSet_ Ptr GValue
gv Maybe TreeListRowSorter
P.Nothing = Ptr GValue -> Ptr TreeListRowSorter -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr TreeListRowSorter
forall a. Ptr a
FP.nullPtr :: FP.Ptr TreeListRowSorter)
    gvalueSet_ Ptr GValue
gv (P.Just TreeListRowSorter
obj) = TreeListRowSorter -> (Ptr TreeListRowSorter -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr TreeListRowSorter
obj (Ptr GValue -> Ptr TreeListRowSorter -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe TreeListRowSorter)
gvalueGet_ Ptr GValue
gv = do
        Ptr TreeListRowSorter
ptr <- Ptr GValue -> IO (Ptr TreeListRowSorter)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr TreeListRowSorter)
        if Ptr TreeListRowSorter
ptr Ptr TreeListRowSorter -> Ptr TreeListRowSorter -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr TreeListRowSorter
forall a. Ptr a
FP.nullPtr
        then TreeListRowSorter -> Maybe TreeListRowSorter
forall a. a -> Maybe a
P.Just (TreeListRowSorter -> Maybe TreeListRowSorter)
-> IO TreeListRowSorter -> IO (Maybe TreeListRowSorter)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr TreeListRowSorter -> TreeListRowSorter)
-> Ptr TreeListRowSorter -> IO TreeListRowSorter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr TreeListRowSorter -> TreeListRowSorter
TreeListRowSorter Ptr TreeListRowSorter
ptr
        else Maybe TreeListRowSorter -> IO (Maybe TreeListRowSorter)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe TreeListRowSorter
forall a. Maybe a
P.Nothing
        
    

#if defined(ENABLE_OVERLOADING)
type family ResolveTreeListRowSorterMethod (t :: Symbol) (o :: *) :: * where
    ResolveTreeListRowSorterMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveTreeListRowSorterMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveTreeListRowSorterMethod "changed" o = Gtk.Sorter.SorterChangedMethodInfo
    ResolveTreeListRowSorterMethod "compare" o = Gtk.Sorter.SorterCompareMethodInfo
    ResolveTreeListRowSorterMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveTreeListRowSorterMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveTreeListRowSorterMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveTreeListRowSorterMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveTreeListRowSorterMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveTreeListRowSorterMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveTreeListRowSorterMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveTreeListRowSorterMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveTreeListRowSorterMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveTreeListRowSorterMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveTreeListRowSorterMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveTreeListRowSorterMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveTreeListRowSorterMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveTreeListRowSorterMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveTreeListRowSorterMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveTreeListRowSorterMethod "getOrder" o = Gtk.Sorter.SorterGetOrderMethodInfo
    ResolveTreeListRowSorterMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveTreeListRowSorterMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveTreeListRowSorterMethod "getSorter" o = TreeListRowSorterGetSorterMethodInfo
    ResolveTreeListRowSorterMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveTreeListRowSorterMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveTreeListRowSorterMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveTreeListRowSorterMethod "setSorter" o = TreeListRowSorterSetSorterMethodInfo
    ResolveTreeListRowSorterMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveTreeListRowSorterMethod t TreeListRowSorter, O.OverloadedMethod info TreeListRowSorter p) => OL.IsLabel t (TreeListRowSorter -> 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 ~ ResolveTreeListRowSorterMethod t TreeListRowSorter, O.OverloadedMethod info TreeListRowSorter p, R.HasField t TreeListRowSorter p) => R.HasField t TreeListRowSorter p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveTreeListRowSorterMethod t TreeListRowSorter, O.OverloadedMethodInfo info TreeListRowSorter) => OL.IsLabel t (O.MethodProxy info TreeListRowSorter) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif

-- VVV Prop "sorter"
   -- Type: TInterface (Name {namespace = "Gtk", name = "Sorter"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just True)

-- | Get the value of the “@sorter@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' treeListRowSorter #sorter
-- @
getTreeListRowSorterSorter :: (MonadIO m, IsTreeListRowSorter o) => o -> m (Maybe Gtk.Sorter.Sorter)
getTreeListRowSorterSorter :: forall (m :: * -> *) o.
(MonadIO m, IsTreeListRowSorter o) =>
o -> m (Maybe Sorter)
getTreeListRowSorterSorter o
obj = IO (Maybe Sorter) -> m (Maybe Sorter)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe Sorter) -> m (Maybe Sorter))
-> IO (Maybe Sorter) -> m (Maybe Sorter)
forall a b. (a -> b) -> a -> b
$ o -> String -> (ManagedPtr Sorter -> Sorter) -> IO (Maybe Sorter)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"sorter" ManagedPtr Sorter -> Sorter
Gtk.Sorter.Sorter

-- | Set the value of the “@sorter@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' treeListRowSorter [ #sorter 'Data.GI.Base.Attributes.:=' value ]
-- @
setTreeListRowSorterSorter :: (MonadIO m, IsTreeListRowSorter o, Gtk.Sorter.IsSorter a) => o -> a -> m ()
setTreeListRowSorterSorter :: forall (m :: * -> *) o a.
(MonadIO m, IsTreeListRowSorter o, IsSorter a) =>
o -> a -> m ()
setTreeListRowSorterSorter o
obj a
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    o -> String -> Maybe a -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"sorter" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)

-- | Construct a `GValueConstruct` with valid value for the “@sorter@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructTreeListRowSorterSorter :: (IsTreeListRowSorter o, MIO.MonadIO m, Gtk.Sorter.IsSorter a) => a -> m (GValueConstruct o)
constructTreeListRowSorterSorter :: forall o (m :: * -> *) a.
(IsTreeListRowSorter o, MonadIO m, IsSorter a) =>
a -> m (GValueConstruct o)
constructTreeListRowSorterSorter a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
    IO (GValueConstruct o) -> IO (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"sorter" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

-- | Set the value of the “@sorter@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #sorter
-- @
clearTreeListRowSorterSorter :: (MonadIO m, IsTreeListRowSorter o) => o -> m ()
clearTreeListRowSorterSorter :: forall (m :: * -> *) o.
(MonadIO m, IsTreeListRowSorter o) =>
o -> m ()
clearTreeListRowSorterSorter o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe Sorter -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"sorter" (Maybe Sorter
forall a. Maybe a
Nothing :: Maybe Gtk.Sorter.Sorter)

#if defined(ENABLE_OVERLOADING)
data TreeListRowSorterSorterPropertyInfo
instance AttrInfo TreeListRowSorterSorterPropertyInfo where
    type AttrAllowedOps TreeListRowSorterSorterPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint TreeListRowSorterSorterPropertyInfo = IsTreeListRowSorter
    type AttrSetTypeConstraint TreeListRowSorterSorterPropertyInfo = Gtk.Sorter.IsSorter
    type AttrTransferTypeConstraint TreeListRowSorterSorterPropertyInfo = Gtk.Sorter.IsSorter
    type AttrTransferType TreeListRowSorterSorterPropertyInfo = Gtk.Sorter.Sorter
    type AttrGetType TreeListRowSorterSorterPropertyInfo = (Maybe Gtk.Sorter.Sorter)
    type AttrLabel TreeListRowSorterSorterPropertyInfo = "sorter"
    type AttrOrigin TreeListRowSorterSorterPropertyInfo = TreeListRowSorter
    attrGet = getTreeListRowSorterSorter
    attrSet = setTreeListRowSorterSorter
    attrTransfer _ v = do
        unsafeCastTo Gtk.Sorter.Sorter v
    attrConstruct = constructTreeListRowSorterSorter
    attrClear = clearTreeListRowSorterSorter
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList TreeListRowSorter
type instance O.AttributeList TreeListRowSorter = TreeListRowSorterAttributeList
type TreeListRowSorterAttributeList = ('[ '("sorter", TreeListRowSorterSorterPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
treeListRowSorterSorter :: AttrLabelProxy "sorter"
treeListRowSorterSorter = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList TreeListRowSorter = TreeListRowSorterSignalList
type TreeListRowSorterSignalList = ('[ '("changed", Gtk.Sorter.SorterChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method TreeListRowSorter::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "sorter"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Sorter" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkSorter, or %NULL"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface
--                  Name { namespace = "Gtk" , name = "TreeListRowSorter" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_list_row_sorter_new" gtk_tree_list_row_sorter_new :: 
    Ptr Gtk.Sorter.Sorter ->                -- sorter : TInterface (Name {namespace = "Gtk", name = "Sorter"})
    IO (Ptr TreeListRowSorter)

-- | Create a special-purpose sorter that applies the sorting
-- of /@sorter@/ to the levels of a t'GI.Gtk.Objects.TreeListModel.TreeListModel'.
-- 
-- Note that this sorter relies on t'GI.Gtk.Objects.TreeListModel.TreeListModel':@/passthrough/@
-- being 'P.False' as it can only sort @/GtkTreeListRows/@.
treeListRowSorterNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.Sorter.IsSorter a) =>
    Maybe (a)
    -- ^ /@sorter@/: a t'GI.Gtk.Objects.Sorter.Sorter', or 'P.Nothing'
    -> m TreeListRowSorter
    -- ^ __Returns:__ a new t'GI.Gtk.Objects.TreeListRowSorter.TreeListRowSorter'
treeListRowSorterNew :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsSorter a) =>
Maybe a -> m TreeListRowSorter
treeListRowSorterNew Maybe a
sorter = IO TreeListRowSorter -> m TreeListRowSorter
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO TreeListRowSorter -> m TreeListRowSorter)
-> IO TreeListRowSorter -> m TreeListRowSorter
forall a b. (a -> b) -> a -> b
$ do
    Ptr Sorter
maybeSorter <- case Maybe a
sorter of
        Maybe a
Nothing -> Ptr Sorter -> IO (Ptr Sorter)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Sorter
forall a. Ptr a
nullPtr
        Just a
jSorter -> do
            Ptr Sorter
jSorter' <- a -> IO (Ptr Sorter)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject a
jSorter
            Ptr Sorter -> IO (Ptr Sorter)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Sorter
jSorter'
    Ptr TreeListRowSorter
result <- Ptr Sorter -> IO (Ptr TreeListRowSorter)
gtk_tree_list_row_sorter_new Ptr Sorter
maybeSorter
    Text -> Ptr TreeListRowSorter -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"treeListRowSorterNew" Ptr TreeListRowSorter
result
    TreeListRowSorter
result' <- ((ManagedPtr TreeListRowSorter -> TreeListRowSorter)
-> Ptr TreeListRowSorter -> IO TreeListRowSorter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr TreeListRowSorter -> TreeListRowSorter
TreeListRowSorter) Ptr TreeListRowSorter
result
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
sorter a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    TreeListRowSorter -> IO TreeListRowSorter
forall (m :: * -> *) a. Monad m => a -> m a
return TreeListRowSorter
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method TreeListRowSorter::get_sorter
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "TreeListRowSorter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkTreeListRowSorter"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "Sorter" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_tree_list_row_sorter_get_sorter" gtk_tree_list_row_sorter_get_sorter :: 
    Ptr TreeListRowSorter ->                -- self : TInterface (Name {namespace = "Gtk", name = "TreeListRowSorter"})
    IO (Ptr Gtk.Sorter.Sorter)

-- | Returns the sorter used by /@self@/.
treeListRowSorterGetSorter ::
    (B.CallStack.HasCallStack, MonadIO m, IsTreeListRowSorter a) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.TreeListRowSorter.TreeListRowSorter'
    -> m (Maybe Gtk.Sorter.Sorter)
    -- ^ __Returns:__ the sorter used
treeListRowSorterGetSorter :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTreeListRowSorter a) =>
a -> m (Maybe Sorter)
treeListRowSorterGetSorter a
self = IO (Maybe Sorter) -> m (Maybe Sorter)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Sorter) -> m (Maybe Sorter))
-> IO (Maybe Sorter) -> m (Maybe Sorter)
forall a b. (a -> b) -> a -> b
$ do
    Ptr TreeListRowSorter
self' <- a -> IO (Ptr TreeListRowSorter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Sorter
result <- Ptr TreeListRowSorter -> IO (Ptr Sorter)
gtk_tree_list_row_sorter_get_sorter Ptr TreeListRowSorter
self'
    Maybe Sorter
maybeResult <- Ptr Sorter -> (Ptr Sorter -> IO Sorter) -> IO (Maybe Sorter)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr Sorter
result ((Ptr Sorter -> IO Sorter) -> IO (Maybe Sorter))
-> (Ptr Sorter -> IO Sorter) -> IO (Maybe Sorter)
forall a b. (a -> b) -> a -> b
$ \Ptr Sorter
result' -> do
        Sorter
result'' <- ((ManagedPtr Sorter -> Sorter) -> Ptr Sorter -> IO Sorter
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Sorter -> Sorter
Gtk.Sorter.Sorter) Ptr Sorter
result'
        Sorter -> IO Sorter
forall (m :: * -> *) a. Monad m => a -> m a
return Sorter
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Maybe Sorter -> IO (Maybe Sorter)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Sorter
maybeResult

#if defined(ENABLE_OVERLOADING)
data TreeListRowSorterGetSorterMethodInfo
instance (signature ~ (m (Maybe Gtk.Sorter.Sorter)), MonadIO m, IsTreeListRowSorter a) => O.OverloadedMethod TreeListRowSorterGetSorterMethodInfo a signature where
    overloadedMethod = treeListRowSorterGetSorter

instance O.OverloadedMethodInfo TreeListRowSorterGetSorterMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gtk.Objects.TreeListRowSorter.treeListRowSorterGetSorter",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-TreeListRowSorter.html#v:treeListRowSorterGetSorter"
        }


#endif

-- method TreeListRowSorter::set_sorter
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "TreeListRowSorter" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkTreeListRowSorter"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "sorter"
--           , argType = TInterface Name { namespace = "Gtk" , name = "Sorter" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The sorter to use, 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 "gtk_tree_list_row_sorter_set_sorter" gtk_tree_list_row_sorter_set_sorter :: 
    Ptr TreeListRowSorter ->                -- self : TInterface (Name {namespace = "Gtk", name = "TreeListRowSorter"})
    Ptr Gtk.Sorter.Sorter ->                -- sorter : TInterface (Name {namespace = "Gtk", name = "Sorter"})
    IO ()

-- | Sets the sorter to use for items with the same parent.
-- 
-- This sorter will be passed the t'GI.Gtk.Objects.TreeListRow.TreeListRow':@/item/@ of the tree
-- list rows passed to /@self@/.
treeListRowSorterSetSorter ::
    (B.CallStack.HasCallStack, MonadIO m, IsTreeListRowSorter a, Gtk.Sorter.IsSorter b) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.TreeListRowSorter.TreeListRowSorter'
    -> Maybe (b)
    -- ^ /@sorter@/: The sorter to use, or 'P.Nothing'
    -> m ()
treeListRowSorterSetSorter :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsTreeListRowSorter a, IsSorter b) =>
a -> Maybe b -> m ()
treeListRowSorterSetSorter a
self Maybe b
sorter = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr TreeListRowSorter
self' <- a -> IO (Ptr TreeListRowSorter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr Sorter
maybeSorter <- case Maybe b
sorter of
        Maybe b
Nothing -> Ptr Sorter -> IO (Ptr Sorter)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Sorter
forall a. Ptr a
nullPtr
        Just b
jSorter -> do
            Ptr Sorter
jSorter' <- b -> IO (Ptr Sorter)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr b
jSorter
            Ptr Sorter -> IO (Ptr Sorter)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr Sorter
jSorter'
    Ptr TreeListRowSorter -> Ptr Sorter -> IO ()
gtk_tree_list_row_sorter_set_sorter Ptr TreeListRowSorter
self' Ptr Sorter
maybeSorter
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
sorter b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data TreeListRowSorterSetSorterMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsTreeListRowSorter a, Gtk.Sorter.IsSorter b) => O.OverloadedMethod TreeListRowSorterSetSorterMethodInfo a signature where
    overloadedMethod = treeListRowSorterSetSorter

instance O.OverloadedMethodInfo TreeListRowSorterSetSorterMethodInfo a where
    overloadedMethodInfo = O.MethodInfo {
        O.overloadedMethodName = "GI.Gtk.Objects.TreeListRowSorter.treeListRowSorterSetSorter",
        O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gtk-4.0.4/docs/GI-Gtk-Objects-TreeListRowSorter.html#v:treeListRowSorterSetSorter"
        }


#endif