-- 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.Widgets.QAbstractItemView (
  aModule,
  c_QAbstractItemView,
  e_ScrollHint,
  e_SelectionMode,
  e_ScrollMode,
  e_DragDropMode,
  e_EditTrigger,
  fl_EditTriggers,
  e_SelectionBehavior,
  ) where

import Foreign.Hoppy.Generator.Spec (
  addReqIncludes,
  classSetEntityPrefix,
  ident,
  ident1,
  includeStd,
  makeClass,
  mkBoolHasProp,
  mkConstMethod,
  mkConstMethod',
  mkMethod,
  mkMethod',
  mkProp,
  np,
  )
import Foreign.Hoppy.Generator.Types (
  boolT,
  enumT,
  intT,
  objT,
  ptrT,
  voidT,
  )
import Graphics.UI.Qtah.Generator.Flags (flagsT)
import Graphics.UI.Qtah.Generator.Interface.Core.QAbstractItemModel (c_QAbstractItemModel)
import Graphics.UI.Qtah.Generator.Interface.Core.QItemSelectionModel (c_QItemSelectionModel)
import Graphics.UI.Qtah.Generator.Interface.Core.QModelIndex (c_QModelIndex)
import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint)
import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect)
import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
import Graphics.UI.Qtah.Generator.Interface.Core.Types (
  e_DropAction,
  e_TextElideMode,
  )
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener (
  listener,
  listenerQModelIndex,
  listenerQSize,
  )
import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractItemDelegate (c_QAbstractItemDelegate)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea (c_QAbstractScrollArea)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
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] -> [QtExport] -> QtModule
makeQtModule [String
"Widgets", String
"QAbstractItemView"]
  [ Class -> [Signal] -> QtExport
QtExportClassAndSignals Class
c_QAbstractItemView [Signal]
signals
  , CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_DragDropMode
  , CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_EditTrigger
  , Flags -> QtExport
forall a. Exportable a => a -> QtExport
qtExport Flags
fl_EditTriggers
  , CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_ScrollHint
  , CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_ScrollMode
  , CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_SelectionBehavior
  , CppEnum -> QtExport
forall a. Exportable a => a -> QtExport
qtExport CppEnum
e_SelectionMode
  ]

(Class
c_QAbstractItemView, [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
"QAbstractItemView"] (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
"QAbstractItemView") Maybe ExtName
forall a. Maybe a
Nothing [Class
c_QAbstractScrollArea]
  [ String -> Type -> ClassEntity
mkProp String
"alternatingRowColors" Type
boolT
  , String -> ClassEntity
mkBoolHasProp String
"autoScroll"
  , String -> Type -> ClassEntity
mkProp String
"autoScrollMargin" Type
intT
  , String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"clearSelection" [Parameter]
np Type
voidT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"closePersistentEditor" [Class -> Type
objT Class
c_QModelIndex] Type
voidT
  , String -> Type -> ClassEntity
mkProp String
"currentIndex" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QModelIndex
  , String -> Type -> ClassEntity
mkProp String
"defaultDropAction" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_DropAction
  , String -> Type -> ClassEntity
mkProp String
"dragDropMode" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_DragDropMode
  , String -> Type -> ClassEntity
mkProp String
"dragDropOverwriteMode" Type
boolT
  , String -> Type -> ClassEntity
mkProp String
"dragEnabled" Type
boolT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"edit" [Class -> Type
objT Class
c_QModelIndex] Type
voidT
  , String -> Type -> ClassEntity
mkProp String
"editTriggers" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Flags -> Type
flagsT Flags
fl_EditTriggers
  , String -> Type -> ClassEntity
mkProp String
"horizontalScrollMode" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_ScrollMode
  , String -> Type -> ClassEntity
mkProp String
"iconSize" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QSize
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"indexAt" [Class -> Type
objT Class
c_QPoint] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QModelIndex
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"indexWidget" [Class -> Type
objT Class
c_QModelIndex] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QWidget
  , String -> String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> String -> [p] -> Type -> ClassEntity
mkConstMethod' String
"itemDelegate" String
"itemDelegate" [Parameter]
np (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$
    Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate
  , String -> String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> String -> [p] -> Type -> ClassEntity
mkConstMethod' String
"itemDelegate" String
"itemDelegateAt" [Class -> Type
objT Class
c_QModelIndex] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$
    Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"itemDelegateForColumn" [Type
intT] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$
    Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"itemDelegateForRow" [Type
intT] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$
    Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"keyboardSearch" [Class -> Type
objT Class
c_QString] Type
voidT
  , String -> Type -> ClassEntity
mkProp String
"model" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemModel
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"openPersistentEditor" [Class -> Type
objT Class
c_QModelIndex] Type
voidT
  , String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"reset" [Parameter]
np Type
voidT
  , String -> Type -> ClassEntity
mkProp String
"rootIndex" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QModelIndex
  , String -> String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> String -> [p] -> Type -> ClassEntity
mkMethod' String
"scrollTo" String
"scrollTo" [Class -> Type
objT Class
c_QModelIndex] Type
voidT
  , String -> String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> String -> [p] -> Type -> ClassEntity
mkMethod' String
"scrollTo" String
"scrollToWithHint" [Class -> Type
objT Class
c_QModelIndex, CppEnum -> Type
enumT CppEnum
e_ScrollHint] Type
voidT
  , String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"scrollToBottom" [Parameter]
np Type
voidT
  , String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"scrollToTop" [Parameter]
np Type
voidT
  , String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"selectAll" [Parameter]
np Type
voidT
  , String -> Type -> ClassEntity
mkProp String
"selectionBehavior" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_SelectionBehavior
  , String -> Type -> ClassEntity
mkProp String
"selectionMode" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_SelectionMode
  , String -> Type -> ClassEntity
mkProp String
"selectionModel" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QItemSelectionModel
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"setDropIndicatorShown" [Type
boolT] Type
voidT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"setIndexWidget" [Class -> Type
objT Class
c_QModelIndex, Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QWidget] Type
voidT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"setItemDelegate" [Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate] Type
voidT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"setItemDelegateForColumn" [Type
intT, Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate] Type
voidT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"setItemDelegateForRow" [Type
intT, Type -> Type
ptrT (Type -> Type) -> Type -> Type
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QAbstractItemDelegate] Type
voidT
  , String -> [Parameter] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"showDropIndicator" [Parameter]
np Type
boolT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"sizeHintForColumn" [Type
intT] Type
intT
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"sizeHintForIndex" [Class -> Type
objT Class
c_QModelIndex] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QSize
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"sizeHintForRow" [Type
intT] Type
intT
  , String -> Type -> ClassEntity
mkProp String
"tabKeyNavigation" Type
boolT
  , String -> Type -> ClassEntity
mkProp String
"textElideMode" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_TextElideMode
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkMethod String
"update" [Class -> Type
objT Class
c_QModelIndex] Type
voidT
  , String -> Type -> ClassEntity
mkProp String
"verticalScrollMode" (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ CppEnum -> Type
enumT CppEnum
e_ScrollMode
  , String -> [Type] -> Type -> ClassEntity
forall name p.
(IsFnName String name, IsParameter p) =>
name -> [p] -> Type -> ClassEntity
mkConstMethod String
"visualRect" [Class -> Type
objT Class
c_QModelIndex] (Type -> ClassEntity) -> Type -> ClassEntity
forall a b. (a -> b) -> a -> b
$ Class -> Type
objT Class
c_QRect
  ]

signalGens :: [SignalGen]
signalGens :: [SignalGen]
signalGens =
  [ String -> ListenerInfo -> SignalGen
makeSignal String
"activated" ListenerInfo
listenerQModelIndex
  , String -> ListenerInfo -> SignalGen
makeSignal String
"clicked" ListenerInfo
listenerQModelIndex
  , String -> ListenerInfo -> SignalGen
makeSignal String
"doubleClicked" ListenerInfo
listenerQModelIndex
  , String -> ListenerInfo -> SignalGen
makeSignal String
"entered" ListenerInfo
listenerQModelIndex
  , String -> ListenerInfo -> SignalGen
makeSignal String
"iconSizeChanged" ListenerInfo
listenerQSize
  , String -> ListenerInfo -> SignalGen
makeSignal String
"pressed" ListenerInfo
listenerQModelIndex
  , String -> ListenerInfo -> SignalGen
makeSignal String
"viewportEntered" ListenerInfo
listener
  ]

e_DragDropMode :: CppEnum
e_DragDropMode =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractItemView" String
"DragDropMode") [String -> Include
includeStd String
"QAbstractItemView"]
  [ String
"NoDragDrop"
  , String
"DragOnly"
  , String
"DropOnly"
  , String
"DragDrop"
  , String
"InternalMove"
  ]

(CppEnum
e_EditTrigger, Flags
fl_EditTriggers) =
  Identifier -> String -> [Include] -> [String] -> (CppEnum, Flags)
makeQtEnumAndFlags (String -> String -> Identifier
ident1 String
"QAbstractItemView" String
"EditTrigger") String
"EditTriggers"
  [String -> Include
includeStd String
"QAbstractItemView"]
  [ String
"NoEditTriggers"
  , String
"CurrentChanged"
  , String
"DoubleClicked"
  , String
"SelectedClicked"
  , String
"EditKeyPressed"
  , String
"AnyKeyPressed"
  , String
"AllEditTriggers"
  ]

e_ScrollHint :: CppEnum
e_ScrollHint =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractItemView" String
"ScrollHint") [String -> Include
includeStd String
"QAbstractItemView"]
  [ String
"EnsureVisible"
  , String
"PositionAtTop"
  , String
"PositionAtBottom"
  , String
"PositionAtCenter"
  ]

e_ScrollMode :: CppEnum
e_ScrollMode =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractItemView" String
"ScrollMode") [String -> Include
includeStd String
"QAbstractItemView"]
  [ String
"ScrollPerItem"
  , String
"ScrollPerPixel"
  ]

e_SelectionBehavior :: CppEnum
e_SelectionBehavior =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractItemView" String
"SelectionBehavior") [String -> Include
includeStd String
"QAbstractItemView"]
  [ String
"SelectItems"
  , String
"SelectRows"
  , String
"SelectColumns"
  ]

e_SelectionMode :: CppEnum
e_SelectionMode =
  Identifier -> [Include] -> [String] -> CppEnum
makeQtEnum (String -> String -> Identifier
ident1 String
"QAbstractItemView" String
"SelectionMode") [String -> Include
includeStd String
"QAbstractItemView"]
  [ String
"NoSelection"
  , String
"SingleSelection"
  , String
"MultiSelection"
  , String
"ExtendedSelection"
  , String
"ContiguousSelection"
  ]