-- This file is part of Qtah.
--
-- Copyright 2015-2021 The Qtah Authors.
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program.  If not, see <http://www.gnu.org/licenses/>.

module Graphics.UI.Qtah.Generator.Interface.Core.QAbstractAnimation (
  aModule,
  c_QAbstractAnimation,
  e_DeletionPolicy,
  e_Direction,
  e_State,
  ) where

import Foreign.Hoppy.Generator.Spec (
  addReqIncludes,
  classSetEntityPrefix,
  ident,
  ident1,
  includeStd,
  makeClass,
  mkConstMethod,
  mkMethod',
  mkMethod,
  np,
  )
import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)
import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener (
  listener,
  listenerDirection,
  listenerInt,
  listenerStateState,
  )
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion)
import Graphics.UI.Qtah.Generator.Types

{-# ANN module "HLint: ignore Use camelCase" #-}

aModule :: AModule
aModule =
  QtModule -> AModule
AQtModule (QtModule -> AModule) -> QtModule -> AModule
forall a b. (a -> b) -> a -> b
$
  [String] -> Version -> [QtExport] -> QtModule
makeQtModuleWithMinVersion [String
"Core", String
"QAbstractAnimation"] [Int
4, Int
6] ([QtExport] -> QtModule) -> [QtExport] -> QtModule
forall a b. (a -> b) -> a -> b
$
  Class -> [Signal] -> QtExport
QtExportClassAndSignals Class
c_QAbstractAnimation [Signal]
signals QtExport -> [QtExport] -> [QtExport]
forall a. a -> [a] -> [a]
:
  [Filtered QtExport] -> [QtExport]
forall a. [Filtered a] -> [a]
collect
  [ QtExport -> Filtered QtExport
forall a. a -> Filtered a
just (QtExport -> Filtered QtExport) -> QtExport -> Filtered QtExport
forall a b. (a -> b) -> a -> b
$ CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_DeletionPolicy
  , QtExport -> Filtered QtExport
forall a. a -> Filtered a
just (QtExport -> Filtered QtExport) -> QtExport -> Filtered QtExport
forall a b. (a -> b) -> a -> b
$ CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_Direction
  , QtExport -> Filtered QtExport
forall a. a -> Filtered a
just (QtExport -> Filtered QtExport) -> QtExport -> Filtered QtExport
forall a b. (a -> b) -> a -> b
$ CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_State
  ]

(Class
c_QAbstractAnimation, [Signal]
signals) =
  [SignalGen] -> Class -> (Class, [Signal])
makeQtClassAndSignals [SignalGen]
signalGens (Class -> (Class, [Signal])) -> Class -> (Class, [Signal])
forall a b. (a -> b) -> a -> b
$
  [Include] -> Class -> Class
forall a. HasReqs a => [Include] -> a -> a
addReqIncludes [ String -> Include
includeStd String
"QAbstractAnimation" ] (Class -> Class) -> Class -> Class
forall a b. (a -> b) -> a -> b
$
  String -> Class -> Class
classSetEntityPrefix String
"" (Class -> Class) -> Class -> Class
forall a b. (a -> b) -> a -> b
$
  Identifier -> Maybe ExtName -> [Class] -> [ClassEntity] -> Class
makeClass (String -> Identifier
ident String
"QAbstractAnimation") Maybe ExtName
forall a. Maybe a
Nothing [Class
c_QObject] ([ClassEntity] -> Class) -> [ClassEntity] -> Class
forall a b. (a -> b) -> a -> b
$
  [Filtered ClassEntity] -> [ClassEntity]
forall a. [Filtered a] -> [a]
collect
  [ ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"currentLoopTime" [Parameter]
np Type
intT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"duration" [Parameter]
np Type
intT
  --, just $ mkConstMethod "group" np $ ptrT $ objT c_QAnimationGroup
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"pause" [Parameter]
np Type
voidT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"resume" [Parameter]
np Type
voidT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"setPaused" [Type
boolT] Type
voidT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> String -> [p] -> Type -> ClassEntity
mkMethod' String
"start" String
"start" [Parameter]
np Type
voidT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> String -> [p] -> Type -> ClassEntity
mkMethod' String
"start" String
"startWithDeletionPolicy" [CppEnum -> Type
enumT CppEnum
e_DeletionPolicy] Type
voidT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"stop" [Parameter]
np Type
voidT
  , ClassEntity -> Filtered ClassEntity
forall a. a -> Filtered a
just (ClassEntity -> Filtered ClassEntity)
-> ClassEntity -> Filtered ClassEntity
forall a b. (a -> b) -> a -> b
$ String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"totalDuration" [Parameter]
np Type
intT

    -- TODO
  ]

signalGens :: [SignalGen]
signalGens :: [SignalGen]
signalGens =
  [Filtered SignalGen] -> [SignalGen]
forall a. [Filtered a] -> [a]
collect
  [ SignalGen -> Filtered SignalGen
forall a. a -> Filtered a
just (SignalGen -> Filtered SignalGen)
-> SignalGen -> Filtered SignalGen
forall a b. (a -> b) -> a -> b
$ String -> ListenerInfo -> SignalGen
makeSignal String
"currentLoopChanged" ListenerInfo
listenerInt
  , SignalGen -> Filtered SignalGen
forall a. a -> Filtered a
just (SignalGen -> Filtered SignalGen)
-> SignalGen -> Filtered SignalGen
forall a b. (a -> b) -> a -> b
$ String -> ListenerInfo -> SignalGen
makeSignal String
"directionChanged" ListenerInfo
listenerDirection
  , SignalGen -> Filtered SignalGen
forall a. a -> Filtered a
just (SignalGen -> Filtered SignalGen)
-> SignalGen -> Filtered SignalGen
forall a b. (a -> b) -> a -> b
$ String -> ListenerInfo -> SignalGen
makeSignal String
"finished" ListenerInfo
listener
  , SignalGen -> Filtered SignalGen
forall a. a -> Filtered a
just (SignalGen -> Filtered SignalGen)
-> SignalGen -> Filtered SignalGen
forall a b. (a -> b) -> a -> b
$ String -> ListenerInfo -> SignalGen
makeSignal String
"stateChanged" ListenerInfo
listenerStateState
  ]

e_DeletionPolicy :: CppEnum
e_DeletionPolicy =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractAnimation" String
"DeletionPolicy") [String -> Include
includeStd String
"QAbstractAnimation"]
  [ String
"KeepWhenStopped"
  , String
"DeleteWhenStopped"
  ]

e_Direction :: CppEnum
e_Direction =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractAnimation" String
"Direction") [String -> Include
includeStd String
"QAbstractAnimation"]
  [ String
"Forward"
  , String
"Backward"
  ]

e_State :: CppEnum
e_State =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractAnimation" String
"State") [String -> Include
includeStd String
"QAbstractAnimation"]
  [ String
"Stopped"
  , String
"Paused"
  , String
"Running"
  ]