{-# LANGUAGE FlexibleContexts, FlexibleInstances, ForeignFunctionInterface, MonoLocalBinds, MultiParamTypeClasses, ScopedTypeVariables, TypeSynonymInstances, UndecidableInstances #-} ---------- GENERATED FILE, EDITS WILL BE LOST ---------- module Graphics.UI.Qtah.Generated.Core.QItemSelection ( castQItemSelectionToQListQItemSelectionRange, QItemSelectionValue (..), QItemSelectionConstPtr (..), contains, indexes, QItemSelectionPtr (..), merge, select, split, QItemSelectionConst (..), castQItemSelectionToConst, QItemSelection (..), castQItemSelectionToNonconst, new, newWithRange, QItemSelectionSuper (..), QItemSelectionSuperConst (..), ) where import qualified Foreign as HoppyF import qualified Foreign.C as HoppyFC import qualified Foreign.Hoppy.Runtime as HoppyFHR import qualified Foreign.Hoppy.Runtime as QtahFHR import qualified Graphics.UI.Qtah.Flags as QtahFlags import {-# SOURCE #-} qualified Graphics.UI.Qtah.Generated.Core.QItemSelectionModel as M52 import qualified Graphics.UI.Qtah.Generated.Core.QItemSelectionRange as M54 import qualified Graphics.UI.Qtah.Generated.Core.QList.QItemSelectionRange as M198 import qualified Graphics.UI.Qtah.Generated.Core.QList.QModelIndex as M200 import qualified Graphics.UI.Qtah.Generated.Core.QModelIndex as M92 import Prelude (($), (.), (/=), (=<<), (==), (>>=)) import qualified Prelude as HoppyP import qualified Prelude as QtahP foreign import ccall "genpop__QItemSelection_new" new' :: HoppyP.IO (HoppyF.Ptr QItemSelection) foreign import ccall "genpop__QItemSelection_newWithRange" newWithRange' :: HoppyF.Ptr M92.QModelIndexConst -> HoppyF.Ptr M92.QModelIndexConst -> HoppyP.IO (HoppyF.Ptr QItemSelection) foreign import ccall "genpop__QItemSelection_contains" contains' :: HoppyF.Ptr QItemSelectionConst -> HoppyF.Ptr M92.QModelIndexConst -> HoppyP.IO HoppyFC.CBool foreign import ccall "genpop__QItemSelection_indexes" indexes' :: HoppyF.Ptr QItemSelectionConst -> HoppyP.IO (HoppyF.Ptr M200.QListQModelIndexConst) foreign import ccall "genpop__QItemSelection_merge" merge' :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst -> HoppyFC.CInt -> HoppyP.IO () foreign import ccall "genpop__QItemSelection_select" select' :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr M92.QModelIndexConst -> HoppyF.Ptr M92.QModelIndexConst -> HoppyP.IO () foreign import ccall "genpop__QItemSelection_split" split' :: HoppyF.Ptr M54.QItemSelectionRangeConst -> HoppyF.Ptr M54.QItemSelectionRangeConst -> HoppyF.Ptr QItemSelection -> HoppyP.IO () foreign import ccall "gencast__QItemSelection__QListQItemSelectionRange" castQItemSelectionToQListQItemSelectionRange :: HoppyF.Ptr QItemSelectionConst -> HoppyF.Ptr M198.QListQItemSelectionRangeConst foreign import ccall "gendel__QItemSelection" delete'QItemSelection :: HoppyF.Ptr QItemSelectionConst -> HoppyP.IO () foreign import ccall "&gendel__QItemSelection" deletePtr'QItemSelection :: HoppyF.FunPtr (HoppyF.Ptr QItemSelectionConst -> HoppyP.IO ()) class QItemSelectionValue a where withQItemSelectionPtr :: a -> (QItemSelectionConst -> HoppyP.IO b) -> HoppyP.IO b instance {-# OVERLAPPABLE #-} QItemSelectionConstPtr a => QItemSelectionValue a where withQItemSelectionPtr = HoppyP.flip ($) . toQItemSelectionConst class (M198.QListQItemSelectionRangeConstPtr this) => QItemSelectionConstPtr this where toQItemSelectionConst :: this -> QItemSelectionConst contains :: (QItemSelectionValue this, M92.QModelIndexValue arg'2) => (this) {- ^ this -} -> (arg'2) -> (HoppyP.IO HoppyP.Bool) contains arg'1 arg'2 = withQItemSelectionPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> M92.withQModelIndexPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> ( (HoppyP.return . (/= 0)) ) =<< (contains' arg'1' arg'2') indexes :: (QItemSelectionValue this) => (this) {- ^ this -} -> (HoppyP.IO [M92.QModelIndex]) indexes arg'1 = withQItemSelectionPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> (HoppyFHR.decodeAndDelete . M200.QListQModelIndexConst) =<< (indexes' arg'1') class (QItemSelectionConstPtr this, M198.QListQItemSelectionRangePtr this) => QItemSelectionPtr this where toQItemSelection :: this -> QItemSelection merge :: (QItemSelectionPtr this, QItemSelectionValue arg'2, M52.IsQItemSelectionModelSelectionFlags arg'3) => (this) {- ^ this -} -> (arg'2) -> (arg'3) -> (HoppyP.IO ()) merge arg'1 arg'2 arg'3 = HoppyFHR.withCppPtr (toQItemSelection arg'1) $ \arg'1' -> withQItemSelectionPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> ( QtahP.return . QtahFlags.flagsToNum . M52.toQItemSelectionModelSelectionFlags ) arg'3 >>= \arg'3' -> (merge' arg'1' arg'2' arg'3') select :: (QItemSelectionPtr this, M92.QModelIndexValue arg'2, M92.QModelIndexValue arg'3) => (this) {- ^ this -} -> (arg'2) -> (arg'3) -> (HoppyP.IO ()) select arg'1 arg'2 arg'3 = HoppyFHR.withCppPtr (toQItemSelection arg'1) $ \arg'1' -> M92.withQModelIndexPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> M92.withQModelIndexPtr arg'3 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'3' -> (select' arg'1' arg'2' arg'3') split :: (M54.QItemSelectionRangeValue arg'1, M54.QItemSelectionRangeValue arg'2, QItemSelectionPtr arg'3) => (arg'1) -> (arg'2) -> (arg'3) -> (HoppyP.IO ()) split arg'1 arg'2 arg'3 = M54.withQItemSelectionRangePtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> M54.withQItemSelectionRangePtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> HoppyFHR.withCppPtr (toQItemSelection arg'3) $ \arg'3' -> (split' arg'1' arg'2' arg'3') data QItemSelectionConst = QItemSelectionConst (HoppyF.Ptr QItemSelectionConst) | QItemSelectionConstGc (HoppyF.ForeignPtr ()) (HoppyF.Ptr QItemSelectionConst) deriving (HoppyP.Show) instance HoppyP.Eq QItemSelectionConst where x == y = HoppyFHR.toPtr x == HoppyFHR.toPtr y instance HoppyP.Ord QItemSelectionConst where compare x y = HoppyP.compare (HoppyFHR.toPtr x) (HoppyFHR.toPtr y) castQItemSelectionToConst :: QItemSelection -> QItemSelectionConst castQItemSelectionToConst (QItemSelection ptr') = QItemSelectionConst $ HoppyF.castPtr ptr' castQItemSelectionToConst (QItemSelectionGc fptr' ptr') = QItemSelectionConstGc fptr' $ HoppyF.castPtr ptr' instance HoppyFHR.CppPtr QItemSelectionConst where nullptr = QItemSelectionConst HoppyF.nullPtr withCppPtr (QItemSelectionConst ptr') f' = f' ptr' withCppPtr (QItemSelectionConstGc fptr' ptr') f' = HoppyF.withForeignPtr fptr' $ \_ -> f' ptr' toPtr (QItemSelectionConst ptr') = ptr' toPtr (QItemSelectionConstGc _ ptr') = ptr' touchCppPtr (QItemSelectionConst _) = HoppyP.return () touchCppPtr (QItemSelectionConstGc fptr' _) = HoppyF.touchForeignPtr fptr' instance HoppyFHR.Deletable QItemSelectionConst where delete (QItemSelectionConst ptr') = delete'QItemSelection ptr' delete (QItemSelectionConstGc _ _) = HoppyP.fail $ HoppyP.concat ["Deletable.delete: Asked to delete a GC-managed ", "QItemSelectionConst", " object."] toGc this'@(QItemSelectionConst ptr') = if ptr' == HoppyF.nullPtr then HoppyP.return this' else HoppyP.fmap (HoppyP.flip QItemSelectionConstGc ptr') $ HoppyF.newForeignPtr (HoppyF.castFunPtr deletePtr'QItemSelection :: HoppyF.FunPtr (HoppyF.Ptr () -> HoppyP.IO ())) (HoppyF.castPtr ptr' :: HoppyF.Ptr ()) toGc this'@(QItemSelectionConstGc {}) = HoppyP.return this' instance QItemSelectionConstPtr QItemSelectionConst where toQItemSelectionConst = HoppyP.id instance M198.QListQItemSelectionRangeConstPtr QItemSelectionConst where toQListQItemSelectionRangeConst (QItemSelectionConst ptr') = M198.QListQItemSelectionRangeConst $ castQItemSelectionToQListQItemSelectionRange ptr' toQListQItemSelectionRangeConst (QItemSelectionConstGc fptr' ptr') = M198.QListQItemSelectionRangeConstGc fptr' $ castQItemSelectionToQListQItemSelectionRange ptr' data QItemSelection = QItemSelection (HoppyF.Ptr QItemSelection) | QItemSelectionGc (HoppyF.ForeignPtr ()) (HoppyF.Ptr QItemSelection) deriving (HoppyP.Show) instance HoppyP.Eq QItemSelection where x == y = HoppyFHR.toPtr x == HoppyFHR.toPtr y instance HoppyP.Ord QItemSelection where compare x y = HoppyP.compare (HoppyFHR.toPtr x) (HoppyFHR.toPtr y) castQItemSelectionToNonconst :: QItemSelectionConst -> QItemSelection castQItemSelectionToNonconst (QItemSelectionConst ptr') = QItemSelection $ HoppyF.castPtr ptr' castQItemSelectionToNonconst (QItemSelectionConstGc fptr' ptr') = QItemSelectionGc fptr' $ HoppyF.castPtr ptr' instance HoppyFHR.CppPtr QItemSelection where nullptr = QItemSelection HoppyF.nullPtr withCppPtr (QItemSelection ptr') f' = f' ptr' withCppPtr (QItemSelectionGc fptr' ptr') f' = HoppyF.withForeignPtr fptr' $ \_ -> f' ptr' toPtr (QItemSelection ptr') = ptr' toPtr (QItemSelectionGc _ ptr') = ptr' touchCppPtr (QItemSelection _) = HoppyP.return () touchCppPtr (QItemSelectionGc fptr' _) = HoppyF.touchForeignPtr fptr' instance HoppyFHR.Deletable QItemSelection where delete (QItemSelection ptr') = delete'QItemSelection $ (HoppyF.castPtr ptr' :: HoppyF.Ptr QItemSelectionConst) delete (QItemSelectionGc _ _) = HoppyP.fail $ HoppyP.concat ["Deletable.delete: Asked to delete a GC-managed ", "QItemSelection", " object."] toGc this'@(QItemSelection ptr') = if ptr' == HoppyF.nullPtr then HoppyP.return this' else HoppyP.fmap (HoppyP.flip QItemSelectionGc ptr') $ HoppyF.newForeignPtr (HoppyF.castFunPtr deletePtr'QItemSelection :: HoppyF.FunPtr (HoppyF.Ptr () -> HoppyP.IO ())) (HoppyF.castPtr ptr' :: HoppyF.Ptr ()) toGc this'@(QItemSelectionGc {}) = HoppyP.return this' instance QItemSelectionConstPtr QItemSelection where toQItemSelectionConst (QItemSelection ptr') = QItemSelectionConst $ (HoppyF.castPtr :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst) ptr' toQItemSelectionConst (QItemSelectionGc fptr' ptr') = QItemSelectionConstGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst) ptr' instance QItemSelectionPtr QItemSelection where toQItemSelection = HoppyP.id instance M198.QListQItemSelectionRangeConstPtr QItemSelection where toQListQItemSelectionRangeConst (QItemSelection ptr') = M198.QListQItemSelectionRangeConst $ castQItemSelectionToQListQItemSelectionRange $ (HoppyF.castPtr :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst) ptr' toQListQItemSelectionRangeConst (QItemSelectionGc fptr' ptr') = M198.QListQItemSelectionRangeConstGc fptr' $ castQItemSelectionToQListQItemSelectionRange $ (HoppyF.castPtr :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst) ptr' instance M198.QListQItemSelectionRangePtr QItemSelection where toQListQItemSelectionRange (QItemSelection ptr') = M198.QListQItemSelectionRange $ (HoppyF.castPtr :: HoppyF.Ptr M198.QListQItemSelectionRangeConst -> HoppyF.Ptr M198.QListQItemSelectionRange) $ castQItemSelectionToQListQItemSelectionRange $ (HoppyF.castPtr :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst) ptr' toQListQItemSelectionRange (QItemSelectionGc fptr' ptr') = M198.QListQItemSelectionRangeGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr M198.QListQItemSelectionRangeConst -> HoppyF.Ptr M198.QListQItemSelectionRange) $ castQItemSelectionToQListQItemSelectionRange $ (HoppyF.castPtr :: HoppyF.Ptr QItemSelection -> HoppyF.Ptr QItemSelectionConst) ptr' new :: (HoppyP.IO QItemSelection) new = HoppyP.fmap QItemSelection (new') newWithRange :: (M92.QModelIndexValue arg'1, M92.QModelIndexValue arg'2) => (arg'1) -> (arg'2) -> (HoppyP.IO QItemSelection) newWithRange arg'1 arg'2 = M92.withQModelIndexPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' -> M92.withQModelIndexPtr arg'2 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'2' -> HoppyP.fmap QItemSelection (newWithRange' arg'1' arg'2') class QItemSelectionSuper a where downToQItemSelection :: a -> QItemSelection class QItemSelectionSuperConst a where downToQItemSelectionConst :: a -> QItemSelectionConst instance HoppyFHR.Assignable (HoppyF.Ptr (HoppyF.Ptr QItemSelection)) QItemSelection where assign ptr' value' = HoppyF.poke ptr' $ HoppyFHR.toPtr value' instance HoppyFHR.Decodable (HoppyF.Ptr (HoppyF.Ptr QItemSelection)) QItemSelection where decode = HoppyP.fmap QItemSelection . HoppyF.peek instance HoppyFHR.Decodable QItemSelection ([M54.QItemSelectionRange]) where decode = HoppyFHR.decode . toQItemSelectionConst instance HoppyFHR.Decodable QItemSelectionConst ([M54.QItemSelectionRange]) where decode = QtahFHR.toContents instance QtahFHR.HasContents QItemSelectionConst (M54.QItemSelectionRange) where toContents = QtahFHR.toContents . M198.toQListQItemSelectionRangeConst instance QtahFHR.HasContents QItemSelection (M54.QItemSelectionRange) where toContents = QtahFHR.toContents . M198.toQListQItemSelectionRange