Commit a94fc1bd authored by Yuriy Syrovetskiy's avatar Yuriy Syrovetskiy Committed by Bryan Gardiner

Add QStandardItem{,Model}, QToolBar, and various methods.

parent 2b9acac3
......@@ -5,3 +5,6 @@ Bryan Gardiner <bog@khumba.net>
effectfully <effectfully@gmail.com>
- Qt graphics view framework classes.
Yuriy Syrovetskiy <cblp@cblp.su>
- Filling some holes.
......@@ -116,6 +116,7 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Gui.QRasterWindow
, Graphics.UI.Qtah.Generator.Interface.Gui.QRegion
, Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent
, Graphics.UI.Qtah.Generator.Interface.Gui.QStandardItemModel
, Graphics.UI.Qtah.Generator.Interface.Gui.QSurface
, Graphics.UI.Qtah.Generator.Interface.Gui.QTransform
, Graphics.UI.Qtah.Generator.Interface.Gui.QValidator
......@@ -189,6 +190,7 @@ executable qtah-generator
, Graphics.UI.Qtah.Generator.Interface.Widgets.QSystemTrayIcon
, Graphics.UI.Qtah.Generator.Interface.Widgets.QTabWidget
, Graphics.UI.Qtah.Generator.Interface.Widgets.QTextEdit
, Graphics.UI.Qtah.Generator.Interface.Widgets.QToolBar
, Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeView
, Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeWidget
, Graphics.UI.Qtah.Generator.Interface.Widgets.QVBoxLayout
......
......@@ -86,6 +86,9 @@ forEachListener() {
$fn PtrQAbstractItemModel "QAbstractItemModel*"
$fn PtrQAction "QAction*"
$fn PtrQObject "QObject*"
$fn PtrQTreeWidgetItem "QTreeWidgetItem*"
$fn PtrQTreeWidgetItemInt "QTreeWidgetItem*|int"
$fn PtrQTreeWidgetItemPtrQTreeWidgetItem "QTreeWidgetItem*|QTreeWidgetItem*"
$fn PtrQWidgetPtrQWidget "QWidget*|QWidget*"
$fn RefConstQIcon "const QIcon&"
$fn RefConstQItemSelectionRefConstQItemSelection "const QItemSelection&|const QItemSelection&"
......
......@@ -24,6 +24,7 @@ module Graphics.UI.Qtah.Generator.Interface.Core.QList (
defaultOptions,
Contents (..),
inheritHasContents,
instantiate,
-- * Instantiations
allModules,
c_QListInt,
......@@ -111,8 +112,10 @@ import Language.Haskell.Syntax (
HsType (HsTyApp, HsTyCon),
)
{-# ANN module "HLint: ignore Use camelCase" #-}
-- | Options for instantiating the list classes.
data Options = Options
newtype Options = Options
{ optListClassFeatures :: [ClassFeature]
-- ^ Additional features to add to the @QList@ class. Lists are always
-- 'Assignable' and 'Copyable', but you may want to add 'Equatable' if your
......@@ -124,7 +127,7 @@ defaultOptions :: Options
defaultOptions = Options []
-- | A set of instantiated classes.
data Contents = Contents
newtype Contents = Contents
{ c_QList :: Class -- ^ @QList\<T>@
}
......@@ -253,7 +256,7 @@ instantiate' listName t tReqs opts =
ClassHaskellConversion
{ classHaskellConversionType = Just $ do
hsType <- cppTypeToHsTypeAndUse HsHsSide t
return $ HsTyApp (HsTyCon $ Special $ HsListCon) hsType
return $ HsTyApp (HsTyCon $ Special HsListCon) hsType
, classHaskellConversionToCppFn = Just $ do
addImports importForRuntime
sayLn "QtahFHR.fromContents"
......@@ -285,7 +288,7 @@ inheritHasContents cls listClass t =
-- | Converts an instantiation into a list of exports to be included in a
-- module.
toExports :: Contents -> [QtExport]
toExports m = map (QtExport . ExportClass . ($ m)) [c_QList]
toExports m = [QtExport . ExportClass $ c_QList m]
createModule :: String -> Contents -> QtModule
createModule name contents = makeQtModule ["Core", "QList", name] $ toExports contents
......
......@@ -26,6 +26,7 @@ module Graphics.UI.Qtah.Generator.Interface.Core.Types (
e_BrushStyle,
e_CaseSensitivity,
e_CheckState,
e_ContextMenuPolicy,
e_Corner,
e_CursorMoveStyle,
e_DropAction,
......@@ -77,6 +78,7 @@ module Graphics.UI.Qtah.Generator.Interface.Core.Types (
import Data.Bits ((.|.))
import Foreign.Hoppy.Generator.Spec (
CppEnum,
Export (ExportBitspace, ExportEnum, ExportFn),
Include,
Purity (Nonpure),
......@@ -108,6 +110,7 @@ exports =
, just $ ExportEnum e_BrushStyle
, just $ ExportEnum e_CaseSensitivity
, just $ ExportEnum e_CheckState
, just $ ExportEnum e_ContextMenuPolicy
, just $ ExportEnum e_Corner
, just $ ExportEnum e_CursorMoveStyle
, just $ ExportEnum e_DropAction
......@@ -221,6 +224,16 @@ e_CheckState =
, (2, ["checked"])
]
e_ContextMenuPolicy :: CppEnum
e_ContextMenuPolicy =
makeQtEnum (ident1 "Qt" "ContextMenuPolicy") qtInclude
[ (0, ["no", "context", "menu"])
, (4, ["prevent", "context", "menu"])
, (1, ["default", "context", "menu"])
, (2, ["actions", "context", "menu"])
, (3, ["custom", "context", "menu"])
]
e_Corner =
makeQtEnum (ident1 "Qt" "Corner") qtInclude
[ (0x00000, ["top", "left", "corner"])
......
......@@ -48,6 +48,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QPolygonF as QPolygonF
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QRasterWindow as QRasterWindow
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QRegion as QRegion
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent as QShowEvent
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QStandardItemModel as QStandardItemModel
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QSurface as QSurface
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QTransform as QTransform
import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QValidator as QValidator
......@@ -92,6 +93,10 @@ modules =
, QRasterWindow.aModule
, QRegion.aModule
, QShowEvent.aModule
, QStandardItemModel.aModule
, QStandardItemModel.itemModule
, QStandardItemModel.itemListModule
, QSurface.aModule
, QTransform.aModule
, QValidator.aModule
......
-- This file is part of Qtah.
--
-- Copyright 2015-2017 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.Gui.QStandardItemModel (
aModule,
itemModule,
itemListModule,
c_QStandardItemModel,
) where
import Foreign.Hoppy.Generator.Spec (
Class,
Export (ExportClass),
addReqIncludes,
classSetEntityPrefix,
ident,
includeStd,
makeClass,
mkConstMethod,
mkCtor,
mkMethod,
mkMethod',
)
import Foreign.Hoppy.Generator.Types (
boolT, enumT, objT, refT, voidT, ptrT, intT, bitspaceT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Core.QAbstractItemModel (
c_QAbstractItemModel)
import Graphics.UI.Qtah.Generator.Interface.Core.QList (
c_QList, Contents, instantiate)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment)
import Graphics.UI.Qtah.Generator.Interface.Gui.QIcon (c_QIcon)
import Graphics.UI.Qtah.Generator.Module (
AModule (AQtModule), makeQtModule, QtModule, makeQtModuleWithMinVersion)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule :: AModule
aModule =
AQtModule $
makeQtModule ["Gui", "QStandardItemModel"]
[QtExport $ ExportClass c_QStandardItemModel]
itemModule :: AModule
itemModule =
AQtModule $
makeQtModuleWithMinVersion
["Gui", "QStandardItem"]
[4, 2]
[QtExport $ ExportClass c_QStandardItem]
itemListModule :: AModule
itemListModule =
AQtModule $
makeQtModuleWithMinVersion
["Core", "QList", "QStandardItem"]
[4, 2]
[QtExport $ ExportClass c_QListQStandardItem]
c_QStandardItemModel :: Class
c_QStandardItemModel =
addReqIncludes [includeStd "QStandardItemModel"] $
classSetEntityPrefix "" $
makeClass (ident "QStandardItemModel") Nothing [c_QAbstractItemModel] $
collect
[ test (qtVersion >= [4, 2]) $
mkMethod' "appendRow" "appendRowItems" [objT c_QListQStandardItem] voidT
, test (qtVersion >= [4, 2]) $
mkMethod' "appendRow" "appendRowItem" [ptrT $ objT c_QStandardItem] voidT
]
c_QStandardItem :: Class
c_QStandardItem =
addReqIncludes [includeStd "QStandardItem"] $
classSetEntityPrefix "" $
makeClass (ident "QStandardItem") Nothing [] $
collect
[ just $ mkCtor "new" []
, just $ mkCtor "newWithText" [objT c_QString]
, just $ mkCtor "newWithIconAndText" [objT c_QIcon, objT c_QString]
, just $ mkCtor "newWithRows" [intT]
, just $ mkCtor "newWithRowsAndColumns" [intT, intT]
, just $ mkConstMethod "model" [] (ptrT $ objT c_QAbstractItemModel)
, just $ mkMethod "setText" [objT c_QString] voidT
, just $ mkMethod "setTextAlignment" [bitspaceT bs_Alignment] voidT
-- TODO other methods
]
c_QListQStandardItem :: Class
c_QListQStandardItem = c_QList contents_QStandardItem
contents_QStandardItem :: Contents
contents_QStandardItem =
instantiate "QListQStandardItem" (ptrT $ objT c_QStandardItem) mempty
......@@ -18,6 +18,7 @@
module Graphics.UI.Qtah.Generator.Interface.Internal.Callback where
import Foreign.Hoppy.Generator.Spec (
Callback,
Export (ExportCallback),
makeCallback,
makeModule,
......@@ -68,6 +69,7 @@ import Graphics.UI.Qtah.Generator.Interface.Widgets.QGraphicsItem (c_QGraphicsIt
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QSystemTrayIcon (
e_ActivationReason,
)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeWidget (c_QTreeWidgetItem)
import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)
import Graphics.UI.Qtah.Generator.Module (AModule (AHoppyModule))
......@@ -91,6 +93,9 @@ aModule =
, just $ ExportCallback cb_PtrQObjectPtrQEventBool
, just $ ExportCallback cb_PtrQObjectVoid
, just $ ExportCallback cb_PtrQPaintEventVoid
, just $ ExportCallback cb_PtrQTreeWidgetItemVoid
, just $ ExportCallback cb_PtrQTreeWidgetItemIntVoid
, just $ ExportCallback cb_PtrQTreeWidgetItemPtrQTreeWidgetItemVoid
, just $ ExportCallback cb_PtrQWidgetPtrQWidgetVoid
, just $ ExportCallback cb_QAbstractSliderActionVoid
, just $ ExportCallback cb_QClipboardModeVoid
......@@ -165,6 +170,21 @@ cb_PtrQPaintEventVoid =
makeCallback (toExtName "CallbackPtrQPaintEventVoid")
[ptrT $ objT c_QPaintEvent] voidT
cb_PtrQTreeWidgetItemVoid :: Callback
cb_PtrQTreeWidgetItemVoid =
makeCallback (toExtName "CallbackPtrQTreeWidgetItemVoid")
[ptrT $ objT c_QTreeWidgetItem] voidT
cb_PtrQTreeWidgetItemIntVoid :: Callback
cb_PtrQTreeWidgetItemIntVoid =
makeCallback (toExtName "CallbackPtrQTreeWidgetItemIntVoid")
[ptrT $ objT c_QTreeWidgetItem, intT] voidT
cb_PtrQTreeWidgetItemPtrQTreeWidgetItemVoid :: Callback
cb_PtrQTreeWidgetItemPtrQTreeWidgetItemVoid =
makeCallback (toExtName "CallbackPtrQTreeWidgetItemPtrQTreeWidgetItemVoid")
[ptrT $ objT c_QTreeWidgetItem, ptrT $ objT c_QTreeWidgetItem] voidT
cb_PtrQWidgetPtrQWidgetVoid =
makeCallback (toExtName "CallbackPtrQWidgetPtrQWidgetVoid")
[ptrT $ objT c_QWidget, ptrT $ objT c_QWidget] voidT
......
......@@ -76,6 +76,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QStatusBar as QSta
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QSystemTrayIcon as QSystemTrayIcon
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QTabWidget as QTabWidget
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QTextEdit as QTextEdit
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QToolBar as QToolBar
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeView as QTreeView
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeWidget as QTreeWidget
import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QVBoxLayout as QVBoxLayout
......@@ -145,6 +146,7 @@ modules =
, QSystemTrayIcon.aModule
, QTabWidget.aModule
, QTextEdit.aModule
, QToolBar.aModule
, QTreeView.aModule
, QTreeWidget.aModule
, QTreeWidget.itemModule
......
......@@ -37,6 +37,8 @@ import Foreign.Hoppy.Generator.Spec (
mkProp,
)
import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, constT, enumT, intT, objT, ptrT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Core.QMargins (c_QMargins)
import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
......@@ -64,55 +66,57 @@ aModule =
c_QLineEdit =
addReqIncludes [includeStd "QLineEdit"] $
classSetEntityPrefix "" $
makeClass (ident "QLineEdit") Nothing [c_QWidget]
[ mkCtor "new" []
, mkCtor "newWithParent" [ptrT $ objT c_QWidget]
, mkCtor "newWithText" [objT c_QString]
, mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget]
, mkProp "alignment" $ bitspaceT bs_Alignment
, mkMethod "backspace" [] voidT
, mkMethod "clear" [] voidT
makeClass (ident "QLineEdit") Nothing [c_QWidget] $
collect
[ just $ mkCtor "new" []
, just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]
, just $ mkCtor "newWithText" [objT c_QString]
, just $ mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget]
, just $ mkProp "alignment" $ bitspaceT bs_Alignment
, just $ mkMethod "backspace" [] voidT
, just $ mkMethod "clear" [] voidT
, test (qtVersion >= [5, 2]) $ mkBoolIsProp "clearButtonEnabled"
-- TODO completer
, mkConstMethod "copy" [] voidT
, mkMethod "createStandardContextMenu" [] $ ptrT $ objT c_QMenu
, mkMethod "cursorBackward" [boolT, intT] voidT
, mkMethod "cursorForward" [boolT, intT] voidT
, mkProp "cursorMoveStyle" $ enumT e_CursorMoveStyle
, mkProp "cursorPosition" intT
, mkMethod "cursorPositionAt" [objT c_QPoint] intT
, mkMethod "cursorWordBackward" [boolT] voidT
, mkMethod "cursorWordForward" [boolT] voidT
, mkMethod "cut" [] voidT
, mkMethod "del" [] voidT
, mkMethod "deselect" [] voidT
, mkConstMethod "displayText" [] $ objT c_QString
, mkProp "dragEnabled" boolT
, mkProp "echoMode" $ enumT e_EchoMode
, mkMethod "end" [boolT] voidT
, mkBoolHasProp "frame"
, mkConstMethod "hasAcceptableInput" [] boolT
, mkConstMethod "hasSelectedText" [] boolT
, mkMethod "home" [boolT] voidT
, mkProp "inputMask" $ objT c_QString
, mkMethod "insert" [objT c_QString] voidT
, mkConstMethod "isRedoAvailable" [] boolT
, mkConstMethod "isUndoAvailable" [] boolT
, mkProp "maxLength" intT
, mkBoolIsProp "modified"
, mkMethod "paste" [] voidT
, mkProp "placeholderText" $ objT c_QString
, mkBoolIsProp "readOnly"
, mkMethod "redo" [] voidT
, mkMethod "selectAll" [] voidT
, mkConstMethod "selectedText" [] $ objT c_QString
, mkConstMethod "selectionStart" [] intT
, mkMethod "setSelection" [intT, intT] voidT
, mkMethod' "setTextMargins" "setTextMargins" [objT c_QMargins] voidT
, mkMethod' "setTextMargins" "setTextMarginsRaw" [intT, intT, intT, intT] voidT
, mkProp "text" $ objT c_QString
, mkConstMethod "textMargins" [] $ objT c_QMargins
, mkMethod "undo" [] voidT
, mkProp "validator" $ ptrT $ constT $ objT c_QValidator
, just $ mkConstMethod "copy" [] voidT
, just $ mkMethod "createStandardContextMenu" [] $ ptrT $ objT c_QMenu
, just $ mkMethod "cursorBackward" [boolT, intT] voidT
, just $ mkMethod "cursorForward" [boolT, intT] voidT
, just $ mkProp "cursorMoveStyle" $ enumT e_CursorMoveStyle
, just $ mkProp "cursorPosition" intT
, just $ mkMethod "cursorPositionAt" [objT c_QPoint] intT
, just $ mkMethod "cursorWordBackward" [boolT] voidT
, just $ mkMethod "cursorWordForward" [boolT] voidT
, just $ mkMethod "cut" [] voidT
, just $ mkMethod "del" [] voidT
, just $ mkMethod "deselect" [] voidT
, just $ mkConstMethod "displayText" [] $ objT c_QString
, just $ mkProp "dragEnabled" boolT
, just $ mkProp "echoMode" $ enumT e_EchoMode
, just $ mkMethod "end" [boolT] voidT
, just $ mkBoolHasProp "frame"
, just $ mkConstMethod "hasAcceptableInput" [] boolT
, just $ mkConstMethod "hasSelectedText" [] boolT
, just $ mkMethod "home" [boolT] voidT
, just $ mkProp "inputMask" $ objT c_QString
, just $ mkMethod "insert" [objT c_QString] voidT
, just $ mkConstMethod "isRedoAvailable" [] boolT
, just $ mkConstMethod "isUndoAvailable" [] boolT
, just $ mkProp "maxLength" intT
, just $ mkBoolIsProp "modified"
, just $ mkMethod "paste" [] voidT
, just $ mkProp "placeholderText" $ objT c_QString
, just $ mkBoolIsProp "readOnly"
, just $ mkMethod "redo" [] voidT
, just $ mkMethod "selectAll" [] voidT
, just $ mkConstMethod "selectedText" [] $ objT c_QString
, just $ mkConstMethod "selectionStart" [] intT
, just $ mkMethod "setSelection" [intT, intT] voidT
, just $ mkMethod' "setTextMargins" "setTextMargins" [objT c_QMargins] voidT
, just $ mkMethod' "setTextMargins" "setTextMarginsRaw" [intT, intT, intT, intT] voidT
, just $ mkProp "text" $ objT c_QString
, just $ mkConstMethod "textMargins" [] $ objT c_QMargins
, just $ mkMethod "undo" [] voidT
, just $ mkProp "validator" $ ptrT $ constT $ objT c_QValidator
]
signals =
......
......@@ -20,6 +20,7 @@ module Graphics.UI.Qtah.Generator.Interface.Widgets.QMainWindow (
) where
import Foreign.Hoppy.Generator.Spec (
Class,
Export (ExportClass),
addReqIncludes,
classSetEntityPrefix,
......@@ -29,26 +30,31 @@ import Foreign.Hoppy.Generator.Spec (
mkBoolIsProp,
mkCtor,
mkMethod,
mkMethod',
mkProp,
)
import Foreign.Hoppy.Generator.Types (boolT, objT, ptrT)
import Foreign.Hoppy.Generator.Types (boolT, objT, ptrT, voidT)
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.Internal.Listener (c_ListenerQSize)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenu (c_QMenu)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenuBar (c_QMenuBar)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QStatusBar (c_QStatusBar)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QToolBar (c_QToolBar)
import 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 =
AQtModule $
makeQtModule ["Widgets", "QMainWindow"] $
QtExport (ExportClass c_QMainWindow) :
map QtExportSignal signals
c_QMainWindow :: Class
c_QMainWindow =
addReqIncludes [includeStd "QMainWindow"] $
classSetEntityPrefix "" $
......@@ -57,7 +63,9 @@ c_QMainWindow =
, mkCtor "newWithParent" [ptrT $ objT c_QWidget]
-- TODO Ctor with Qt::WindowFlags.
-- TODO addDockWidget
-- TODO addToolBar
-- TODO mkMethod' "addToolBar" "addToolBarWithArea" [e_ToolBarArea, ptrT $ objT c_QToolBar] voidT
, mkMethod "addToolBar" [ptrT $ objT c_QToolBar] voidT
, mkMethod' "addToolBar" "addToolBarWithTitle" [objT c_QString] (ptrT $ objT c_QToolBar)
-- TODO addToolBarBreak
, mkBoolIsProp "animated"
, mkProp "centralWidget" $ ptrT $ objT c_QWidget
......@@ -90,6 +98,7 @@ c_QMainWindow =
, mkProp "unifiedTitleAndToolBarOnMac" boolT
]
signals :: [Signal]
signals =
[ makeSignal c_QMainWindow "iconSizeChanged" c_ListenerQSize
-- TODO toolButtonStyleChanged
......
-- This file is part of Qtah.
--
-- Copyright 2015-2017 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.QToolBar (
aModule,
c_QToolBar,
) where
import Foreign.Hoppy.Generator.Spec (
Class,
Export (ExportClass),
addReqIncludes,
classSetEntityPrefix,
ident,
includeStd,
makeClass,
mkCtor,
mkMethod,
)
import Foreign.Hoppy.Generator.Types (objT, ptrT)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction)
import 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 =
AQtModule $
makeQtModule ["Widgets", "QToolBar"] $
QtExport (ExportClass c_QToolBar) :
map QtExportSignal signals
c_QToolBar :: Class
c_QToolBar =
addReqIncludes [includeStd "QToolBar"] $
classSetEntityPrefix "" $
makeClass (ident "QToolBar") Nothing [c_QWidget]
[ mkCtor "new" []
, mkCtor "newWithParent" [ptrT $ objT c_QWidget]
, mkCtor "newWithTitle" [objT c_QString]
, mkCtor "newWithTitleAndParent" [objT c_QString, ptrT $ objT c_QWidget]
, mkMethod "addWidget" [ptrT $ objT c_QWidget] (ptrT $ objT c_QAction)
, mkMethod "insertWidget" [ptrT $ objT c_QAction, ptrT $ objT c_QWidget] (ptrT $ objT c_QAction)
-- TODO add methods
]
signals :: [Signal]
signals =
[ -- TODO add signals
]
......@@ -21,6 +21,7 @@ module Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeView (
) where
import Foreign.Hoppy.Generator.Spec (
Class,
Export (ExportClass),
addReqIncludes,
classSetEntityPrefix,
......@@ -29,22 +30,38 @@ import Foreign.Hoppy.Generator.Spec (
makeClass,
mkCtor,
mkBoolIsProp,
mkMethod,
)
import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractItemView (c_QAbstractItemView)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule :: AModule
aModule =
AQtModule $
makeQtModule ["Widgets", "QTreeView"]
[ QtExport $ ExportClass c_QTreeView ]
makeQtModule ["Widgets", "QTreeView"] $
QtExport (ExportClass c_QTreeView) :
map QtExportSignal signals
c_QTreeView :: Class
c_QTreeView =
addReqIncludes [includeStd "QTreeView"] $
classSetEntityPrefix "" $
makeClass (ident "QTreeView") Nothing [c_QAbstractItemView]
[ mkCtor "new" []
, mkBoolIsProp "headerHidden"
makeClass (ident "QTreeView") Nothing [c_QAbstractItemView] $
collect
[ just $ mkCtor "new" []
, just $ mkBoolIsProp "headerHidden"
, just $ mkMethod "resizeColumnToContents" [intT] voidT
, test (qtVersion >= [4, 2]) $ mkBoolIsProp "sortingEnabled"
-- TODO add more methods
]
signals :: [Signal]
signals =
[ -- TODO add signals
]
......@@ -16,16 +16,22 @@
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeWidget (
-- modules
aModule,
itemModule,
-- classes
c_QTreeWidget,
c_QTreeWidgetItem,
) where
import Foreign.Hoppy.Generator.Spec (
Class,
Export (ExportClass),
CppEnum,
Export (ExportClass, ExportEnum),
addReqIncludes,
classSetEntityPrefix,
ident,
ident1,
includeStd,
makeClass,
mkConstMethod,
......@@ -33,12 +39,20 @@ import Foreign.Hoppy.Generator.Spec (
mkCtor,
mkMethod,
)
import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT)
import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT, boolT, enumT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Flags (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)
import Graphics.UI.Qtah.Generator.Interface.Core.QStringList (c_QStringList)
import Graphics.UI.Qtah.Generator.Interface.Core.QVariant (c_QVariant)
import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_SortOrder)
import Graphics.UI.Qtah.Generator.Interface.Gui.QIcon (c_QIcon)
import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (
c_Listener,
c_ListenerPtrQTreeWidgetItem,
c_ListenerPtrQTreeWidgetItemInt,
c_ListenerPtrQTreeWidgetItemPtrQTreeWidgetItem,
)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QTreeView (c_QTreeView)
import Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
......@@ -57,8 +71,11 @@ itemModule :: AModule
itemModule =
AQtModule $
makeQtModule ["Widgets", "QTreeWidgetItem"] $
QtExport (ExportClass c_QTreeWidgetItem) :
map QtExportSignal itemSignals
map
QtExport
[ ExportClass c_QTreeWidgetItem
, ExportEnum e_ChildIndicatorPolicy
]
c_QTreeWidget :: Class
c_QTreeWidget =
......@@ -71,8 +88,17 @@ c_QTreeWidget =
, test (qtVersion >= [4, 1]) $
mkMethod "addTopLevelItem" [ptrT $ objT c_QTreeWidgetItem] voidT
, just $ mkConstMethod "currentItem" [] (ptrT $ objT c_QTreeWidgetItem)
, just $ mkConstMethod "headerItem" [] (ptrT $ objT c_QTreeWidgetItem)
, test (qtVersion >= [4, 2]) $ mkConstMethod "invisibleRootItem" [] (ptrT $ objT c_QTreeWidgetItem)
, just $ mkMethod "setCurrentItem" [ptrT $ objT c_QTreeWidgetItem] voidT
-- TODO
, just $ mkMethod "setHeaderItem" [ptrT $ objT c_QTreeWidgetItem] voidT
, test (qtVersion >= [4, 2]) $
mkMethod "setHeaderLabel" [objT