packages feed

qtah-qt5-0.3.0: src/Graphics/UI/Qtah/Generated/Widgets/QGraphicsSceneWheelEvent.hs

{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, ScopedTypeVariables, TypeSynonymInstances, UndecidableInstances #-}
#if !MIN_VERSION_base(4,8,0)
{-# LANGUAGE OverlappingInstances #-}
#endif

---------- GENERATED FILE, EDITS WILL BE LOST ----------

module Graphics.UI.Qtah.Generated.Widgets.QGraphicsSceneWheelEvent (
  castQGraphicsSceneWheelEventToQGraphicsSceneEvent,
  castQGraphicsSceneEventToQGraphicsSceneWheelEvent,
  castQGraphicsSceneWheelEventToQEvent,
  castQEventToQGraphicsSceneWheelEvent,
  QGraphicsSceneWheelEventValue (..),
  QGraphicsSceneWheelEventConstPtr (..),
  buttons,
  delta,
  modifiers,
  orientation,
  pos,
  scenePos,
  screenPos,
  QGraphicsSceneWheelEventPtr (..),
  QGraphicsSceneWheelEventConst (..),
  castQGraphicsSceneWheelEventToConst,
  QGraphicsSceneWheelEvent (..),
  castQGraphicsSceneWheelEventToNonconst,
  QGraphicsSceneWheelEventSuper (..),
  QGraphicsSceneWheelEventSuperConst (..),
  ) where

import qualified Foreign as HoppyF
import qualified Foreign.C as HoppyFC
import qualified Foreign.Hoppy.Runtime as HoppyFHR
import qualified Graphics.UI.Qtah.Core.HPoint as HPoint
import qualified Graphics.UI.Qtah.Core.HPointF as HPointF
import qualified Graphics.UI.Qtah.Generated.Core.QEvent as M16
import qualified Graphics.UI.Qtah.Generated.Core.QPoint as M34
import qualified Graphics.UI.Qtah.Generated.Core.QPointF as M36
import qualified Graphics.UI.Qtah.Generated.Core.Types as M58
import qualified Graphics.UI.Qtah.Generated.Widgets.QGraphicsSceneEvent as M210
import Prelude (($), (.), (=<<), (==))
import qualified Prelude as HoppyP

foreign import ccall "genpop__QGraphicsSceneWheelEvent_buttons" buttons' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO HoppyFC.CInt
foreign import ccall "genpop__QGraphicsSceneWheelEvent_delta" delta' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO HoppyFC.CInt
foreign import ccall "genpop__QGraphicsSceneWheelEvent_modifiers" modifiers' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO HoppyFC.CInt
foreign import ccall "genpop__QGraphicsSceneWheelEvent_orientation" orientation' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO HoppyFC.CInt
foreign import ccall "genpop__QGraphicsSceneWheelEvent_pos" pos' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO (HoppyF.Ptr M36.QPointFConst)
foreign import ccall "genpop__QGraphicsSceneWheelEvent_scenePos" scenePos' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO (HoppyF.Ptr M36.QPointFConst)
foreign import ccall "genpop__QGraphicsSceneWheelEvent_screenPos" screenPos' ::  HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO (HoppyF.Ptr M34.QPointConst)
foreign import ccall "gencast__QGraphicsSceneWheelEvent__QGraphicsSceneEvent" castQGraphicsSceneWheelEventToQGraphicsSceneEvent :: HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyF.Ptr M210.QGraphicsSceneEventConst
foreign import ccall "gencast__QGraphicsSceneEvent__QGraphicsSceneWheelEvent" castQGraphicsSceneEventToQGraphicsSceneWheelEvent :: HoppyF.Ptr M210.QGraphicsSceneEventConst -> HoppyF.Ptr QGraphicsSceneWheelEventConst
foreign import ccall "gencast__QGraphicsSceneWheelEvent__QEvent" castQGraphicsSceneWheelEventToQEvent :: HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyF.Ptr M16.QEventConst
foreign import ccall "gencast__QEvent__QGraphicsSceneWheelEvent" castQEventToQGraphicsSceneWheelEvent :: HoppyF.Ptr M16.QEventConst -> HoppyF.Ptr QGraphicsSceneWheelEventConst
foreign import ccall "gendel__QGraphicsSceneWheelEvent" delete'QGraphicsSceneWheelEvent :: HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO ()
foreign import ccall "&gendel__QGraphicsSceneWheelEvent" deletePtr'QGraphicsSceneWheelEvent :: HoppyF.FunPtr (HoppyF.Ptr QGraphicsSceneWheelEventConst -> HoppyP.IO ())

class QGraphicsSceneWheelEventValue a where
  withQGraphicsSceneWheelEventPtr :: a -> (QGraphicsSceneWheelEventConst -> HoppyP.IO b) -> HoppyP.IO b

#if MIN_VERSION_base(4,8,0)
instance {-# OVERLAPPABLE #-} QGraphicsSceneWheelEventConstPtr a => QGraphicsSceneWheelEventValue a where
#else
instance QGraphicsSceneWheelEventConstPtr a => QGraphicsSceneWheelEventValue a where
#endif
  withQGraphicsSceneWheelEventPtr = HoppyP.flip ($) . toQGraphicsSceneWheelEventConst

class (M210.QGraphicsSceneEventConstPtr this) => QGraphicsSceneWheelEventConstPtr this where
  toQGraphicsSceneWheelEventConst :: this -> QGraphicsSceneWheelEventConst

buttons :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO M58.QtMouseButtons
buttons arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  HoppyP.fmap M58.QtMouseButtons
  (buttons' arg'1')

delta :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO HoppyP.Int
delta arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  HoppyP.fmap HoppyFHR.coerceIntegral
  (delta' arg'1')

modifiers :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO M58.QtKeyboardModifiers
modifiers arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  HoppyP.fmap M58.QtKeyboardModifiers
  (modifiers' arg'1')

orientation :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO M58.QtOrientation
orientation arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  HoppyP.fmap (HoppyP.toEnum . HoppyFHR.coerceIntegral)
  (orientation' arg'1')

pos :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO HPointF.HPointF
pos arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (HoppyFHR.decodeAndDelete . M36.QPointFConst) =<<
  (pos' arg'1')

scenePos :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO HPointF.HPointF
scenePos arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (HoppyFHR.decodeAndDelete . M36.QPointFConst) =<<
  (scenePos' arg'1')

screenPos :: (QGraphicsSceneWheelEventValue arg'1) => arg'1 -> HoppyP.IO HPoint.HPoint
screenPos arg'1 =
  withQGraphicsSceneWheelEventPtr arg'1 $ HoppyP.flip HoppyFHR.withCppPtr $ \arg'1' ->
  (HoppyFHR.decodeAndDelete . M34.QPointConst) =<<
  (screenPos' arg'1')

class (QGraphicsSceneWheelEventConstPtr this, M210.QGraphicsSceneEventPtr this) => QGraphicsSceneWheelEventPtr this where
  toQGraphicsSceneWheelEvent :: this -> QGraphicsSceneWheelEvent

data QGraphicsSceneWheelEventConst =
    QGraphicsSceneWheelEventConst (HoppyF.Ptr QGraphicsSceneWheelEventConst)
  | QGraphicsSceneWheelEventConstGc (HoppyF.ForeignPtr ()) (HoppyF.Ptr QGraphicsSceneWheelEventConst)
  deriving (HoppyP.Show)

instance HoppyP.Eq QGraphicsSceneWheelEventConst where
  x == y = HoppyFHR.toPtr x == HoppyFHR.toPtr y

instance HoppyP.Ord QGraphicsSceneWheelEventConst where
  compare x y = HoppyP.compare (HoppyFHR.toPtr x) (HoppyFHR.toPtr y)

castQGraphicsSceneWheelEventToConst :: QGraphicsSceneWheelEvent -> QGraphicsSceneWheelEventConst
castQGraphicsSceneWheelEventToConst (QGraphicsSceneWheelEvent ptr') = QGraphicsSceneWheelEventConst $ HoppyF.castPtr ptr'
castQGraphicsSceneWheelEventToConst (QGraphicsSceneWheelEventGc fptr' ptr') = QGraphicsSceneWheelEventConstGc fptr' $ HoppyF.castPtr ptr'

instance HoppyFHR.CppPtr QGraphicsSceneWheelEventConst where
  nullptr = QGraphicsSceneWheelEventConst HoppyF.nullPtr
  
  withCppPtr (QGraphicsSceneWheelEventConst ptr') f' = f' ptr'
  withCppPtr (QGraphicsSceneWheelEventConstGc fptr' ptr') f' = HoppyF.withForeignPtr fptr' $ \_ -> f' ptr'
  
  toPtr (QGraphicsSceneWheelEventConst ptr') = ptr'
  toPtr (QGraphicsSceneWheelEventConstGc _ ptr') = ptr'
  
  touchCppPtr (QGraphicsSceneWheelEventConst _) = HoppyP.return ()
  touchCppPtr (QGraphicsSceneWheelEventConstGc fptr' _) = HoppyF.touchForeignPtr fptr'

instance HoppyFHR.Deletable QGraphicsSceneWheelEventConst where
  delete (QGraphicsSceneWheelEventConst ptr') = delete'QGraphicsSceneWheelEvent ptr'
  delete (QGraphicsSceneWheelEventConstGc _ _) = HoppyP.fail $ HoppyP.concat ["Deletable.delete: Asked to delete a GC-managed ", "QGraphicsSceneWheelEventConst", " object."]
  
  toGc this'@(QGraphicsSceneWheelEventConst ptr') = if ptr' == HoppyF.nullPtr then HoppyP.return this' else HoppyP.fmap (HoppyP.flip QGraphicsSceneWheelEventConstGc ptr') $ HoppyF.newForeignPtr (HoppyF.castFunPtr deletePtr'QGraphicsSceneWheelEvent :: HoppyF.FunPtr (HoppyF.Ptr () -> HoppyP.IO ())) (HoppyF.castPtr ptr' :: HoppyF.Ptr ())
  toGc this'@(QGraphicsSceneWheelEventConstGc {}) = HoppyP.return this'

instance QGraphicsSceneWheelEventConstPtr QGraphicsSceneWheelEventConst where
  toQGraphicsSceneWheelEventConst = HoppyP.id

instance M210.QGraphicsSceneEventConstPtr QGraphicsSceneWheelEventConst where
  toQGraphicsSceneEventConst (QGraphicsSceneWheelEventConst ptr') = M210.QGraphicsSceneEventConst $ castQGraphicsSceneWheelEventToQGraphicsSceneEvent ptr'
  toQGraphicsSceneEventConst (QGraphicsSceneWheelEventConstGc fptr' ptr') = M210.QGraphicsSceneEventConstGc fptr' $ castQGraphicsSceneWheelEventToQGraphicsSceneEvent ptr'

instance M16.QEventConstPtr QGraphicsSceneWheelEventConst where
  toQEventConst (QGraphicsSceneWheelEventConst ptr') = M16.QEventConst $ castQGraphicsSceneWheelEventToQEvent ptr'
  toQEventConst (QGraphicsSceneWheelEventConstGc fptr' ptr') = M16.QEventConstGc fptr' $ castQGraphicsSceneWheelEventToQEvent ptr'

data QGraphicsSceneWheelEvent =
    QGraphicsSceneWheelEvent (HoppyF.Ptr QGraphicsSceneWheelEvent)
  | QGraphicsSceneWheelEventGc (HoppyF.ForeignPtr ()) (HoppyF.Ptr QGraphicsSceneWheelEvent)
  deriving (HoppyP.Show)

instance HoppyP.Eq QGraphicsSceneWheelEvent where
  x == y = HoppyFHR.toPtr x == HoppyFHR.toPtr y

instance HoppyP.Ord QGraphicsSceneWheelEvent where
  compare x y = HoppyP.compare (HoppyFHR.toPtr x) (HoppyFHR.toPtr y)

castQGraphicsSceneWheelEventToNonconst :: QGraphicsSceneWheelEventConst -> QGraphicsSceneWheelEvent
castQGraphicsSceneWheelEventToNonconst (QGraphicsSceneWheelEventConst ptr') = QGraphicsSceneWheelEvent $ HoppyF.castPtr ptr'
castQGraphicsSceneWheelEventToNonconst (QGraphicsSceneWheelEventConstGc fptr' ptr') = QGraphicsSceneWheelEventGc fptr' $ HoppyF.castPtr ptr'

instance HoppyFHR.CppPtr QGraphicsSceneWheelEvent where
  nullptr = QGraphicsSceneWheelEvent HoppyF.nullPtr
  
  withCppPtr (QGraphicsSceneWheelEvent ptr') f' = f' ptr'
  withCppPtr (QGraphicsSceneWheelEventGc fptr' ptr') f' = HoppyF.withForeignPtr fptr' $ \_ -> f' ptr'
  
  toPtr (QGraphicsSceneWheelEvent ptr') = ptr'
  toPtr (QGraphicsSceneWheelEventGc _ ptr') = ptr'
  
  touchCppPtr (QGraphicsSceneWheelEvent _) = HoppyP.return ()
  touchCppPtr (QGraphicsSceneWheelEventGc fptr' _) = HoppyF.touchForeignPtr fptr'

instance HoppyFHR.Deletable QGraphicsSceneWheelEvent where
  delete (QGraphicsSceneWheelEvent ptr') = delete'QGraphicsSceneWheelEvent $ (HoppyF.castPtr ptr' :: HoppyF.Ptr QGraphicsSceneWheelEventConst)
  delete (QGraphicsSceneWheelEventGc _ _) = HoppyP.fail $ HoppyP.concat ["Deletable.delete: Asked to delete a GC-managed ", "QGraphicsSceneWheelEvent", " object."]
  
  toGc this'@(QGraphicsSceneWheelEvent ptr') = if ptr' == HoppyF.nullPtr then HoppyP.return this' else HoppyP.fmap (HoppyP.flip QGraphicsSceneWheelEventGc ptr') $ HoppyF.newForeignPtr (HoppyF.castFunPtr deletePtr'QGraphicsSceneWheelEvent :: HoppyF.FunPtr (HoppyF.Ptr () -> HoppyP.IO ())) (HoppyF.castPtr ptr' :: HoppyF.Ptr ())
  toGc this'@(QGraphicsSceneWheelEventGc {}) = HoppyP.return this'

instance QGraphicsSceneWheelEventConstPtr QGraphicsSceneWheelEvent where
  toQGraphicsSceneWheelEventConst (QGraphicsSceneWheelEvent ptr') = QGraphicsSceneWheelEventConst $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'
  toQGraphicsSceneWheelEventConst (QGraphicsSceneWheelEventGc fptr' ptr') = QGraphicsSceneWheelEventConstGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'

instance QGraphicsSceneWheelEventPtr QGraphicsSceneWheelEvent where
  toQGraphicsSceneWheelEvent = HoppyP.id

instance M210.QGraphicsSceneEventConstPtr QGraphicsSceneWheelEvent where
  toQGraphicsSceneEventConst (QGraphicsSceneWheelEvent ptr') = M210.QGraphicsSceneEventConst $ castQGraphicsSceneWheelEventToQGraphicsSceneEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'
  toQGraphicsSceneEventConst (QGraphicsSceneWheelEventGc fptr' ptr') = M210.QGraphicsSceneEventConstGc fptr' $ castQGraphicsSceneWheelEventToQGraphicsSceneEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'

instance M210.QGraphicsSceneEventPtr QGraphicsSceneWheelEvent where
  toQGraphicsSceneEvent (QGraphicsSceneWheelEvent ptr') = M210.QGraphicsSceneEvent $ (HoppyF.castPtr :: HoppyF.Ptr M210.QGraphicsSceneEventConst -> HoppyF.Ptr M210.QGraphicsSceneEvent) $ castQGraphicsSceneWheelEventToQGraphicsSceneEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'
  toQGraphicsSceneEvent (QGraphicsSceneWheelEventGc fptr' ptr') = M210.QGraphicsSceneEventGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr M210.QGraphicsSceneEventConst -> HoppyF.Ptr M210.QGraphicsSceneEvent) $ castQGraphicsSceneWheelEventToQGraphicsSceneEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'

instance M16.QEventConstPtr QGraphicsSceneWheelEvent where
  toQEventConst (QGraphicsSceneWheelEvent ptr') = M16.QEventConst $ castQGraphicsSceneWheelEventToQEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'
  toQEventConst (QGraphicsSceneWheelEventGc fptr' ptr') = M16.QEventConstGc fptr' $ castQGraphicsSceneWheelEventToQEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'

instance M16.QEventPtr QGraphicsSceneWheelEvent where
  toQEvent (QGraphicsSceneWheelEvent ptr') = M16.QEvent $ (HoppyF.castPtr :: HoppyF.Ptr M16.QEventConst -> HoppyF.Ptr M16.QEvent) $ castQGraphicsSceneWheelEventToQEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'
  toQEvent (QGraphicsSceneWheelEventGc fptr' ptr') = M16.QEventGc fptr' $ (HoppyF.castPtr :: HoppyF.Ptr M16.QEventConst -> HoppyF.Ptr M16.QEvent) $ castQGraphicsSceneWheelEventToQEvent $ (HoppyF.castPtr :: HoppyF.Ptr QGraphicsSceneWheelEvent -> HoppyF.Ptr QGraphicsSceneWheelEventConst) ptr'

class QGraphicsSceneWheelEventSuper a where
  downToQGraphicsSceneWheelEvent :: a -> QGraphicsSceneWheelEvent

instance QGraphicsSceneWheelEventSuper M210.QGraphicsSceneEvent where
  downToQGraphicsSceneWheelEvent = castQGraphicsSceneWheelEventToNonconst . cast' . M210.castQGraphicsSceneEventToConst
    where
      cast' (M210.QGraphicsSceneEventConst ptr') = QGraphicsSceneWheelEventConst $ castQGraphicsSceneEventToQGraphicsSceneWheelEvent ptr'
      cast' (M210.QGraphicsSceneEventConstGc fptr' ptr') = QGraphicsSceneWheelEventConstGc fptr' $ castQGraphicsSceneEventToQGraphicsSceneWheelEvent ptr'
instance QGraphicsSceneWheelEventSuper M16.QEvent where
  downToQGraphicsSceneWheelEvent = castQGraphicsSceneWheelEventToNonconst . cast' . M16.castQEventToConst
    where
      cast' (M16.QEventConst ptr') = QGraphicsSceneWheelEventConst $ castQEventToQGraphicsSceneWheelEvent ptr'
      cast' (M16.QEventConstGc fptr' ptr') = QGraphicsSceneWheelEventConstGc fptr' $ castQEventToQGraphicsSceneWheelEvent ptr'

class QGraphicsSceneWheelEventSuperConst a where
  downToQGraphicsSceneWheelEventConst :: a -> QGraphicsSceneWheelEventConst

instance QGraphicsSceneWheelEventSuperConst M210.QGraphicsSceneEventConst where
  downToQGraphicsSceneWheelEventConst = cast'
    where
      cast' (M210.QGraphicsSceneEventConst ptr') = QGraphicsSceneWheelEventConst $ castQGraphicsSceneEventToQGraphicsSceneWheelEvent ptr'
      cast' (M210.QGraphicsSceneEventConstGc fptr' ptr') = QGraphicsSceneWheelEventConstGc fptr' $ castQGraphicsSceneEventToQGraphicsSceneWheelEvent ptr'
instance QGraphicsSceneWheelEventSuperConst M16.QEventConst where
  downToQGraphicsSceneWheelEventConst = cast'
    where
      cast' (M16.QEventConst ptr') = QGraphicsSceneWheelEventConst $ castQEventToQGraphicsSceneWheelEvent ptr'
      cast' (M16.QEventConstGc fptr' ptr') = QGraphicsSceneWheelEventConstGc fptr' $ castQEventToQGraphicsSceneWheelEvent ptr'

instance HoppyFHR.Assignable (HoppyF.Ptr (HoppyF.Ptr QGraphicsSceneWheelEvent)) QGraphicsSceneWheelEvent where
  assign ptr' value' = HoppyF.poke ptr' $ HoppyFHR.toPtr value'

instance HoppyFHR.Decodable (HoppyF.Ptr (HoppyF.Ptr QGraphicsSceneWheelEvent)) QGraphicsSceneWheelEvent where
  decode = HoppyP.fmap QGraphicsSceneWheelEvent . HoppyF.peek