qtah-generator 0.1.2 → 0.2.0
raw patch · 108 files changed
+2260/−1404 lines, 108 filesdep +transformersdep ~hoppy-generatordep ~hoppy-stdsetup-changed
Dependencies added: transformers
Dependency ranges changed: hoppy-generator, hoppy-std
Files
- Setup.hs +18/−26
- qtah-generator.cabal +12/−6
- qtah-listener-gen +16/−16
- src/Graphics/UI/Qtah/Generator/Common.hs +8/−0
- src/Graphics/UI/Qtah/Generator/Flags.hs +83/−33
- src/Graphics/UI/Qtah/Generator/Interface/Callback.hs +0/−136
- src/Graphics/UI/Qtah/Generator/Interface/Core.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Core/QChar.hs +14/−12
- src/Graphics/UI/Qtah/Generator/Interface/Core/QChildEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Core/QCoreApplication.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Core/QDir.hs +13/−14
- src/Graphics/UI/Qtah/Generator/Interface/Core/QEvent.hs +7/−8
- src/Graphics/UI/Qtah/Generator/Interface/Core/QList.hs +28/−15
- src/Graphics/UI/Qtah/Generator/Interface/Core/QMargins.hs +18/−27
- src/Graphics/UI/Qtah/Generator/Interface/Core/QMarginsF.hs +8/−9
- src/Graphics/UI/Qtah/Generator/Interface/Core/QObject.hs +10/−11
- src/Graphics/UI/Qtah/Generator/Interface/Core/QPoint.hs +16/−23
- src/Graphics/UI/Qtah/Generator/Interface/Core/QPointF.hs +17/−24
- src/Graphics/UI/Qtah/Generator/Interface/Core/QRect.hs +29/−38
- src/Graphics/UI/Qtah/Generator/Interface/Core/QRectF.hs +24/−26
- src/Graphics/UI/Qtah/Generator/Interface/Core/QSize.hs +16/−23
- src/Graphics/UI/Qtah/Generator/Interface/Core/QSizeF.hs +11/−12
- src/Graphics/UI/Qtah/Generator/Interface/Core/QString.hs +10/−8
- src/Graphics/UI/Qtah/Generator/Interface/Core/QStringList.hs +19/−14
- src/Graphics/UI/Qtah/Generator/Interface/Core/QTimerEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Core/QVariant.hs +215/−0
- src/Graphics/UI/Qtah/Generator/Interface/Core/QVariant.hs-boot +24/−0
- src/Graphics/UI/Qtah/Generator/Interface/Core/QVector.hs +15/−13
- src/Graphics/UI/Qtah/Generator/Interface/Core/Types.hs +30/−0
- src/Graphics/UI/Qtah/Generator/Interface/EventListener.hs +0/−47
- src/Graphics/UI/Qtah/Generator/Interface/Gui.hs +1/−1
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QActionEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QClipboard.hs +5/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QCloseEvent.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QColor.hs +26/−27
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QDoubleValidator.hs +12/−12
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QEnterEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QExposeEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QFocusEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QHideEvent.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QHoverEvent.hs +9/−8
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QInputEvent.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QIntValidator.hs +5/−6
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QKeyEvent.hs +13/−12
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QMouseEvent.hs +21/−20
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QPolygon.hs +10/−8
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QPolygonF.hs +11/−9
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QRegion.hs +10/−8
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QShowEvent.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QValidator.hs +5/−2
- src/Graphics/UI/Qtah/Generator/Interface/Gui/QWheelEvent.hs +18/−17
- src/Graphics/UI/Qtah/Generator/Interface/Internal.hs +32/−0
- src/Graphics/UI/Qtah/Generator/Interface/Internal/Callback.hs +138/−0
- src/Graphics/UI/Qtah/Generator/Interface/Internal/EventListener.hs +49/−0
- src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs +181/−0
- src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs-boot +22/−0
- src/Graphics/UI/Qtah/Generator/Interface/Listener.hs +0/−0
- src/Graphics/UI/Qtah/Generator/Interface/Widgets.hs +7/−1
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractButton.hs +10/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractScrollArea.hs +7/−8
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractSlider.hs +18/−18
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractSpinBox.hs +17/−18
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAction.hs +20/−21
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QActionGroup.hs +7/−8
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QApplication.hs +20/−17
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QBoxLayout.hs +5/−6
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QButtonGroup.hs +9/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QCheckBox.hs +5/−5
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDial.hs +5/−6
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDialog.hs +6/−8
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDialogButtonBox.hs +7/−8
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDoubleSpinBox.hs +9/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QFileDialog.hs +22/−24
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QFormLayout.hs +9/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QFrame.hs +5/−6
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QGridLayout.hs +9/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QGroupBox.hs +5/−5
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QHBoxLayout.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QInputDialog.hs +152/−0
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLabel.hs +12/−13
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLayout.hs +9/−9
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLayoutItem.hs +8/−8
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLineEdit.hs +19/−19
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMainWindow.hs +15/−17
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMenu.hs +9/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMenuBar.hs +22/−22
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMessageBox.hs +17/−18
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QProgressBar.hs +13/−13
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QPushButton.hs +5/−6
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QRadioButton.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QRubberBand.hs +4/−2
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QScrollArea.hs +8/−9
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QScrollBar.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSizePolicy.hs +122/−0
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSlider.hs +4/−4
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSpacerItem.hs +61/−0
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSpinBox.hs +11/−11
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSplitter.hs +9/−10
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QStackedLayout.hs +14/−14
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QStackedWidget.hs +7/−8
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QStatusBar.hs +6/−7
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QTabWidget.hs +18/−19
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QTextEdit.hs +30/−31
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QVBoxLayout.hs +3/−1
- src/Graphics/UI/Qtah/Generator/Interface/Widgets/QWidget.hs +13/−15
- src/Graphics/UI/Qtah/Generator/Module.hs +163/−131
- src/Graphics/UI/Qtah/Generator/Types.hs +13/−76
- src/Main.hs +9/−26
Setup.hs view
@@ -24,16 +24,13 @@ LocalBuildInfo, absoluteInstallDirs, bindir,- withPrograms,+ pkgDescrFile, )-import Distribution.Simple.Program (- Program,- ProgramSearchPathEntry (ProgramSearchPathDir),- programFindLocation,- runDbProgram,- simpleProgram,+import Distribution.Simple.Program (runProgram)+import Distribution.Simple.Program.Types (+ ProgramLocation (FoundOnSystem),+ simpleConfiguredProgram, )-import Distribution.Simple.Program.Find (findProgramOnSearchPath) import Distribution.Simple.Setup ( CleanFlags, CopyDest (CopyTo, NoCopyDest),@@ -45,14 +42,13 @@ ) import Distribution.Simple.UserHooks ( UserHooks (- hookedPrograms, cleanHook, copyHook, instHook, postConf ), )-import Distribution.Simple.Utils (info, installExecutableFile)+import Distribution.Simple.Utils (die, info, installExecutableFile) import Distribution.Verbosity (normal, verbose) import System.Directory ( createDirectoryIfMissing,@@ -60,15 +56,14 @@ getCurrentDirectory, removeFile, )-import System.FilePath ((</>), joinPath)+import System.FilePath ((</>), joinPath, takeDirectory) main :: IO () main = defaultMainWithHooks qtahHooks qtahHooks :: UserHooks qtahHooks = simpleUserHooks- { hookedPrograms = [listenerGenProgram, qmakeProgram]- , postConf = \_ _ _ lbi -> generateSources lbi+ { postConf = \_ _ _ lbi -> generateSources lbi , copyHook = \pd lbi uh cf -> do let dest = fromFlagOrDefault NoCopyDest $ copyDest cf doInstall pd lbi dest copyHook simpleUserHooks pd lbi uh cf@@ -80,29 +75,26 @@ cleanHook simpleUserHooks pd z uh cf } -listenerGenProgram :: Program-listenerGenProgram =- (simpleProgram "qtah-listener-gen")- { programFindLocation = \verbosity _ ->- findProgramOnSearchPath verbosity [ProgramSearchPathDir "."] "qtah-listener-gen"- }--qmakeProgram :: Program-qmakeProgram = simpleProgram "qmake"+findProjectRootDir :: LocalBuildInfo -> IO FilePath+findProjectRootDir localBuildInfo = case pkgDescrFile localBuildInfo of+ Just path -> return $ takeDirectory path+ Nothing -> die "Couldn't find qtah-listener-gen." generateSources :: LocalBuildInfo -> IO () generateSources localBuildInfo = do -- Generate binding sources for the generated C++ listener classes.- let programDb = withPrograms localBuildInfo- runDbProgram normal listenerGenProgram programDb ["--gen-hs-dir", "."]+ projectRootDir <- findProjectRootDir localBuildInfo+ let program = simpleConfiguredProgram "qtah-listener-gen" $+ FoundOnSystem $ projectRootDir </> "qtah-listener-gen"+ runProgram normal program ["--gen-hs-dir", "."] doInstall :: PackageDescription -> LocalBuildInfo -> CopyDest -> IO () doInstall packageDesc localBuildInfo copyDest = do- startDir <- getCurrentDirectory+ projectRootDir <- findProjectRootDir localBuildInfo let binDir = bindir $ absoluteInstallDirs packageDesc localBuildInfo copyDest createDirectoryIfMissing True binDir installExecutableFile verbose- (startDir </> "qtah-listener-gen")+ (projectRootDir </> "qtah-listener-gen") (binDir </> "qtah-listener-gen") doClean :: CleanFlags -> IO ()
qtah-generator.cabal view
@@ -1,5 +1,5 @@ name: qtah-generator-version: 0.1.2+version: 0.2.0 synopsis: Generator for Qtah Qt bindings homepage: http://khumba.net/projects/qtah license: LGPL-3@@ -41,18 +41,18 @@ , containers >=0.5 && <0.6 , directory >=1.2 && <1.3 , filepath >=1.3 && <1.5- , hoppy-generator >=0.2 && <0.3- , hoppy-std >=0.2 && <0.3+ , hoppy-generator >=0.3 && <0.4+ , hoppy-std >=0.3 && <0.4 , haskell-src >=1.0 && <1.1 , mtl >=2.1 && <2.3 , process >=1.2 && <1.5+ , transformers >=0.3 && <0.6 hs-source-dirs: src main-is: Main.hs other-modules: Graphics.UI.Qtah.Generator.Common , Graphics.UI.Qtah.Generator.Flag , Graphics.UI.Qtah.Generator.Flags- , Graphics.UI.Qtah.Generator.Interface.Callback , Graphics.UI.Qtah.Generator.Interface.Core , Graphics.UI.Qtah.Generator.Interface.Core.QChar , Graphics.UI.Qtah.Generator.Interface.Core.QChildEvent@@ -72,9 +72,9 @@ , Graphics.UI.Qtah.Generator.Interface.Core.QString , Graphics.UI.Qtah.Generator.Interface.Core.QStringList , Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent+ , Graphics.UI.Qtah.Generator.Interface.Core.QVariant , Graphics.UI.Qtah.Generator.Interface.Core.QVector , Graphics.UI.Qtah.Generator.Interface.Core.Types- , Graphics.UI.Qtah.Generator.Interface.EventListener , Graphics.UI.Qtah.Generator.Interface.Gui , Graphics.UI.Qtah.Generator.Interface.Gui.QActionEvent , Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard@@ -97,7 +97,10 @@ , Graphics.UI.Qtah.Generator.Interface.Gui.QValidator , Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent , Graphics.UI.Qtah.Generator.Interface.Imports- , Graphics.UI.Qtah.Generator.Interface.Listener+ , Graphics.UI.Qtah.Generator.Interface.Internal+ , Graphics.UI.Qtah.Generator.Interface.Internal.Callback+ , Graphics.UI.Qtah.Generator.Interface.Internal.EventListener+ , Graphics.UI.Qtah.Generator.Interface.Internal.Listener , Graphics.UI.Qtah.Generator.Interface.Widgets , Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton , Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea@@ -119,6 +122,7 @@ , Graphics.UI.Qtah.Generator.Interface.Widgets.QGridLayout , Graphics.UI.Qtah.Generator.Interface.Widgets.QGroupBox , Graphics.UI.Qtah.Generator.Interface.Widgets.QHBoxLayout+ , Graphics.UI.Qtah.Generator.Interface.Widgets.QInputDialog , Graphics.UI.Qtah.Generator.Interface.Widgets.QLabel , Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout , Graphics.UI.Qtah.Generator.Interface.Widgets.QLayoutItem@@ -133,7 +137,9 @@ , Graphics.UI.Qtah.Generator.Interface.Widgets.QRubberBand , Graphics.UI.Qtah.Generator.Interface.Widgets.QScrollArea , Graphics.UI.Qtah.Generator.Interface.Widgets.QScrollBar+ , Graphics.UI.Qtah.Generator.Interface.Widgets.QSizePolicy , Graphics.UI.Qtah.Generator.Interface.Widgets.QSlider+ , Graphics.UI.Qtah.Generator.Interface.Widgets.QSpacerItem , Graphics.UI.Qtah.Generator.Interface.Widgets.QSpinBox , Graphics.UI.Qtah.Generator.Interface.Widgets.QSplitter , Graphics.UI.Qtah.Generator.Interface.Widgets.QStackedLayout
qtah-listener-gen view
@@ -190,19 +190,19 @@ if [[ -n $hsDir ]]; then msg "Generating Haskell listener binding definitions."- exec {fhs}>"$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Listener.hs.new"+ exec {fhs}>"$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs.new" say() { echo "$*" >&$fhs; } say '---------- GENERATED FILE, EDITS WILL BE LOST ----------' say- say 'module Graphics.UI.Qtah.Generator.Interface.Listener where'+ say 'module Graphics.UI.Qtah.Generator.Interface.Internal.Listener where' say say 'import qualified Foreign.Hoppy.Generator.Spec as S' say 'import qualified Foreign.Hoppy.Generator.Types as S' say 'import qualified Foreign.Hoppy.Generator.Std.String as String'- say 'import qualified Graphics.UI.Qtah.Generator.Types as T'- say 'import qualified Graphics.UI.Qtah.Generator.Interface.Callback as C'+ say 'import qualified Graphics.UI.Qtah.Generator.Module as M' say 'import qualified Graphics.UI.Qtah.Generator.Interface.Core.QObject as QObject'+ say 'import qualified Graphics.UI.Qtah.Generator.Interface.Internal.Callback as C' say say '{-# ANN module "HLint: ignore Use camelCase" #-}' @@ -218,45 +218,45 @@ say " [ S.mkCtor \"new\" [S.callbackT C.${callbackVar}]" say " , S.mkCtor \"newWithParent\"" say " [S.callbackT C.${callbackVar}, S.ptrT \$ S.objT QObject.c_QObject]"- say " ]"- say " [ S.mkMethod \"connectListener\""+ say " , S.mkMethod \"connectListener\"" say " [S.ptrT \$ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT" say " ]" } forEachListener writeHs say- say "aModule :: T.AModule"+ say "aModule :: M.AModule" say "aModule ="- say " T.AHoppyModule \$"+ say " M.AHoppyModule \$" say " S.addReqIncludes [S.includeLocal \"listener.hpp\"] \$"- say " S.moduleModify' (S.makeModule \"listener\" \"b_listener.hpp\" \"b_listener.cpp\") \$"- say " S.moduleAddExports"+ say " S.moduleModify' (S.makeModule \"listener\" \"b_listener.hpp\" \"b_listener.cpp\") \$ do"+ say " S.moduleAddHaskellName [\"Internal\", \"Listener\"]"+ say " S.moduleAddExports" cont="[" writeHs() { local -r name="${1?}" local -r className="Listener${name}" local -r classVar="c_${className}" - say " ${cont} S.ExportClass ${classVar}"+ say " ${cont} S.ExportClass ${classVar}" if [[ $cont = '[' ]]; then cont=','; fi } forEachListener writeHs- say " ]"+ say " ]" exec {fhs}>&- unset fhs writeHs- installGen "$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Listener.hs"{.new,}+ installGen "$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs"{.new,} # Also generate a GHC .hs-boot file for cycles in the module graph around listeners. msg "Generating Haskell listener .hs-boot file."- exec {fhs}>"$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Listener.hs-boot.new"+ exec {fhs}>"$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs-boot.new" say() { echo "$*" >&$fhs; } say '---------- GENERATED FILE, EDITS WILL BE LOST ----------' say- say 'module Graphics.UI.Qtah.Generator.Interface.Listener where'+ say 'module Graphics.UI.Qtah.Generator.Interface.Internal.Listener where' say say 'import Foreign.Hoppy.Generator.Spec (Class)' say@@ -272,5 +272,5 @@ exec {fhs}>&- unset fhs writeHs- installGen "$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Listener.hs-boot"{.new,}+ installGen "$hsDir/src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs-boot"{.new,} fi
src/Graphics/UI/Qtah/Generator/Common.hs view
@@ -22,6 +22,7 @@ splitOn, fromMaybeM, maybeFail,+ firstM, writeFileIfDifferent, ) where @@ -30,6 +31,8 @@ #endif import Control.Exception (evaluate) import Control.Monad (when)+import Control.Monad.Trans.Maybe (MaybeT (MaybeT), runMaybeT)+import Data.Foldable (asum) import Data.List (findIndex) import System.Directory (doesFileExist) import System.IO (IOMode (ReadMode), hGetContents, withFile)@@ -54,6 +57,11 @@ -- | @maybeFail s x = maybe (fail s) x@ maybeFail :: Monad m => String -> Maybe a -> m a maybeFail = fromMaybeM . fail++-- | Runs a list of monadic actions until one returns a 'Just' value, then+-- returning that value. Returns 'Nothing' if all actions return 'Nothing'.+firstM :: (Functor m, Monad m) => [m (Maybe a)] -> m (Maybe a)+firstM = runMaybeT . asum . map MaybeT -- | If the file specified does not exist or its contents does not match the -- given string, then this writes the string to the file.
src/Graphics/UI/Qtah/Generator/Flags.hs view
@@ -27,6 +27,8 @@ module Graphics.UI.Qtah.Generator.Flags ( Version, qtVersion,+ qmakeExecutable,+ qmakeArguments, keypadNavigation, qdoc, qrealFloat,@@ -35,8 +37,8 @@ import Control.Monad (unless) import Data.Char (isDigit, isSpace)-import Data.List (isPrefixOf)-import Graphics.UI.Qtah.Generator.Common (fromMaybeM, splitOn)+import Data.List (intercalate, isPrefixOf)+import Graphics.UI.Qtah.Generator.Common (firstM, fromMaybeM, splitOn) import System.Directory (findExecutable) import System.Environment (lookupEnv) import System.Exit (ExitCode (ExitSuccess))@@ -49,11 +51,22 @@ -- future, if necessary. type Version = [Int] +showVersion :: Version -> String+showVersion = intercalate "." . map show++-- | An internal record of Qt configuration info.+data QtConfig = QtConfig+ { configVersion :: Version+ , configQmakeExecutable :: FilePath+ , configQmakeArguments :: [String]+ }+ -- | This is initialized at program startup with the version of Qt that the--- generator will work with. This controls which functions and types are made--- available in the API.+-- generator will work with, along with the corresponding QMake binary and+-- arguments necessary to invoke it. The Qt version which functions and types+-- are made available in the API. ----- This is determined the following method:+-- The Qt version determined the following method: -- -- * If @QTAH_QT=x.y@ is in the environment, then this value will be used. --@@ -64,10 +77,19 @@ -- @QT_SELECT@ in the environment can select a major version of Qt to use. -- -- For more information on @qmake -qt@ and @QT_SELECT@, see @man qtchooser@.+qtConfig :: QtConfig+{-# NOINLINE qtConfig #-}+qtConfig = unsafePerformIO readQt+ qtVersion :: Version-{-# NOINLINE qtVersion #-}-qtVersion = unsafePerformIO readQtVersion+qtVersion = configVersion qtConfig +qmakeExecutable :: FilePath+qmakeExecutable = configQmakeExecutable qtConfig++qmakeArguments :: [String]+qmakeArguments = configQmakeArguments qtConfig+ keypadNavigation :: Bool keypadNavigation = False @@ -82,10 +104,10 @@ wsWince :: Bool wsWince = False --- | Reads a Qt version from the environment variable @QTAH_QT@. See--- 'qtVersion'.-readQtVersion :: IO Version-readQtVersion = do+-- | Reads a Qt version from the environment variable @QTAH_QT@, and looks up a+-- qmake binary.+readQt :: IO QtConfig+readQt = do maybeStr <- fmap (\x -> case x of Just "" -> Nothing _ -> x) $@@ -98,32 +120,54 @@ ["qtah-generator requires QTAH_QT=x or QTAH_QT=x.y, can't parse value ", show str, "."] let version = map (read :: String -> Int) strs case version of- [_, _] -> return version- [x] -> queryQmakeQtVersion $ Just x+ [x] -> queryQmake $ Just x+ [x, y] -> do+ config <- queryQmake $ Just x+ case configVersion config of+ foundVersion@(x':y':_) | x /= x' || y /= y' ->+ fail $ "qtah-generator: Mismatch between requested and installed " +++ "Qt versions. Requested " ++ showVersion version ++ ", found " +++ showVersion foundVersion ++ "."+ _ -> return ()+ return config _ -> fail $ concat ["qtah-generator: Internal error, incorrect parsing of QTAH_QT value ", show str, "."]- Nothing -> queryQmakeQtVersion Nothing+ Nothing -> queryQmake Nothing - where queryQmakeQtVersion :: Maybe Int -> IO Version- queryQmakeQtVersion maybePreferredMajorVersion = do+ where -- | When we don't have a preferred qmake version, then we'll search for+ -- qmake's executables, first unqualified, then qualified by version+ -- number in decreasing order.+ allQmakeExecutableNames :: [String]+ allQmakeExecutableNames = ["qmake", "qmake-qt5", "qmake-qt4"]++ -- | When we /do/ have a prefered qmake version, then try the qualified+ -- version name first, falling back to the generic qmake executable if+ -- possible.+ qmakeExecutableNamesForVersion :: Int -> [String]+ qmakeExecutableNamesForVersion major = ["qmake-qt" ++ show major, "qmake"]++ queryQmake :: Maybe Int -> IO QtConfig+ queryQmake maybePreferredMajorVersion = do case maybePreferredMajorVersion of Nothing -> -- No major version preference, so take whatever Qt is available.- queryQmakeQtVersion' []+ queryQmake' allQmakeExecutableNames [] Just preferredMajorVersion -> do -- Even though we have a preferred major version, we don't want to -- run "qmake -qt=X -version" initially because we might be on a -- system (NixOS) where qtchooser isn't available and the only- -- qmake available *is* the desired version. Only pass "-qt=X" if- -- we get the wrong default version.- defaultVersion <- queryQmakeQtVersion' []- case defaultVersion of- (x:_) | x == preferredMajorVersion -> return defaultVersion- _ -> queryQmakeQtVersion' ["-qt=" ++ show preferredMajorVersion]+ -- qmake available *is* the desired version (in NixOS's case, the+ -- binary is called "qmake", not "qmake-qtX"). Only pass "-qt=X"+ -- if we get the wrong default version.+ let executableNames = qmakeExecutableNamesForVersion preferredMajorVersion+ defaultConfig <- queryQmake' executableNames []+ case configVersion defaultConfig of+ (x:_) | x == preferredMajorVersion -> return defaultConfig+ _ -> queryQmake' executableNames ["-qt=" ++ show preferredMajorVersion] - queryQmakeQtVersion' :: [String] -> IO Version- queryQmakeQtVersion' extraArgs = do- qmakePath <- findQMake+ queryQmake' :: [String] -> [String] -> IO QtConfig+ queryQmake' executableNames extraArgs = do+ qmakePath <- findQMake executableNames let args = extraArgs ++ ["-version"] (exitCode, out, err) <- readProcessWithExitCode qmakePath args "" let qmakeDebugWords =@@ -144,7 +188,12 @@ else Nothing case maybeVersionStrs of- Just strs -> return $ map (read :: String -> Int) strs+ Just strs ->+ return QtConfig+ { configVersion = map (read :: String -> Int) strs+ , configQmakeExecutable = qmakePath+ , configQmakeArguments = extraArgs+ } Nothing -> fail $ concat $ "qtah-generator: Can't parse Qt version from qmake output." : qmakeDebugWords@@ -169,10 +218,11 @@ ["qtah-generator: Expected a boolean value for ", name, " (true/false). Got ", show s, "."] -findQMake :: IO FilePath-findQMake = lookupEnv "QTAH_QMAKE" >>= fromMaybeM findQmake- where findQmake =- findExecutable "qmake" >>=+findQMake :: [String] -> IO FilePath+findQMake executableNames = lookupEnv "QTAH_QMAKE" >>= fromMaybeM findBinary+ where findBinary =+ firstM (map findExecutable executableNames) >>= fromMaybeM- (fail $ "qtah-generator: Can't find qmake. Please ensure qmake " ++- "is installed and set QTAH_QMAKE to qmake's path.")+ (fail $ "qtah-generator: Can't find qmake named any of " +++ show executableNames ++ ". Please ensure qmake is installed " +++ "and set QTAH_QMAKE to qmake's path.")
− src/Graphics/UI/Qtah/Generator/Interface/Callback.hs
@@ -1,136 +0,0 @@--- This file is part of Qtah.------ Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>------ 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.Callback where--import Foreign.Hoppy.Generator.Spec (- Export (ExportCallback),- makeCallback,- makeModule,- moduleAddExports,- moduleModify',- toExtName,- )-import Foreign.Hoppy.Generator.Types (boolT, doubleT, enumT, intT, objT, ptrT, voidT)-import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)-import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)-import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint)-import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize)-import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import {-# SOURCE #-} qualified Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard as QClipboard-import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (- c_QAbstractButton,- )-import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider (- e_SliderAction,- )-import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction)-import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)-import Graphics.UI.Qtah.Generator.Types--{-# ANN module "HLint: ignore Use camelCase" #-}--aModule =- AHoppyModule $- moduleModify' (makeModule "callback" "b_callback.hpp" "b_callback.cpp") $- moduleAddExports- [ ExportCallback cb_BoolVoid- , ExportCallback cb_DoubleVoid- , ExportCallback cb_IntVoid- , ExportCallback cb_IntBoolVoid- , ExportCallback cb_IntIntVoid- , ExportCallback cb_PtrQAbstractButtonVoid- , ExportCallback cb_PtrQAbstractButtonBoolVoid- , ExportCallback cb_PtrQActionVoid- , ExportCallback cb_PtrQObjectPtrQEventBool- , ExportCallback cb_PtrQObjectVoid- , ExportCallback cb_PtrQWidgetPtrQWidgetVoid- , ExportCallback cb_QAbstractSliderActionVoid- , ExportCallback cb_QClipboardModeVoid- , ExportCallback cb_QPointVoid- , ExportCallback cb_QSizeVoid- , ExportCallback cb_QStringVoid- , ExportCallback cb_Void- ]--cb_BoolVoid =- makeCallback (toExtName "CallbackBoolVoid")- [boolT] voidT--cb_DoubleVoid =- makeCallback (toExtName "CallbackDoubleVoid")- [doubleT] voidT--cb_IntVoid =- makeCallback (toExtName "CallbackIntVoid")- [intT] voidT--cb_IntBoolVoid =- makeCallback (toExtName "CallbackIntBoolVoid")- [intT, boolT] voidT--cb_IntIntVoid =- makeCallback (toExtName "CallbackIntIntVoid")- [intT, intT] voidT--cb_PtrQAbstractButtonVoid =- makeCallback (toExtName "CallbackPtrQAbstractButtonVoid")- [ptrT $ objT c_QAbstractButton] voidT--cb_PtrQAbstractButtonBoolVoid =- makeCallback (toExtName "CallbackPtrQAbstractButtonBoolVoid")- [ptrT $ objT c_QAbstractButton, boolT] voidT--cb_PtrQActionVoid =- makeCallback (toExtName "CallbackPtrQActionVoid")- [ptrT $ objT c_QAction] voidT--cb_PtrQObjectPtrQEventBool =- makeCallback (toExtName "CallbackPtrQObjectPtrQEventBool")- [ptrT $ objT c_QObject, ptrT $ objT c_QEvent] boolT--cb_PtrQObjectVoid =- makeCallback (toExtName "CallbackPtrQObjectVoid")- [ptrT $ objT c_QObject] voidT--cb_PtrQWidgetPtrQWidgetVoid =- makeCallback (toExtName "CallbackPtrQWidgetPtrQWidgetVoid")- [ptrT $ objT c_QWidget, ptrT $ objT c_QWidget] voidT--cb_QAbstractSliderActionVoid =- makeCallback (toExtName "CallbackQAbstractSliderActionVoid")- [enumT e_SliderAction] voidT--cb_QClipboardModeVoid =- makeCallback (toExtName "CallbackQClipboardModeVoid")- [enumT QClipboard.e_Mode] voidT--cb_QPointVoid =- makeCallback (toExtName "CallbackQPointVoid")- [objT c_QPoint] voidT--cb_QSizeVoid =- makeCallback (toExtName "CallbackQSizeVoid")- [objT c_QSize] voidT--cb_QStringVoid =- makeCallback (toExtName "CallbackQStringVoid")- [objT c_QString] voidT--cb_Void =- makeCallback (toExtName "CallbackVoid")- [] voidT
src/Graphics/UI/Qtah/Generator/Interface/Core.hs view
@@ -35,9 +35,10 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Core.QString as QString import qualified Graphics.UI.Qtah.Generator.Interface.Core.QStringList as QStringList import qualified Graphics.UI.Qtah.Generator.Interface.Core.QTimerEvent as QTimerEvent+import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVariant as QVariant import qualified Graphics.UI.Qtah.Generator.Interface.Core.QVector as QVector import qualified Graphics.UI.Qtah.Generator.Interface.Core.Types as Types-import Graphics.UI.Qtah.Generator.Types+import Graphics.UI.Qtah.Generator.Module (AModule) {-# ANN module "HLint: ignore Use camelCase" #-} @@ -61,6 +62,7 @@ , QString.aModule , QStringList.aModule , QTimerEvent.aModule+ , QVariant.aModule , Types.aModule ] , QList.allModules
src/Graphics/UI/Qtah/Generator/Interface/Core/QChar.hs view
@@ -38,6 +38,7 @@ ), Export (ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImport1, ident,@@ -60,6 +61,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -89,25 +91,25 @@ classAddFeatures [Assignable, Copyable, Comparable, Equatable] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports importForPrelude return $ HsTyCon $ UnQual $ HsIdent "QtahP.Char"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [hsImport1 "Prelude" "(.)", importForChar, importForRuntime]- sayLn "qChar_newFromInt . QtahFHR.coerceIntegral . QtahDC.ord"- , classHaskellConversionFromCppFn = do+ sayLn "newFromInt . QtahFHR.coerceIntegral . QtahDC.ord"+ , classHaskellConversionFromCppFn = Just $ do addImports $ mconcat [hsImport1 "Prelude" "(.)", importForChar, importForPrelude, importForRuntime]- sayLn "QtahP.fmap (QtahDC.chr . QtahFHR.coerceIntegral) . qChar_unicode"+ sayLn "QtahP.fmap (QtahDC.chr . QtahFHR.coerceIntegral) . unicode" } $- makeClass (ident "QChar") Nothing []- [ mkCtor "new" []- , mkCtor "newFromCellRow" [ucharT, ucharT]- , mkCtor "newFromInt" [intT]- , mkCtor "newFromSpecialCharacter" [enumT e_SpecialCharacter]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QChar") Nothing [] $ collect- [ test (qtVersion < [5]) $ mkStaticMethod' "fromAscii" "newFromAscii" [charT] $ objT c_QChar+ [ just $ mkCtor "new" []+ , just $ mkCtor "newFromCellRow" [ucharT, ucharT]+ , just $ mkCtor "newFromInt" [intT]+ , just $ mkCtor "newFromSpecialCharacter" [enumT e_SpecialCharacter]+ , test (qtVersion < [5]) $ mkStaticMethod' "fromAscii" "newFromAscii" [charT] $ objT c_QChar , just $ mkStaticMethod' "fromLatin1" "newFromLatin1" [charT] $ objT c_QChar , just $ mkConstMethod "category" [] $ enumT e_Category , just $ mkConstMethod "cell" [] ucharT
src/Graphics/UI/Qtah/Generator/Interface/Core/QChildEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,6 +31,7 @@ import Foreign.Hoppy.Generator.Types (boolT, enumT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent, e_Type) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -42,10 +44,10 @@ c_QChildEvent = addReqIncludes [includeStd "QChildEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QChildEvent") Nothing [c_QEvent] [ mkCtor "new" [enumT e_Type, ptrT $ objT c_QObject]- ]- [ mkConstMethod "added" [] boolT+ , mkConstMethod "added" [] boolT , mkConstMethod "child" [] $ ptrT $ objT c_QObject , mkConstMethod "polished" [] boolT , mkConstMethod "removed" [] boolT
src/Graphics/UI/Qtah/Generator/Interface/Core/QCoreApplication.hs view
@@ -25,6 +25,7 @@ MethodApplicability (MStatic), Purity (Nonpure), addReqIncludes,+ classSetEntityPrefix, ident, ident2, includeLocal,@@ -40,6 +41,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Core.QStringList (c_QStringList)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -53,8 +55,8 @@ addReqIncludes [ includeStd "QCoreApplication" , includeLocal "wrap_qcoreapplication.hpp" ] $- makeClass (ident "QCoreApplication") Nothing [c_QObject]- [] $+ classSetEntityPrefix "" $+ makeClass (ident "QCoreApplication") Nothing [c_QObject] $ collect [ just $ makeFnMethod (ident2 "qtah" "qcoreapplication" "create") "new" MStatic Nonpure [objT c_QStringList] $ ptrT $ objT c_QCoreApplication
src/Graphics/UI/Qtah/Generator/Interface/Core/QDir.hs view
@@ -30,6 +30,7 @@ Operator (OpArray), addReqIncludes, classSetConversionToGc,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -39,7 +40,6 @@ mkCtor, mkMethod, mkProp,- mkProps, mkStaticMethod, ) import Foreign.Hoppy.Generator.Spec.ClassFeature (@@ -51,6 +51,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QChar (c_QChar) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -67,13 +68,13 @@ c_QDir = addReqIncludes [includeStd "QDir"] $- classAddFeatures [Assignable, Copyable, Equatable] $ classSetConversionToGc $- makeClass (ident "QDir") Nothing []- [ mkCtor "new" [objT c_QString]- ] $+ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QDir") Nothing [] $ collect- [ just $ mkConstMethod "absoluteFilePath" [objT c_QString] $ objT c_QString+ [ just $ mkCtor "new" [objT c_QString]+ , just $ mkConstMethod "absoluteFilePath" [objT c_QString] $ objT c_QString , just $ mkConstMethod "absolutePath" [] $ objT c_QString , test (qtVersion >= [4, 3]) $ mkStaticMethod "addSearchPath" [objT c_QString, objT c_QString] voidT@@ -91,6 +92,7 @@ , just $ mkConstMethod' "exists" "exists" [] boolT , just $ mkConstMethod' "exists" "entryExists" [objT c_QString] boolT , just $ mkConstMethod "filePath" [objT c_QString] $ objT c_QString+ , just $ mkProp "filter" $ bitspaceT bs_Filters , test (qtVersion >= [4, 2]) $ mkStaticMethod "fromNativeSeparators" [objT c_QString] $ objT c_QString , just $ mkStaticMethod "home" [] $ objT c_QDir@@ -106,6 +108,8 @@ -- TODO match(QStringList, QString) , just $ mkConstMethod "mkdir" [objT c_QString] boolT , just $ mkConstMethod "mkpath" [objT c_QString] boolT+ -- TODO nameFilters+ , just $ mkProp "path" $ objT c_QString , just $ mkMethod "refresh" [] voidT , just $ mkConstMethod "relativeFilePath" [objT c_QString] $ objT c_QString , just $ mkMethod "remove" [objT c_QString] boolT@@ -115,21 +119,16 @@ , just $ mkConstMethod "rmpath" [objT c_QString] boolT , just $ mkStaticMethod "root" [] $ objT c_QDir , just $ mkStaticMethod "rootPath" [] $ objT c_QString+ -- TODO searchPaths (>=4.3) , just $ mkStaticMethod "separator" [] $ objT c_QChar , just $ mkStaticMethod "setCurrent" [objT c_QString] boolT+ , just $ mkProp "sorting" $ bitspaceT bs_SortFlags , test (qtVersion >= [5, 0]) $ mkMethod "swap" [refT $ objT c_QDir] voidT , just $ mkStaticMethod "temp" [] $ objT c_QDir , just $ mkStaticMethod "tempPath" [] $ objT c_QString , test (qtVersion >= [4, 2]) $ mkStaticMethod "toNativeSeparators" [objT c_QString] $ objT c_QString , just $ mkConstMethod OpArray [intT] $ objT c_QString- ] ++- mkProps- [ mkProp "filter" $ bitspaceT bs_Filters- -- TODO nameFilters- , mkProp "path" $ objT c_QString- -- TODO searchPaths (>=4.3)- , mkProp "sorting" $ bitspaceT bs_SortFlags ] (e_Filter, bs_Filters) =@@ -173,7 +172,7 @@ [ (0x00, ["name"]) , (0x01, ["time"]) , (0x02, ["size"])- , (0x80, ["type"])+ , (0x80, ["typ"]) -- "type" is a Haskell keyword. , (0x03, ["unsorted"]) -- QDir::NoSort = -1. Not sure this is needed (it's used for parameter -- defaults). Would need to check if negative values work as expected.
src/Graphics/UI/Qtah/Generator/Interface/Core/QEvent.hs view
@@ -24,6 +24,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -33,12 +34,12 @@ mkConstMethod', mkCtor, mkMethod,- mkProps, mkStaticMethod', ) import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, voidT) import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -52,11 +53,12 @@ c_QEvent = addReqIncludes [includeStd "QEvent"] $- makeClass (ident "QEvent") Nothing []- [ mkCtor "new" [enumT e_Type]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QEvent") Nothing [] $ collect- [ just $ mkMethod "accept" [] voidT+ [ just $ mkCtor "new" [enumT e_Type]+ , just $ mkMethod "accept" [] voidT+ , just $ mkBoolIsProp "accepted" , just $ mkMethod "ignore" [] voidT , test (qtVersion >= [4, 4]) $ mkStaticMethod' "registerEventType" "registerEventType" [] intT@@ -64,9 +66,6 @@ mkStaticMethod' "registerEventType" "registerEventTypeWithHint" [intT] intT , just $ mkConstMethod "spontaneous" [] boolT , just $ mkConstMethod' "type" "eventType" [] $ enumT e_Type -- 'type' is a Haskell keyword.- ] ++- mkProps- [ mkBoolIsProp "accepted" ] e_Type =
src/Graphics/UI/Qtah/Generator/Interface/Core/QList.hs view
@@ -32,6 +32,7 @@ c_QListQAbstractButton, c_QListQObject, c_QListQString,+ c_QListQVariant, c_QListQWidget, ) where @@ -48,8 +49,8 @@ prettyPrint, sayLn, saysLn,+ toHsClassEntityName', toHsDataTypeName,- toHsMethodName', ) import Foreign.Hoppy.Generator.Spec ( Class,@@ -66,6 +67,7 @@ Type, addReqs, addAddendumHaskell,+ classSetEntityPrefix, classSetHaskellConversion, classSetMonomorphicSuperclass, hsImport1,@@ -89,9 +91,11 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QVariant (c_QVariant) import Graphics.UI.Qtah.Generator.Interface.Imports import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), QtModule, makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsQName (Special),@@ -137,11 +141,10 @@ classSetHaskellConversion conversion $ classAddFeatures features $ classSetMonomorphicSuperclass $- makeClass (identT "QList" [t]) (Just $ toExtName listName) []- [ mkCtor "new" []- ] $- collect- [ just $ mkMethod' "append" "append" [t] voidT+ classSetEntityPrefix "" $+ makeClass (identT "QList" [t]) (Just $ toExtName listName) [] $ collect+ [ just $ mkCtor "new" []+ , just $ mkMethod' "append" "append" [t] voidT , test (qtVersion >= [4, 5]) $ mkMethod' "append" "appendList" [objT list] voidT , just $ mkMethod' OpArray "at" [intT] $ refT t , just $ mkConstMethod' "at" "atConst" [intT] $ refT $ constT t@@ -202,7 +205,7 @@ addImports $ hsImport1 "Prelude" "($)" forM_ [Const, Nonconst] $ \cst -> do- let hsDataTypeName = toHsDataTypeName cst list+ hsDataTypeName <- toHsDataTypeName cst list hsValueType <- cppTypeToHsTypeAndUse HsHsSide $ case cst of Const -> constT t Nonconst -> t@@ -217,9 +220,9 @@ let listAt = case cst of Const -> "atConst" Nonconst -> "at"- saysLn ["size' <- ", toHsMethodName' list "size", " this'"]+ saysLn ["size' <- ", toHsClassEntityName' list "size", " this'"] saysLn ["QtahP.mapM (QtahFHR.decode <=< ",- toHsMethodName' list listAt, " this') [0..size'-1]"]+ toHsClassEntityName' list listAt, " this') [0..size'-1]"] -- Only generate a nonconst FromContents instance. when (cst == Nonconst) $ do@@ -229,24 +232,24 @@ indent $ do sayLn "fromContents values' = do" indent $ do- saysLn ["list' <- ", toHsMethodName' list "new"]+ saysLn ["list' <- ", toHsClassEntityName' list "new"] when hasReserve $- saysLn [toHsMethodName' list "reserve",+ saysLn [toHsClassEntityName' list "reserve", " list' $ QtahFHR.coerceIntegral $ QtahP.length values'"]- saysLn ["QtahP.mapM_ (", toHsMethodName' list "append", " list') values'"]+ saysLn ["QtahP.mapM_ (", toHsClassEntityName' list "append", " list') values'"] sayLn "QtahP.return list'" -- A QList of some type converts into a Haskell list of the corresponding -- type using HasContents/FromContents. conversion = ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do hsType <- cppTypeToHsTypeAndUse HsHsSide t return $ HsTyApp (HsTyCon $ Special $ HsListCon) hsType- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports importForRuntime sayLn "QtahFHR.fromContents"- , classHaskellConversionFromCppFn = do+ , classHaskellConversionFromCppFn = Just $ do addImports importForRuntime sayLn "QtahFHR.toContents" }@@ -270,6 +273,7 @@ , qmod_QAbstractButton , qmod_QObject , qmod_QString+ , qmod_QVariant , qmod_QWidget ] @@ -309,6 +313,15 @@ c_QListQString :: Class c_QListQString = c_QList contents_QString++qmod_QVariant :: QtModule+qmod_QVariant = createModule "QVariant" contents_QVariant++contents_QVariant :: Contents+contents_QVariant = instantiate "QListQVariant" (objT c_QVariant) mempty++c_QListQVariant :: Class+c_QListQVariant = c_QList contents_QVariant qmod_QWidget :: QtModule qmod_QWidget = createModule "QWidget" contents_QWidget
src/Graphics/UI/Qtah/Generator/Interface/Core/QMargins.hs view
@@ -27,7 +27,6 @@ #endif import Foreign.Hoppy.Generator.Language.Haskell ( addImports,- indent, sayLn, saysLn, )@@ -41,6 +40,7 @@ Export (ExportClass), Operator (OpAddAssign, OpDivideAssign, OpMultiplyAssign, OpSubtractAssign), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImports, hsQualifiedImport,@@ -51,7 +51,6 @@ mkCtor, mkMethod', mkProp,- mkProps, operatorPreferredExtName', ) import Foreign.Hoppy.Generator.Spec.ClassFeature (@@ -62,7 +61,7 @@ import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal)-import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -81,32 +80,30 @@ addReqIncludes [includeStd "QMargins"] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports $ hsQualifiedImport "Graphics.UI.Qtah.Core.HMargins" "HMargins" return $ HsTyCon $ UnQual $ HsIdent "HMargins.HMargins"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"], hsQualifiedImport "Graphics.UI.Qtah.Core.HMargins" "HMargins"]- saysLn ["qMargins_new <$> HMargins.left <*> HMargins.top <*> HMargins.right <*> ",+ saysLn ["new <$> HMargins.left <*> HMargins.top <*> HMargins.right <*> ", "HMargins.bottom"]- , classHaskellConversionFromCppFn = do- addImports $ mconcat [hsQualifiedImport "Graphics.UI.Qtah.Core.HMargins" "HMargins",- importForPrelude]- sayLn "\\q -> do"- indent $ do- sayLn "l <- qMargins_left q"- sayLn "t <- qMargins_top q"- sayLn "r <- qMargins_right q"- sayLn "b <- qMargins_bottom q"- sayLn "QtahP.return (HMargins.HMargins l t r b)"+ , classHaskellConversionFromCppFn = Just $ do+ addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"],+ hsQualifiedImport "Graphics.UI.Qtah.Core.HMargins" "HMargins"]+ sayLn "\\q -> HMargins.HMargins <$> left q <*> top q <*> right q <*> bottom q" } $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QMargins") Nothing []- [ mkCtor "newNull" []- , mkCtor "new" [intT, intT, intT, intT]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QMargins") Nothing [] $ collect- [ just $ mkConstMethod "isNull" [] boolT+ [ just $ mkCtor "newNull" []+ , just $ mkCtor "new" [intT, intT, intT, intT]+ , just $ mkProp "bottom" intT+ , just $ mkConstMethod "isNull" [] boolT+ , just $ mkProp "left" intT+ , just $ mkProp "right" intT+ , just $ mkProp "top" intT , test (qtVersion >= [5, 1]) $ mkMethod' OpAddAssign (operatorPreferredExtName' OpAddAssign) [objT c_QMargins] $ refT $ objT c_QMargins@@ -131,10 +128,4 @@ , test (qtVersion >= [5, 1]) $ mkMethod' OpDivideAssign (operatorPreferredExtName' OpDivideAssign ++ "Real") [qreal] $ refT $ objT c_QMargins- ] ++- mkProps- [ mkProp "bottom" intT- , mkProp "left" intT- , mkProp "right" intT- , mkProp "top" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QMarginsF.hs view
@@ -24,6 +24,7 @@ Export (ExportClass), Operator (OpAddAssign, OpDivideAssign, OpMultiplyAssign, OpSubtractAssign), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,7 +32,6 @@ mkCtor, mkMethod', mkProp,- mkProps, operatorPreferredExtName', ) import Foreign.Hoppy.Generator.Spec.ClassFeature (@@ -41,6 +41,7 @@ import Foreign.Hoppy.Generator.Types (boolT, objT, refT) import Graphics.UI.Qtah.Generator.Interface.Core.QMargins (c_QMargins) import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -55,12 +56,16 @@ c_QMarginsF = addReqIncludes [includeStd "QMarginsF"] $ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $ makeClass (ident "QMarginsF") Nothing [] [ mkCtor "newNull" [] , mkCtor "new" [qreal, qreal, qreal, qreal] , mkCtor "newWithMargins" [objT c_QMargins]- ] $- [ mkConstMethod "isNull" [] boolT+ , mkProp "bottom" qreal+ , mkConstMethod "isNull" [] boolT+ , mkProp "left" qreal+ , mkProp "right" qreal+ , mkProp "top" qreal , mkMethod' OpAddAssign (operatorPreferredExtName' OpAddAssign) [objT c_QMarginsF] $ refT $ objT c_QMarginsF , mkMethod' OpAddAssign (operatorPreferredExtName' OpAddAssign ++ "Real")@@ -73,10 +78,4 @@ [qreal] $ refT $ objT c_QMarginsF , mkMethod' OpDivideAssign (operatorPreferredExtName' OpDivideAssign) [qreal] $ refT $ objT c_QMarginsF- ] ++- mkProps- [ mkProp "bottom" qreal- , mkProp "left" qreal- , mkProp "right" qreal- , mkProp "top" qreal ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QObject.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,15 +31,15 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, intT, objT, ptrT, voidT) import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion)-import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Listener+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Internal.Listener import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QList (c_QListQObject) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -51,12 +52,12 @@ c_QObject = addReqIncludes [includeStd "QObject"] $- makeClass (ident "QObject") Nothing []- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QObject]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QObject") Nothing [] $ collect- [ just $ mkMethod "blockSignals" [boolT] boolT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QObject]+ , just $ mkMethod "blockSignals" [boolT] boolT , just $ mkMethod "children" [] $ objT c_QListQObject -- TODO connect , just $ mkMethod "deleteLater" [] voidT@@ -76,16 +77,14 @@ , just $ mkMethod "killTimer" [intT] voidT -- TODO metaObject -- TODO moveToThread+ , just $ mkProp "objectName" $ objT c_QString+ , just $ mkProp "parent" $ ptrT $ objT c_QObject -- TODO property , just $ mkMethod "removeEventFilter" [ptrT $ objT c_QObject] voidT -- TODO setProperty , just $ mkConstMethod "signalsBlocked" [] boolT , just $ mkMethod "startTimer" [intT] intT -- TODO thread- ] ++- mkProps- [ mkProp "objectName" $ objT c_QString- , mkProp "parent" $ ptrT $ objT c_QObject ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Core/QPoint.hs view
@@ -27,7 +27,6 @@ #endif import Foreign.Hoppy.Generator.Language.Haskell ( addImports,- indent, sayLn, ) import Foreign.Hoppy.Generator.Spec (@@ -40,6 +39,7 @@ Export (ExportClass), Operator (OpAddAssign, OpDivideAssign, OpMultiplyAssign, OpSubtractAssign), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImports, hsQualifiedImport,@@ -51,7 +51,6 @@ mkMethod, mkMethod', mkProp,- mkProps, mkStaticMethod, operatorPreferredExtName', )@@ -63,7 +62,7 @@ import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal)-import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -82,31 +81,29 @@ addReqIncludes [includeStd "QPoint"] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports $ hsQualifiedImport "Graphics.UI.Qtah.Core.HPoint" "HPoint" return $ HsTyCon $ UnQual $ HsIdent "HPoint.HPoint"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"], hsQualifiedImport "Graphics.UI.Qtah.Core.HPoint" "HPoint"]- sayLn "qPoint_new <$> HPoint.x <*> HPoint.y"- , classHaskellConversionFromCppFn = do- addImports $ mconcat [hsQualifiedImport "Graphics.UI.Qtah.Core.HPoint" "HPoint",- importForPrelude]- sayLn "\\q -> do"- indent $ do- sayLn "y <- qPoint_x q"- sayLn "x <- qPoint_y q"- sayLn "QtahP.return (HPoint.HPoint x y)"+ sayLn "new <$> HPoint.x <*> HPoint.y"+ , classHaskellConversionFromCppFn = Just $ do+ addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"],+ hsQualifiedImport "Graphics.UI.Qtah.Core.HPoint" "HPoint"]+ sayLn "\\q -> HPoint.HPoint <$> x q <*> y q" } $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QPoint") Nothing []- [ mkCtor "newNull" []- , mkCtor "new" [intT, intT]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QPoint") Nothing [] $ collect- [ test (qtVersion >= [5, 1]) $ mkStaticMethod "dotProduct" [objT c_QPoint, objT c_QPoint] intT+ [ just $ mkCtor "newNull" []+ , just $ mkCtor "new" [intT, intT]+ , test (qtVersion >= [5, 1]) $ mkStaticMethod "dotProduct" [objT c_QPoint, objT c_QPoint] intT , just $ mkConstMethod "isNull" [] boolT , just $ mkConstMethod "manhattanLength" [] intT+ , just $ mkProp "x" intT+ , just $ mkProp "y" intT , just $ mkMethod OpAddAssign [objT c_QPoint] $ refT $ objT c_QPoint , just $ mkMethod OpSubtractAssign [objT c_QPoint] $ refT $ objT c_QPoint , just $ mkMethod' OpMultiplyAssign (operatorPreferredExtName' OpMultiplyAssign)@@ -114,8 +111,4 @@ , just $ mkMethod' OpMultiplyAssign (operatorPreferredExtName' OpMultiplyAssign ++ "Real") [qreal] $ refT $ objT c_QPoint , just $ mkMethod OpDivideAssign [qreal] $ refT $ objT c_QPoint- ] ++- mkProps- [ mkProp "x" intT- , mkProp "y" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QPointF.hs view
@@ -27,7 +27,6 @@ #endif import Foreign.Hoppy.Generator.Language.Haskell ( addImports,- indent, sayLn, ) import Foreign.Hoppy.Generator.Spec (@@ -40,6 +39,7 @@ Export (ExportClass), Operator (OpAddAssign, OpDivideAssign, OpMultiplyAssign, OpSubtractAssign), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImports, hsQualifiedImport,@@ -50,7 +50,6 @@ mkCtor, mkMethod, mkProp,- mkProps, mkStaticMethod, ) import Foreign.Hoppy.Generator.Spec.ClassFeature (@@ -62,7 +61,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint) import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal)-import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -81,39 +80,33 @@ addReqIncludes [includeStd "QPointF"] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports $ hsQualifiedImport "Graphics.UI.Qtah.Core.HPointF" "HPointF" return $ HsTyCon $ UnQual $ HsIdent "HPointF.HPointF"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"], hsQualifiedImport "Graphics.UI.Qtah.Core.HPointF" "HPointF"]- sayLn "qPointF_new <$> HPointF.x <*> HPointF.y"- , classHaskellConversionFromCppFn = do- addImports $ mconcat [hsQualifiedImport "Graphics.UI.Qtah.Core.HPointF" "HPointF",- importForPrelude]- sayLn "\\q -> do"- indent $ do- sayLn "y <- qPointF_x q"- sayLn "x <- qPointF_y q"- sayLn "QtahP.return (HPointF.HPointF x y)"+ sayLn "new <$> HPointF.x <*> HPointF.y"+ , classHaskellConversionFromCppFn = Just $ do+ addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"],+ hsQualifiedImport "Graphics.UI.Qtah.Core.HPointF" "HPointF"]+ sayLn "\\q -> HPointF.HPointF <$> x q <*> y q" } $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QPointF") Nothing []- [ mkCtor "newNull" []- , mkCtor "new" [qreal, qreal]- , mkCtor "newFromPoint" [objT c_QPoint]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QPointF") Nothing [] $ collect- [ test (qtVersion >= [5, 1]) $ mkStaticMethod "dotProduct" [objT c_QPointF, objT c_QPointF] qreal+ [ just $ mkCtor "newNull" []+ , just $ mkCtor "new" [qreal, qreal]+ , just $ mkCtor "newFromPoint" [objT c_QPoint]+ , test (qtVersion >= [5, 1]) $ mkStaticMethod "dotProduct" [objT c_QPointF, objT c_QPointF] qreal , just $ mkConstMethod "isNull" [] boolT , test (qtVersion >= [4, 6]) $ mkConstMethod "manhattanLength" [] qreal , just $ mkConstMethod "toPoint" [] $ objT c_QPoint+ , just $ mkProp "x" qreal+ , just $ mkProp "y" qreal , just $ mkMethod OpAddAssign [objT c_QPointF] $ refT $ objT c_QPointF , just $ mkMethod OpSubtractAssign [objT c_QPointF] $ refT $ objT c_QPointF , just $ mkMethod OpMultiplyAssign [qreal] $ refT $ objT c_QPointF , just $ mkMethod OpDivideAssign [qreal] $ refT $ objT c_QPointF- ] ++- mkProps- [ mkProp "x" qreal- , mkProp "y" qreal ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QRect.hs view
@@ -27,7 +27,6 @@ #endif import Foreign.Hoppy.Generator.Language.Haskell ( addImports,- indent, sayLn, ) import Foreign.Hoppy.Generator.Spec (@@ -39,6 +38,7 @@ ), Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImports, hsQualifiedImport,@@ -50,7 +50,6 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Spec.ClassFeature ( ClassFeature (Assignable, Copyable, Equatable),@@ -62,7 +61,7 @@ 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.QSize (c_QSize)-import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -81,42 +80,41 @@ addReqIncludes [includeStd "QRect"] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports $ hsQualifiedImport "Graphics.UI.Qtah.Core.HRect" "HRect" return $ HsTyCon $ UnQual $ HsIdent "HRect.HRect"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"], hsQualifiedImport "Graphics.UI.Qtah.Core.HRect" "HRect"]- sayLn "qRect_newWithRaw <$> HRect.x <*> HRect.y <*> HRect.width <*> HRect.height"- , classHaskellConversionFromCppFn = do- addImports $ mconcat [hsQualifiedImport "Graphics.UI.Qtah.Core.HRect" "HRect",- importForPrelude]- sayLn "\\q -> do"- indent $ do- sayLn "x <- qRect_x q"- sayLn "y <- qRect_y q"- sayLn "w <- qRect_width q"- sayLn "h <- qRect_height q"- sayLn "QtahP.return (HRect.HRect x y w h)"+ sayLn "newWithRaw <$> HRect.x <*> HRect.y <*> HRect.width <*> HRect.height"+ , classHaskellConversionFromCppFn = Just $ do+ addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"],+ hsQualifiedImport "Graphics.UI.Qtah.Core.HRect" "HRect"]+ sayLn "\\q -> HRect.HRect <$> x q <*> y q <*> width q <*> height q" } $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QRect") Nothing []- [ mkCtor "newNull" []- , mkCtor "newWithPoints" [objT c_QPoint, objT c_QPoint]- , mkCtor "newWithPointAndSize" [objT c_QPoint, objT c_QSize]- , mkCtor "newWithRaw" [intT, intT, intT, intT]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QRect") Nothing [] $ collect- [ just $ mkMethod "adjust" [intT, intT, intT, intT] voidT+ [ just $ mkCtor "newNull" []+ , just $ mkCtor "newWithPoints" [objT c_QPoint, objT c_QPoint]+ , just $ mkCtor "newWithPointAndSize" [objT c_QPoint, objT c_QSize]+ , just $ mkCtor "newWithRaw" [intT, intT, intT, intT]+ , just $ mkMethod "adjust" [intT, intT, intT, intT] voidT , just $ mkConstMethod "adjusted" [intT, intT, intT, intT] $ objT c_QRect+ , just $ mkProp "bottom" intT+ , just $ mkProp "bottomLeft" $ objT c_QPoint+ , just $ mkProp "bottomRight" $ objT c_QPoint , just $ mkConstMethod "center" [] $ objT c_QPoint , just $ mkConstMethod' "contains" "containsPoint" [objT c_QPoint, boolT] boolT , just $ mkConstMethod' "contains" "containsRect" [objT c_QRect, boolT] boolT+ , just $ mkProp "height" intT , test (qtVersion >= [4, 2]) $ mkConstMethod "intersected" [objT c_QRect] $ objT c_QRect , just $ mkConstMethod "intersects" [objT c_QRect] boolT , just $ mkConstMethod "isEmpty" [] boolT , just $ mkConstMethod "isNull" [] boolT , just $ mkConstMethod "isValid" [] boolT+ , just $ mkProp "left" intT , test (qtVersion >= [5, 1]) $ mkConstMethod "marginsAdded" [objT c_QMargins] $ objT c_QRect , test (qtVersion >= [5, 1]) $ mkConstMethod "marginsRemoved" [objT c_QMargins] $ objT c_QRect , just $ mkMethod "moveBottom" [intT] voidT@@ -130,24 +128,17 @@ , just $ mkMethod "moveTopLeft" [objT c_QPoint] voidT , just $ mkMethod "moveTopRight" [objT c_QPoint] voidT , just $ mkConstMethod "normalized" [] $ objT c_QRect+ , just $ mkProp "right" intT , just $ mkMethod "setCoords" [intT, intT, intT, intT] voidT , just $ mkMethod "setRect" [intT, intT, intT, intT] voidT+ , just $ mkProp "size" $ objT c_QSize+ , just $ mkProp "top" intT+ , just $ mkProp "topLeft" $ objT c_QPoint+ , just $ mkProp "topRight" $ objT c_QPoint , just $ mkMethod "translate" [objT c_QPoint] voidT , just $ mkConstMethod "translated" [objT c_QPoint] $ objT c_QRect , test (qtVersion >= [4, 2]) $ mkMethod "united" [objT c_QRect] $ objT c_QRect- ] ++- mkProps- [ mkProp "bottom" intT- , mkProp "bottomLeft" $ objT c_QPoint- , mkProp "bottomRight" $ objT c_QPoint- , mkProp "height" intT- , mkProp "left" intT- , mkProp "right" intT- , mkProp "size" $ objT c_QSize- , mkProp "top" intT- , mkProp "topLeft" $ objT c_QPoint- , mkProp "topRight" $ objT c_QPoint- , mkProp "width" intT- , mkProp "x" intT- , mkProp "y" intT+ , just $ mkProp "width" intT+ , just $ mkProp "x" intT+ , just $ mkProp "y" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QRectF.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, classSetConversionToGc, ident, includeStd,@@ -32,7 +33,6 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Spec.ClassFeature ( ClassFeature (Assignable, Copyable, Equatable),@@ -46,6 +46,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect) import Graphics.UI.Qtah.Generator.Interface.Core.QSizeF (c_QSizeF) import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -57,27 +58,31 @@ c_QRectF = addReqIncludes [includeStd "QRectF"] $- classAddFeatures [Assignable, Copyable, Equatable] $ classSetConversionToGc $- makeClass (ident "QRectF") Nothing []- (collect- [ just $ mkCtor "newNull" []- , test (qtVersion >= [4, 3]) $ mkCtor "newFromPoints" [objT c_QPointF, objT c_QPointF]- , just $ mkCtor "newWithPointAndSize" [objT c_QPointF, objT c_QSizeF]- , just $ mkCtor "newWithRect" [objT c_QRect]- , just $ mkCtor "newWithRaw" [qreal, qreal, qreal, qreal]- ]) $+ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QRectF") Nothing [] $ collect- [ just $ mkMethod "adjust" [qreal, qreal, qreal, qreal] voidT+ [ just $ mkCtor "newNull" []+ , test (qtVersion >= [4, 3]) $ mkCtor "newFromPoints" [objT c_QPointF, objT c_QPointF]+ , just $ mkCtor "newWithPointAndSize" [objT c_QPointF, objT c_QSizeF]+ , just $ mkCtor "newWithRect" [objT c_QRect]+ , just $ mkCtor "newWithRaw" [qreal, qreal, qreal, qreal]+ , just $ mkMethod "adjust" [qreal, qreal, qreal, qreal] voidT , just $ mkConstMethod "adjusted" [qreal, qreal, qreal, qreal] $ objT c_QRectF+ , just $ mkProp "bottom" qreal+ , just $ mkProp "bottomLeft" $ objT c_QPointF+ , just $ mkProp "bottomRight" $ objT c_QPointF , just $ mkConstMethod "center" [] $ objT c_QPointF , just $ mkConstMethod' "contains" "containsPoint" [objT c_QPointF] boolT , just $ mkConstMethod' "contains" "containsRect" [objT c_QRectF] boolT+ , just $ mkProp "height" qreal , test (qtVersion >= [4, 2]) $ mkConstMethod "intersected" [objT c_QRectF] $ objT c_QRectF , just $ mkConstMethod "intersects" [objT c_QRectF] boolT , just $ mkConstMethod "isEmpty" [] boolT , just $ mkConstMethod "isNull" [] boolT , just $ mkConstMethod "isValid" [] boolT+ , just $ mkProp "left" qreal , test (qtVersion >= [5, 3]) $ mkConstMethod "marginsAdded" [objT c_QMarginsF] $ objT c_QRectF , test (qtVersion >= [5, 3]) $ mkConstMethod "marginsRemoved" [objT c_QMarginsF] $ objT c_QRectF , just $ mkMethod "moveBottom" [qreal] voidT@@ -91,25 +96,18 @@ , just $ mkMethod "moveTopLeft" [objT c_QPointF] voidT , just $ mkMethod "moveTopRight" [objT c_QPointF] voidT , just $ mkConstMethod "normalized" [] $ objT c_QRectF+ , just $ mkProp "right" qreal , just $ mkMethod "setCoords" [qreal, qreal, qreal, qreal] voidT , just $ mkMethod "setRect" [qreal, qreal, qreal, qreal] voidT+ , just $ mkProp "size" $ objT c_QSizeF , just $ mkConstMethod "toAlignedRect" [] $ objT c_QRect+ , just $ mkProp "top" qreal+ , just $ mkProp "topLeft" $ objT c_QPointF+ , just $ mkProp "topRight" $ objT c_QPointF , just $ mkMethod "translate" [objT c_QPointF] voidT , just $ mkConstMethod "translated" [objT c_QPointF] $ objT c_QRectF , test (qtVersion >= [4, 2]) $ mkMethod "united" [objT c_QRectF] $ objT c_QRectF- ] ++- mkProps- [ mkProp "bottom" qreal- , mkProp "bottomLeft" $ objT c_QPointF- , mkProp "bottomRight" $ objT c_QPointF- , mkProp "height" qreal- , mkProp "left" qreal- , mkProp "right" qreal- , mkProp "size" $ objT c_QSizeF- , mkProp "top" qreal- , mkProp "topLeft" $ objT c_QPointF- , mkProp "topRight" $ objT c_QPointF- , mkProp "width" qreal- , mkProp "x" qreal- , mkProp "y" qreal+ , just $ mkProp "width" qreal+ , just $ mkProp "x" qreal+ , just $ mkProp "y" qreal ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QSize.hs view
@@ -27,7 +27,6 @@ #endif import Foreign.Hoppy.Generator.Language.Haskell ( addImports,- indent, sayLn, ) import Foreign.Hoppy.Generator.Spec (@@ -40,6 +39,7 @@ Export (ExportClass), Operator (OpAddAssign, OpDivideAssign, OpMultiplyAssign, OpSubtractAssign), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImports, hsQualifiedImport,@@ -50,7 +50,6 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Spec.ClassFeature ( ClassFeature (Assignable, Copyable, Equatable),@@ -60,7 +59,7 @@ import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_AspectRatioMode, qreal)-import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -79,30 +78,27 @@ addReqIncludes [includeStd "QSize"] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports $ hsQualifiedImport "Graphics.UI.Qtah.Core.HSize" "HSize" return $ HsTyCon $ UnQual $ HsIdent "HSize.HSize"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"], hsQualifiedImport "Graphics.UI.Qtah.Core.HSize" "HSize"]- sayLn "qSize_new <$> HSize.width <*> HSize.height"- , classHaskellConversionFromCppFn = do- addImports $ mconcat [hsQualifiedImport "Graphics.UI.Qtah.Core.HSize" "HSize",- importForPrelude]- sayLn "\\q -> do"- indent $ do- sayLn "w <- qSize_width q"- sayLn "h <- qSize_height q"- sayLn "QtahP.return (HSize.HSize w h)"+ sayLn "new <$> HSize.width <*> HSize.height"+ , classHaskellConversionFromCppFn = Just $ do+ addImports $ mconcat [hsImports "Control.Applicative" ["(<$>)", "(<*>)"],+ hsQualifiedImport "Graphics.UI.Qtah.Core.HSize" "HSize"]+ sayLn "\\q -> HSize.HSize <$> width q <*> height q" } $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QSize") Nothing []- [ mkCtor "newNull" []- , mkCtor "new" [intT, intT]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QSize") Nothing [] $ collect- [ just $ mkConstMethod "boundedTo" [objT c_QSize] $ objT c_QSize+ [ just $ mkCtor "newNull" []+ , just $ mkCtor "new" [intT, intT]+ , just $ mkConstMethod "boundedTo" [objT c_QSize] $ objT c_QSize , just $ mkConstMethod "expandedTo" [objT c_QSize] $ objT c_QSize+ , just $ mkProp "height" intT , just $ mkConstMethod "isEmpty" [] boolT , just $ mkConstMethod "isNull" [] boolT , just $ mkConstMethod "isValid" [] boolT@@ -111,12 +107,9 @@ mkConstMethod "scaled" [objT c_QSize, enumT e_AspectRatioMode] $ objT c_QSize , just $ mkMethod "transpose" [] voidT , test (qtVersion >= [5, 0]) $ mkConstMethod "transposed" [] $ objT c_QSize+ , just $ mkProp "width" intT , just $ mkMethod OpAddAssign [objT c_QSize] $ refT $ objT c_QSize , just $ mkMethod OpSubtractAssign [objT c_QSize] $ refT $ objT c_QSize , just $ mkMethod OpMultiplyAssign [qreal] $ refT $ objT c_QSize , just $ mkMethod OpDivideAssign [qreal] $ refT $ objT c_QSize- ] ++- mkProps- [ mkProp "height" intT- , mkProp "width" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QSizeF.hs view
@@ -25,6 +25,7 @@ Operator (OpAddAssign, OpDivideAssign, OpMultiplyAssign, OpSubtractAssign), addReqIncludes, classSetConversionToGc,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -32,7 +33,6 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Spec.ClassFeature ( ClassFeature (Assignable, Copyable, Equatable),@@ -43,6 +43,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_AspectRatioMode, qreal)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -54,16 +55,17 @@ c_QSizeF = addReqIncludes [includeStd "QSizeF"] $- classAddFeatures [Assignable, Copyable, Equatable] $ classSetConversionToGc $- makeClass (ident "QSizeF") Nothing []- [ mkCtor "newNull" []- , mkCtor "new" [qreal, qreal]- , mkCtor "newWithSize" [objT c_QSize]- ] $+ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QSizeF") Nothing [] $ collect- [ just $ mkConstMethod "boundedTo" [objT c_QSizeF] $ objT c_QSizeF+ [ just $ mkCtor "newNull" []+ , just $ mkCtor "new" [qreal, qreal]+ , just $ mkCtor "newWithSize" [objT c_QSize]+ , just $ mkConstMethod "boundedTo" [objT c_QSizeF] $ objT c_QSizeF , just $ mkConstMethod "expandedTo" [objT c_QSizeF] $ objT c_QSizeF+ , just $ mkProp "height" qreal , just $ mkConstMethod "isEmpty" [] boolT , just $ mkConstMethod "isNull" [] boolT , just $ mkConstMethod "isValid" [] boolT@@ -73,12 +75,9 @@ , just $ mkConstMethod "toSize" [] $ objT c_QSize , just $ mkMethod "transpose" [] voidT , test (qtVersion >= [5, 0]) $ mkConstMethod "transposed" [] $ objT c_QSizeF+ , just $ mkProp "width" qreal , just $ mkMethod OpAddAssign [objT c_QSizeF] $ refT $ objT c_QSizeF , just $ mkMethod OpSubtractAssign [objT c_QSizeF] $ objT c_QSizeF , just $ mkMethod OpMultiplyAssign [qreal] $ refT $ objT c_QSizeF , just $ mkMethod OpDivideAssign [qreal] $ refT $ objT c_QSizeF- ] ++- mkProps- [ mkProp "height" qreal- , mkProp "width" qreal ]
src/Graphics/UI/Qtah/Generator/Interface/Core/QString.hs view
@@ -41,6 +41,7 @@ Operator (OpArray), Purity (Nonpure), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, ident, ident2,@@ -62,6 +63,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QChar (c_QChar) import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -83,19 +85,19 @@ classAddFeatures [Assignable, Copyable, Comparable, Equatable] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports importForPrelude return $ HsTyCon $ UnQual $ HsIdent "QtahP.String"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [importForForeignC, importForPrelude]- sayLn "QtahP.flip QtahFC.withCString qString_newFromCString"- , classHaskellConversionFromCppFn = sayLn "qString_toStdString"+ sayLn "QtahP.flip QtahFC.withCString newFromCString"+ , classHaskellConversionFromCppFn = Just $ sayLn "toStdString" } $- makeClass (ident "QString") Nothing []- [ mkCtor "newFromCString" [ptrT $ constT charT]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QString") Nothing [] $ collect- [ just $ mkConstMethod' OpArray "at" [intT] $ objT c_QChar+ [ just $ mkCtor "newFromCString" [ptrT $ constT charT]+ , just $ mkConstMethod' OpArray "at" [intT] $ objT c_QChar , just $ makeFnMethod (ident2 "qtah" "qstring" "set") "set" MNormal Nonpure [refT $ objT c_QString, intT, objT c_QChar] voidT , test (qtVersion >= [5, 0]) $ mkConstMethod "toHtmlEscaped" [] $ objT c_QString
src/Graphics/UI/Qtah/Generator/Interface/Core/QStringList.hs view
@@ -32,8 +32,9 @@ sayLn, saysLn, toHsCastMethodName,+ toHsClassEntityName,+ toHsClassEntityName', toHsDataTypeName,- toHsMethodName', ) import Foreign.Hoppy.Generator.Spec ( ClassHaskellConversion (@@ -46,6 +47,7 @@ Export (ExportClass), addAddendumHaskell, addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImport1, ident,@@ -68,6 +70,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_CaseSensitivity) import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -87,25 +90,25 @@ addReqIncludes [includeStd "QStringList"] $ classSetHaskellConversion ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports importForPrelude return $ HsTyApp (HsTyCon $ Special $ HsListCon) $ HsTyCon $ UnQual $ HsIdent "QtahP.String"- , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports importForRuntime sayLn "QtahFHR.fromContents"- , classHaskellConversionFromCppFn = do+ , classHaskellConversionFromCppFn = Just $ do addImports importForRuntime sayLn "QtahFHR.toContents" } $ addAddendumHaskell addendum $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QStringList") Nothing [c_QListQString]- [ mkCtor "new" []- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QStringList") Nothing [c_QListQString] $ collect- [ -- TODO Regexp methods.+ [ just $ mkCtor "new" []+ , -- TODO Regexp methods. just $ mkConstMethod' "contains" "containsCase" [objT c_QString, enumT e_CaseSensitivity] boolT , just $ mkConstMethod' "filter" "filter" [objT c_QString] $ objT c_QStringList , just $ mkConstMethod' "filter" "filterCase" [objT c_QString, enumT e_CaseSensitivity] $@@ -119,24 +122,26 @@ ] where addendum = do- let hsDataTypeName = toHsDataTypeName Nonconst c_QStringList- hsDataTypeNameConst = toHsDataTypeName Const c_QStringList+ hsDataTypeName <- toHsDataTypeName Nonconst c_QStringList+ hsDataTypeNameConst <- toHsDataTypeName Const c_QStringList+ castToQList <- toHsCastMethodName Const c_QListQString addImports $ mconcat [hsImport1 "Prelude" "(.)", importForPrelude, importForRuntime] ln saysLn ["instance QtahFHR.HasContents ", hsDataTypeNameConst, " QtahP.String where"] indent $- saysLn ["toContents = QtahFHR.toContents . ", toHsCastMethodName Const c_QListQString]+ saysLn ["toContents = QtahFHR.toContents . ", castToQList] ln saysLn ["instance QtahFHR.HasContents ", hsDataTypeName, " QtahP.String where"] indent $- saysLn ["toContents = QtahFHR.toContents . ", toHsCastMethodName Const c_QStringList]+ saysLn ["toContents = QtahFHR.toContents . ", castToQList] ln saysLn ["instance QtahFHR.FromContents ", hsDataTypeName, " QtahP.String where"] indent $ do sayLn "fromContents strs' = do" indent $ do- saysLn ["l' <- ", toHsMethodName' c_QStringList "new"]- saysLn ["QtahP.mapM_ (", toHsMethodName' c_QListQString "append", " l') strs'"]+ listAppend <- toHsClassEntityName c_QListQString "append"+ saysLn ["l' <- ", toHsClassEntityName' c_QStringList "new"]+ saysLn ["QtahP.mapM_ (", listAppend, " l') strs'"] sayLn "QtahP.return l'"
src/Graphics/UI/Qtah/Generator/Interface/Core/QTimerEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -29,6 +30,7 @@ ) import Foreign.Hoppy.Generator.Types (intT) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -41,8 +43,8 @@ c_QTimerEvent = addReqIncludes [includeStd "QTimerEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QTimerEvent") Nothing [c_QEvent] [ mkCtor "new" [intT]- ]- [ mkConstMethod "timerId" [] intT+ , mkConstMethod "timerId" [] intT ]
+ src/Graphics/UI/Qtah/Generator/Interface/Core/QVariant.hs view
@@ -0,0 +1,215 @@+-- This file is part of Qtah.+--+-- Copyright 2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.QVariant (+ aModule,+ c_QVariant,+ ) where++import Foreign.Hoppy.Generator.Spec (+ Export (ExportEnum, ExportClass),+ addReqIncludes,+ classSetEntityPrefix,+ classSetConversionToGc,+ ident,+ ident1,+ includeStd,+ makeClass,+ mkConstMethod,+ mkConstMethod',+ mkCtor,+ mkMethod,+ mkMethod',+ )+import Foreign.Hoppy.Generator.Spec.ClassFeature (+ ClassFeature (Assignable, Comparable, Copyable, Equatable),+ classAddFeatures,+ )+import Foreign.Hoppy.Generator.Types (+ boolT,+ doubleT,+ enumT,+ floatT,+ intT,+ llongT,+ objT,+ refT,+ uintT,+ ullongT,+ voidT,+ )+import Foreign.Hoppy.Generator.Version (collect, just, test)+import Graphics.UI.Qtah.Generator.Flags (qtVersion)+import Graphics.UI.Qtah.Generator.Interface.Core.QChar (c_QChar)+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Core.QList (c_QListQVariant)+import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint)+import Graphics.UI.Qtah.Generator.Interface.Core.QPointF (c_QPointF)+import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect)+import Graphics.UI.Qtah.Generator.Interface.Core.QRectF (c_QRectF)+import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize)+import Graphics.UI.Qtah.Generator.Interface.Core.QSizeF (c_QSizeF)+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.Module (AModule (AQtModule), makeQtModule)+import Graphics.UI.Qtah.Generator.Types++{-# ANN module "HLint: ignore Use camelCase" #-}++aModule =+ AQtModule $+ makeQtModule ["Core", "QVariant"]+ [ QtExport $ ExportClass c_QVariant+ , QtExport $ ExportEnum e_Type+ ]++-- TODO Many more data types needed here.+c_QVariant =+ addReqIncludes [includeStd "QVariant"] $+ classSetConversionToGc $+ classAddFeatures (collect+ [ just Assignable+ , test (qtVersion >= [5, 0]) Comparable+ , just Copyable+ , just Equatable+ ]) $+ classSetEntityPrefix "" $+ makeClass (ident "QVariant") Nothing [] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithBool" [boolT]+ , just $ mkCtor "newWithChar" [objT c_QChar]+ , just $ mkCtor "newWithDouble" [doubleT]+ , test (qtVersion >= [4, 6]) $ mkCtor "newWithFloat" [floatT]+ -- OMIT Qt::GlobalColor support. Per the Qt5 headers (qvariant.h as of Qt+ -- 5.6), it's been deleted because it unexpectedly creates a QVariant of+ -- type int instead of the enum type.+ , just $ mkCtor "newWithInt" [intT]+ , just $ mkCtor "newWithList" [objT c_QListQVariant]+ , just $ mkCtor "newWithLongLong" [llongT]+ , just $ mkCtor "newWithPointF" [objT c_QPointF]+ , just $ mkCtor "newWithPoint" [objT c_QPoint]+ , just $ mkCtor "newWithRectF" [objT c_QRectF]+ , just $ mkCtor "newWithRect" [objT c_QRect]+ , just $ mkCtor "newWithSizeF" [objT c_QSizeF]+ , just $ mkCtor "newWithSize" [objT c_QSize]+ , just $ mkCtor "newWithString" [objT c_QString]+ , just $ mkCtor "newWithStringList" [objT c_QStringList]+ , just $ mkCtor "newWithType" [enumT e_Type]+ , just $ mkCtor "newWithUInt" [uintT]+ , just $ mkCtor "newWithULongLong" [ullongT]+ , just $ mkConstMethod "canConvert" [enumT e_Type] boolT+ , just $ mkMethod "clear" [] voidT+ , just $ mkMethod "convert" [enumT e_Type] boolT+ , just $ mkConstMethod "isNull" [] boolT+ , just $ mkConstMethod "isValid" [] boolT+ , just $ mkMethod' "setValue" "setToBool" [boolT] voidT+ , just $ mkMethod' "setValue" "setToChar" [objT c_QChar] voidT+ , just $ mkMethod' "setValue" "setToDouble" [doubleT] voidT+ , test (qtVersion >= [4, 6]) $ mkMethod' "setValue" "setToFloat" [floatT] voidT+ , just $ mkMethod' "setValue" "setToInt" [intT] voidT+ , just $ mkMethod' "setValue" "setToList" [objT c_QListQVariant] voidT+ , just $ mkMethod' "setValue" "setToLongLong" [llongT] voidT+ , just $ mkMethod' "setValue" "setToPoint" [objT c_QPoint] voidT+ , just $ mkMethod' "setValue" "setToPointF" [objT c_QPointF] voidT+ , just $ mkMethod' "setValue" "setToRect" [objT c_QRect] voidT+ , just $ mkMethod' "setValue" "setToRectF" [objT c_QRectF] voidT+ , just $ mkMethod' "setValue" "setToSize" [objT c_QSize] voidT+ , just $ mkMethod' "setValue" "setToSizeF" [objT c_QSizeF] voidT+ , just $ mkMethod' "setValue" "setToStringList" [objT c_QStringList] voidT+ , just $ mkMethod' "setValue" "setToString" [objT c_QString] voidT+ , just $ mkMethod' "setValue" "setToUInt" [uintT] voidT+ , just $ mkMethod' "setValue" "setToULongLong" [ullongT] voidT+ , test (qtVersion >= [4, 8]) $ mkMethod' "setValue" "swap" [refT $ objT c_QVariant] voidT+ , just $ mkConstMethod "toBool" [] boolT+ , just $ mkConstMethod "toChar" [] $ objT c_QChar+ , just $ mkConstMethod "toDouble" [] doubleT+ , test (qtVersion >= [4, 6]) $ mkConstMethod "toFloat" [] floatT+ , just $ mkConstMethod "toInt" [] intT+ , just $ mkConstMethod "toLongLong" [] llongT+ , just $ mkConstMethod "toPoint" [] $ objT c_QPoint+ , just $ mkConstMethod "toPointF" [] $ objT c_QPointF+ , just $ mkConstMethod "toRect" [] $ objT c_QRect+ , just $ mkConstMethod "toRectF" [] $ objT c_QRectF+ , just $ mkConstMethod "toSize" [] $ objT c_QSize+ , just $ mkConstMethod "toSizeF" [] $ objT c_QSizeF+ , just $ mkConstMethod "toStringList" [] $ objT c_QStringList+ , just $ mkConstMethod "toString" [] $ objT c_QString+ , just $ mkConstMethod "toUInt" [] uintT+ , just $ mkConstMethod "toULongLong" [] ullongT+ , -- Have to rename this, because "type" is reserved in Haskell.+ just $ mkConstMethod' "type" "getType" [] $ enumT e_Type+ , just $ mkConstMethod "userType" [] intT+ ]++e_Type =+ makeQtEnum (ident1 "QVariant" "Type") [includeStd "QVariant"]+ [ (0, ["invalid"])+ , (13, ["bit", "array"])+ , (73, ["bitmap"])+ , (1, ["bool"])+ , (66, ["brush"])+ , (12, ["byte", "array"])+ , (7, ["char"])+ , (67, ["color"])+ , (74, ["cursor"])+ , (14, ["date"])+ , (16, ["date", "time"])+ , (6, ["double"])+ , (29, ["easing", "curve"])+ , (64, ["font"])+ , (28, ["hash"])+ , (69, ["icon"])+ , (70, ["image"])+ , (2, ["int"])+ , (76, ["key", "sequence"])+ , (23, ["line"])+ , (24, ["line", "f"])+ , (9, ["list"])+ , (18, ["locale"])+ , (4, ["long", "long"])+ , (8, ["map"])+ , (80, ["matrix"])+ , (81, ["transform"])+ , (82, ["matrix", "4x4"])+ , (68, ["palette"])+ , (77, ["pen"])+ , (65, ["pixmap"])+ , (25, ["point"])+ -- PointArray omitted -- same value as Polygon.+ , (26, ["point", "f"])+ , (71, ["polygon"])+ , (86, ["quaternion"])+ , (19, ["rect"])+ , (20, ["rect", "f"])+ , (27, ["reg", "exp"])+ , (72, ["region"])+ , (21, ["size"])+ , (22, ["size", "f"])+ , (75, ["size", "policy"])+ , (10, ["string"])+ , (11, ["string", "list"])+ , (79, ["text", "format"])+ , (78, ["text", "length"])+ , (15, ["time"])+ , (3, ["u", "int"])+ , (5, ["u", "long", "long"])+ , (17, ["url"])+ , (83, ["vector", "2d"])+ , (84, ["vector", "3d"])+ , (85, ["vector", "4d"])+ , (127, ["user", "type"])+ ]
+ src/Graphics/UI/Qtah/Generator/Interface/Core/QVariant.hs-boot view
@@ -0,0 +1,24 @@+-- This file is part of Qtah.+--+-- Copyright 2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.QVariant (+ c_QVariant,+ ) where++import Foreign.Hoppy.Generator.Spec (Class)++c_QVariant :: Class
src/Graphics/UI/Qtah/Generator/Interface/Core/QVector.hs view
@@ -45,8 +45,8 @@ prettyPrint, sayLn, saysLn,+ toHsClassEntityName', toHsDataTypeName,- toHsMethodName', ) import Foreign.Hoppy.Generator.Spec ( Class,@@ -57,6 +57,7 @@ Type, addReqs, addAddendumHaskell,+ classSetEntityPrefix, classSetMonomorphicSuperclass, hsImport1, hsImports,@@ -81,6 +82,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint) import Graphics.UI.Qtah.Generator.Interface.Core.QPointF (c_QPointF) import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), QtModule, makeQtModule) import Graphics.UI.Qtah.Generator.Types -- | Options for instantiating the vector classes.@@ -119,13 +121,13 @@ addAddendumHaskell addendum $ classAddFeatures features $ classSetMonomorphicSuperclass $- makeClass (identT "QVector" [t]) (Just $ toExtName vectorName) []- [ mkCtor "new" []- , mkCtor "newWithSize" [intT]- , mkCtor "newWithSizeAndValue" [intT, t]- ] $+ classSetEntityPrefix "" $+ makeClass (identT "QVector" [t]) (Just $ toExtName vectorName) [] $ collect- [ just $ mkMethod' "append" "append" [t] voidT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithSize" [intT]+ , just $ mkCtor "newWithSizeAndValue" [intT, t]+ , just $ mkMethod' "append" "append" [t] voidT , test (qtVersion >= [5, 5]) $ mkMethod' "append" "appendVector" [objT vector] voidT , just $ mkMethod' OpArray "at" [intT] $ refT t , just $ mkConstMethod' "at" "atConst" [intT] $ refT $ constT t@@ -204,7 +206,7 @@ importForRuntime] forM_ [Const, Nonconst] $ \cst -> do- let hsDataTypeName = toHsDataTypeName cst vector+ hsDataTypeName <- toHsDataTypeName cst vector hsValueType <- cppTypeToHsTypeAndUse HsHsSide $ case cst of Const -> constT t Nonconst -> t@@ -219,9 +221,9 @@ let vectorAt = case cst of Const -> "atConst" Nonconst -> "at"- saysLn ["size' <- ", toHsMethodName' vector "size", " this'"]+ saysLn ["size' <- ", toHsClassEntityName' vector "size", " this'"] saysLn ["QtahP.mapM (QtahFHR.decode <=< ",- toHsMethodName' vector vectorAt, " this') [0..size'-1]"]+ toHsClassEntityName' vector vectorAt, " this') [0..size'-1]"] -- Only generate a nonconst FromContents instance. when (cst == Nonconst) $ do@@ -231,10 +233,10 @@ indent $ do sayLn "fromContents values' = do" indent $ do- saysLn ["vector' <- ", toHsMethodName' vector "new"]- saysLn [toHsMethodName' vector "reserve",+ saysLn ["vector' <- ", toHsClassEntityName' vector "new"]+ saysLn [toHsClassEntityName' vector "reserve", " vector' $ QtahFHR.coerceIntegral $ QtahP.length values'"]- saysLn ["QtahP.mapM_ (", toHsMethodName' vector "append", " vector') values'"]+ saysLn ["QtahP.mapM_ (", toHsClassEntityName' vector "append", " vector') values'"] sayLn "QtahP.return vector'" in Contents
src/Graphics/UI/Qtah/Generator/Interface/Core/Types.hs view
@@ -30,6 +30,8 @@ e_FillRule, e_FocusReason, e_GlobalColor,+ e_InputMethodHint,+ bs_InputMethodHints, e_KeyboardModifier, bs_KeyboardModifiers, e_LayoutDirection,@@ -69,6 +71,7 @@ import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qrealFloat, qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -91,6 +94,8 @@ , just $ ExportEnum e_FillRule , just $ ExportEnum e_FocusReason , just $ ExportEnum e_GlobalColor+ , just $ ExportEnum e_InputMethodHint+ , just $ ExportBitspace bs_InputMethodHints , just $ ExportEnum e_KeyboardModifier , just $ ExportBitspace bs_KeyboardModifiers , just $ ExportEnum e_LayoutDirection@@ -218,6 +223,31 @@ , (19, ["transparent"]) , (0, ["color0"]) , (1, ["color1"])+ ]++(e_InputMethodHint, bs_InputMethodHints) =+ makeQtEnumBitspace (ident1 "Qt" "InputMethodHint") "InputMethodHints" qtInclude+ [ (0x0, ["imh", "none"])+ , (0x1, ["imh", "hidden", "text"])+ , (0x2, ["imh", "sensitive", "data"])+ , (0x4, ["imh", "no", "auto", "uppercase"])+ , (0x8, ["imh", "prefer", "numbers"])+ , (0x10, ["imh", "prefer", "uppercase"])+ , (0x20, ["imh", "prefer", "lowercase"])+ , (0x40, ["imh", "no", "predictive", "text"])+ , (0x80, ["imh", "date"])+ , (0x100, ["imh", "time"])+ , (0x200, ["imh", "prefer", "latin"])+ , (0x400, ["imh", "multi", "line"])+ , (0x10000, ["imh", "digits", "only"])+ , (0x20000, ["imh", "formatted", "numbers", "only"])+ , (0x40000, ["imh", "uppercase", "only"])+ , (0x80000, ["imh", "lowercase", "only"])+ , (0x100000, ["imh", "dialable", "characters", "only"])+ , (0x200000, ["imh", "email", "characters", "only"])+ , (0x400000, ["imh", "url", "characters", "only"])+ , (0x800000, ["imh", "latin", "only"])+ , (0xffff0000, ["imh", "exclusive", "input", "mask"]) ] (e_KeyboardModifier, bs_KeyboardModifiers) =
− src/Graphics/UI/Qtah/Generator/Interface/EventListener.hs
@@ -1,47 +0,0 @@--- This file is part of Qtah.------ Copyright 2016 Bryan Gardiner <bog@khumba.net>------ 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.EventListener (- aModule,- ) where--import Foreign.Hoppy.Generator.Spec (- Export (ExportClass),- addReqIncludes,- ident2,- includeLocal,- makeClass,- mkCtor,- )-import Foreign.Hoppy.Generator.Types (callbackT, intT, ptrT)-import Graphics.UI.Qtah.Generator.Interface.Callback (cb_PtrQObjectPtrQEventBool)-import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)-import Graphics.UI.Qtah.Generator.Types--{-# ANN module "HLint: ignore Use camelCase" #-}--aModule =- AQtModule $- makeQtModule ["Internal", "EventListener"]- [ QtExport $ ExportClass c_EventListener ]--c_EventListener =- addReqIncludes [includeLocal "event.hpp"] $- makeClass (ident2 "qtah" "event" "EventListener") Nothing [c_QObject]- [ mkCtor "new" [callbackT cb_PtrQObjectPtrQEventBool, ptrT intT]- ]- []
src/Graphics/UI/Qtah/Generator/Interface/Gui.hs view
@@ -37,7 +37,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QShowEvent as QShowEvent import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QValidator as QValidator import qualified Graphics.UI.Qtah.Generator.Interface.Gui.QWheelEvent as QWheelEvent-import Graphics.UI.Qtah.Generator.Types+import Graphics.UI.Qtah.Generator.Module (AModule) {-# ANN module "HLint: ignore Use camelCase" #-}
src/Graphics/UI/Qtah/Generator/Interface/Gui/QActionEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,6 +31,7 @@ import Foreign.Hoppy.Generator.Types (enumT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent, e_Type)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -42,10 +44,10 @@ c_QActionEvent = addReqIncludes [includeStd "QActionEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QActionEvent") Nothing [c_QEvent] [ mkCtor "new" [enumT e_Type, ptrT $ objT c_QAction] , mkCtor "newBefore" [enumT e_Type, ptrT $ objT c_QAction]- ]- [ mkConstMethod "action" [] $ ptrT $ objT c_QAction+ , mkConstMethod "action" [] $ ptrT $ objT c_QAction , mkConstMethod "before" [] $ ptrT $ objT c_QAction ]
src/Graphics/UI/Qtah/Generator/Interface/Gui/QClipboard.hs view
@@ -25,6 +25,7 @@ Export (ExportEnum, ExportClass), addReqIncludes, classSetDtorPrivate,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -38,10 +39,11 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_Listener, c_ListenerQClipboardMode, )+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -56,7 +58,8 @@ c_QClipboard = addReqIncludes [includeStd "QClipboard"] $ classSetDtorPrivate $- makeClass (ident "QClipboard") Nothing [c_QObject] [] $+ classSetEntityPrefix "" $+ makeClass (ident "QClipboard") Nothing [c_QObject] $ collect [ just $ mkMethod' "clear" "clear" [] voidT , just $ mkMethod' "clear" "clearWithMode" [enumT e_Mode] voidT
src/Graphics/UI/Qtah/Generator/Interface/Gui/QCloseEvent.hs view
@@ -21,12 +21,14 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkCtor, ) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -38,7 +40,7 @@ c_QCloseEvent = addReqIncludes [includeStd "QCloseEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QCloseEvent") Nothing [c_QEvent] [ mkCtor "new" [] ]- []
src/Graphics/UI/Qtah/Generator/Interface/Gui/QColor.hs view
@@ -41,6 +41,7 @@ ), Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, classSetHaskellConversion, hsImports, hsQualifiedImport,@@ -54,7 +55,6 @@ mkMethod, mkMethod', mkProp,- mkProps, mkStaticMethod, ) import Foreign.Hoppy.Generator.Spec.ClassFeature (@@ -68,6 +68,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QStringList (c_QStringList) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_GlobalColor, qreal) import Graphics.UI.Qtah.Generator.Interface.Imports+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types import Language.Haskell.Syntax ( HsName (HsIdent),@@ -91,22 +92,28 @@ addReqIncludes [includeStd "QColor"] $ classSetHaskellConversion conversion $ classAddFeatures [Assignable, Copyable, Equatable] $- makeClass (ident "QColor") Nothing []- [ mkCtor "new" []- , mkCtor "newRgb" [intT, intT, intT]- , mkCtor "newRgba" [intT, intT, intT, intT]- , mkCtor "newNamedColor" [objT c_QString]- , mkCtor "newGlobalColor" [enumT e_GlobalColor]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QColor") Nothing [] $ collect- [ just $ mkConstMethod "black" [] intT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newRgb" [intT, intT, intT]+ , just $ mkCtor "newRgba" [intT, intT, intT, intT]+ , just $ mkCtor "newNamedColor" [objT c_QString]+ , just $ mkCtor "newGlobalColor" [enumT e_GlobalColor]+ , just $ mkProp "alpha" intT+ , just $ mkProp "alphaF" qreal+ , just $ mkConstMethod "black" [] intT , just $ mkConstMethod "blackF" [] qreal+ , just $ mkProp "blue" intT+ , just $ mkProp "blueF" qreal , just $ mkStaticMethod "colorNames" [] $ objT c_QStringList , just $ mkConstMethod "convertTo" [enumT e_Spec] $ objT c_QColor , just $ mkConstMethod "cyan" [] intT , just $ mkConstMethod "cyanF" [] qreal , test (qtVersion >= [4, 3]) $ mkConstMethod' "darker" "darker" [] $ objT c_QColor , test (qtVersion >= [4, 3]) $ mkConstMethod' "darker" "darkerBy" [intT] $ objT c_QColor+ , just $ mkProp "green" intT+ , just $ mkProp "greenF" qreal , test (qtVersion >= [4, 6]) $ mkConstMethod "hslHue" [] intT , test (qtVersion >= [4, 6]) $ mkConstMethod "hslHueF" [] qreal , test (qtVersion >= [4, 6]) $ mkConstMethod "hslSaturation" [] intT@@ -128,6 +135,8 @@ , just $ mkConstMethod' "name" "name" [] $ objT c_QString , test (qtVersion >= [5, 2]) $ mkConstMethod' "name" "nameWithFormat" [enumT e_NameFormat] $ objT c_QString+ , just $ mkProp "red" intT+ , just $ mkProp "redF" qreal , just $ mkConstMethod "saturation" [] intT , just $ mkConstMethod "saturationF" [] qreal , just $ mkMethod' "setCmyk" "setCmyk" [intT, intT, intT, intT] voidT@@ -156,16 +165,6 @@ , just $ mkConstMethod "valueF" [] qreal , just $ mkConstMethod "yellow" [] intT , just $ mkConstMethod "yellowF" [] qreal- ] ++- mkProps- [ mkProp "alpha" intT- , mkProp "alphaF" qreal- , mkProp "blue" intT- , mkProp "blueF" qreal- , mkProp "green" intT- , mkProp "greenF" qreal- , mkProp "red" intT- , mkProp "redF" qreal ] where@@ -181,17 +180,17 @@ conversion = ClassHaskellConversion- { classHaskellConversionType = do+ { classHaskellConversionType = Just $ do addImports hColorImport return $ HsTyCon $ UnQual $ HsIdent "HColor.HColor" - , classHaskellConversionToCppFn = do+ , classHaskellConversionToCppFn = Just $ do addImports $ mconcat [importForPrelude, importForRuntime, hColorImport] sayLn "\\color' -> do" indent $ do- sayLn "this' <- qColor_new"+ sayLn "this' <- new" sayLn "case color' of" indent $ forM_ components $ \(spec, letters, _) -> saysLn $ concat@@ -199,22 +198,22 @@ , map (\var -> [' ', var, '\'']) letters , if null letters then [" -> QtahP.return ()"]- else [" -> qColor_set", spec, "a this'"]+ else [" -> set", spec, "a this'"] , concatMap (\var -> [" (QtahFHR.coerceIntegral ", [var], "')"]) letters ] sayLn "QtahP.return this'" - , classHaskellConversionFromCppFn = do+ , classHaskellConversionFromCppFn = Just $ do addImports $ mconcat [hsImports "Prelude" ["($)", "(>>=)"], importForPrelude, importForRuntime, hColorImport]- sayLn "\\this' -> qColor_spec this' >>= \\spec' -> case spec' of"+ sayLn "\\this' -> spec this' >>= \\spec' -> case spec' of" indent $ forM_ components $ \(spec, letters, getters) -> do- saysLn ["QColorSpec_", spec, " -> do"]+ saysLn [spec, " -> do"] indent $ do forM_ (zip letters getters) $ \(var, get) ->- saysLn [[var], "' <- QtahP.fmap QtahFHR.coerceIntegral $ qColor_", get, " this'"]+ saysLn [[var], "' <- QtahP.fmap QtahFHR.coerceIntegral $ ", get, " this'"] saysLn $ ["QtahP.return $ HColor.", spec] ++ map (\var -> [' ', var, '\'']) letters }
src/Graphics/UI/Qtah/Generator/Interface/Gui/QDoubleValidator.hs view
@@ -24,6 +24,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,13 +32,13 @@ mkCtor, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (doubleT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Flag (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Gui.QValidator (c_QValidator)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -52,19 +53,18 @@ c_QDoubleValidator = addReqIncludes [includeStd "QDoubleValidator"] $- makeClass (ident "QDoubleValidator") Nothing [c_QValidator]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QObject]- , mkCtor "newWithOptions" [doubleT, doubleT, intT]- , mkCtor "newWithOptionsAndParent" [doubleT, doubleT, intT, ptrT $ objT c_QObject]- ] $- [ mkMethod' "setRange" "setRange" [doubleT, doubleT] voidT- , mkMethod' "setRange" "setRangeAndDecimals" [doubleT, doubleT, intT] voidT- ] ++- (mkProps . collect)- [ just $ mkProp "bottom" doubleT+ classSetEntityPrefix "" $+ makeClass (ident "QDoubleValidator") Nothing [c_QValidator] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QObject]+ , just $ mkCtor "newWithOptions" [doubleT, doubleT, intT]+ , just $ mkCtor "newWithOptionsAndParent" [doubleT, doubleT, intT, ptrT $ objT c_QObject]+ , just $ mkProp "bottom" doubleT , just $ mkProp "decimals" intT , test (qtVersion >= [4, 3]) $ mkProp "notation" $ enumT e_Notation+ , just $ mkMethod' "setRange" "setRange" [doubleT, doubleT] voidT+ , just $ mkMethod' "setRange" "setRangeAndDecimals" [doubleT, doubleT, intT] voidT , just $ mkProp "top" doubleT ]
src/Graphics/UI/Qtah/Generator/Interface/Gui/QEnterEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,6 +32,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent) import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint) import Graphics.UI.Qtah.Generator.Interface.Core.QPointF (c_QPointF)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -44,10 +46,10 @@ c_QEnterEvent = addReqIncludes [includeStd "QEnterEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QEnterEvent") Nothing [c_QEvent] [ mkCtor "new" [objT c_QPointF, objT c_QPointF, objT c_QPointF]- ]- [ mkConstMethod "globalPos" [] $ objT c_QPoint+ , mkConstMethod "globalPos" [] $ objT c_QPoint , mkConstMethod "globalX" [] intT , mkConstMethod "globalY" [] intT , mkConstMethod "localPos" [] $ objT c_QPointF
src/Graphics/UI/Qtah/Generator/Interface/Gui/QExposeEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,6 +31,7 @@ import Foreign.Hoppy.Generator.Types (objT) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent) import Graphics.UI.Qtah.Generator.Interface.Gui.QRegion (c_QRegion)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -43,8 +45,8 @@ c_QExposeEvent = addReqIncludes [includeStd "QExposeEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QExposeEvent") Nothing [c_QEvent] [ mkCtor "new" [objT c_QRegion]- ]- [ mkConstMethod "region" [] $ objT c_QRegion+ , mkConstMethod "region" [] $ objT c_QRegion ]
src/Graphics/UI/Qtah/Generator/Interface/Gui/QFocusEvent.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,6 +32,7 @@ import Foreign.Hoppy.Generator.Types (boolT, enumT) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent, e_Type) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_FocusReason)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -43,10 +45,10 @@ c_QFocusEvent = addReqIncludes [includeStd "QFocusEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QFocusEvent") Nothing [c_QEvent] [ mkCtor "new" [enumT e_Type, enumT e_FocusReason]- ] $- [ mkConstMethod "gotFocus" [] boolT+ , mkConstMethod "gotFocus" [] boolT , mkConstMethod "lostFocus" [] boolT , mkConstMethod "reason" [] $ enumT e_FocusReason ]
src/Graphics/UI/Qtah/Generator/Interface/Gui/QHideEvent.hs view
@@ -22,12 +22,14 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkCtor, ) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -40,7 +42,7 @@ c_QHideEvent = addReqIncludes [includeStd "QHideEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QHideEvent") Nothing [c_QEvent] [ mkCtor "new" [] ]- []
src/Graphics/UI/Qtah/Generator/Interface/Gui/QHoverEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -35,6 +36,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QPointF (c_QPointF) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_KeyboardModifiers) import Graphics.UI.Qtah.Generator.Interface.Gui.QInputEvent (c_QInputEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -47,16 +49,15 @@ c_QHoverEvent = addReqIncludes [includeStd "QHoverEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QHoverEvent") Nothing- [if qtVersion >= [5, 0] then c_QInputEvent else c_QEvent]- (collect- [ test (qtVersion < [5, 0]) $ mkCtor "new" [enumT e_Type, objT c_QPoint, objT c_QPoint]- , test (qtVersion >= [5, 0]) $ mkCtor "new" [enumT e_Type, objT c_QPointF, objT c_QPointF]- , test (qtVersion >= [5, 0]) $ mkCtor "newWithModifiers"- [enumT e_Type, objT c_QPointF, objT c_QPointF, bitspaceT bs_KeyboardModifiers]- ]) $+ [if qtVersion >= [5, 0] then c_QInputEvent else c_QEvent] $ collect- [ just $ mkConstMethod "oldPos" [] $ objT c_QPoint+ [ test (qtVersion < [5, 0]) $ mkCtor "new" [enumT e_Type, objT c_QPoint, objT c_QPoint]+ , test (qtVersion >= [5, 0]) $ mkCtor "new" [enumT e_Type, objT c_QPointF, objT c_QPointF]+ , test (qtVersion >= [5, 0]) $ mkCtor "newWithModifiers"+ [enumT e_Type, objT c_QPointF, objT c_QPointF, bitspaceT bs_KeyboardModifiers]+ , just $ mkConstMethod "oldPos" [] $ objT c_QPoint , test (qtVersion >= [5, 0]) $ mkConstMethod "oldPosF" [] $ objT c_QPointF , just $ mkConstMethod "pos" [] $ objT c_QPoint , test (qtVersion >= [5, 0]) $ mkConstMethod "posF" [] $ objT c_QPointF
src/Graphics/UI/Qtah/Generator/Interface/Gui/QInputEvent.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -32,6 +33,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_KeyboardModifiers)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -44,8 +46,8 @@ c_QInputEvent = addReqIncludes [includeStd "QInputEvent"] $- makeClass (ident "QInputEvent") Nothing [c_QEvent]- [] $+ classSetEntityPrefix "" $+ makeClass (ident "QInputEvent") Nothing [c_QEvent] $ collect [ just $ mkConstMethod "modifiers" [] $ bitspaceT bs_KeyboardModifiers , test (qtVersion >= [5, 0]) $ mkConstMethod "timestamp" [] ulongT
src/Graphics/UI/Qtah/Generator/Interface/Gui/QIntValidator.hs view
@@ -23,17 +23,18 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Gui.QValidator (c_QValidator)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -45,15 +46,13 @@ c_QIntValidator = addReqIncludes [includeStd "QIntValidator"] $+ classSetEntityPrefix "" $ makeClass (ident "QIntValidator") Nothing [c_QValidator] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QObject] , mkCtor "newWithOptions" [intT, intT] , mkCtor "newWithOptionsAndParent" [intT, intT, ptrT $ objT c_QObject]- ] $- [ mkMethod "setRange" [intT, intT] voidT- ] ++- mkProps- [ mkProp "bottom" intT+ , mkProp "bottom" intT+ , mkMethod "setRange" [intT, intT] voidT , mkProp "top" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Gui/QKeyEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -34,6 +35,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_KeyboardModifiers) import Graphics.UI.Qtah.Generator.Interface.Gui.QInputEvent (c_QInputEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -46,19 +48,18 @@ c_QKeyEvent = addReqIncludes [includeStd "QKeyEvent"] $- makeClass (ident "QKeyEvent") Nothing [c_QInputEvent]- (collect- [ just $ mkCtor "new" [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers]- , just $ mkCtor "newWithText"- [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers, objT c_QString, boolT, ushortT]- , test (qtVersion >= [5, 0]) $ mkCtor "newNative"- [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers, word32T, word32T, word32T]- , test (qtVersion >= [5, 0]) $ mkCtor "newNativeWithText"- [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers, word32T, word32T, word32T,- objT c_QString, boolT, ushortT]- ]) $+ classSetEntityPrefix "" $+ makeClass (ident "QKeyEvent") Nothing [c_QInputEvent] $ collect- [ just $ mkConstMethod "count" [] intT+ [ just $ mkCtor "new" [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers]+ , just $ mkCtor "newWithText"+ [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers, objT c_QString, boolT, ushortT]+ , test (qtVersion >= [5, 0]) $ mkCtor "newNative"+ [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers, word32T, word32T, word32T]+ , test (qtVersion >= [5, 0]) $ mkCtor "newNativeWithText"+ [enumT e_Type, intT, bitspaceT bs_KeyboardModifiers, word32T, word32T, word32T,+ objT c_QString, boolT, ushortT]+ , just $ mkConstMethod "count" [] intT , just $ mkConstMethod "isAutoRepeat" [] boolT , just $ mkConstMethod "key" [] intT -- TODO matches (>=4.2)
src/Graphics/UI/Qtah/Generator/Interface/Gui/QMouseEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -41,6 +42,7 @@ e_MouseEventSource, ) import Graphics.UI.Qtah.Generator.Interface.Gui.QInputEvent (c_QInputEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -53,27 +55,26 @@ c_QMouseEvent = addReqIncludes [includeStd "QMouseEvent"] $- makeClass (ident "QMouseEvent") Nothing [c_QInputEvent]- (collect- [ test (qtVersion < [5, 0]) $ mkCtor "new"- [enumT e_Type, objT c_QPoint, enumT e_MouseButton, bitspaceT bs_MouseButtons,- bitspaceT bs_KeyboardModifiers]- , test (qtVersion < [5, 0]) $ mkCtor "newWithGlobalPosition"- [enumT e_Type, objT c_QPoint, objT c_QPoint, enumT e_MouseButton, bitspaceT bs_MouseButtons,- bitspaceT bs_KeyboardModifiers]-- , test (qtVersion >= [5, 0]) $ mkCtor "new"- [enumT e_Type, objT c_QPointF, enumT e_MouseButton, bitspaceT bs_MouseButtons,- bitspaceT bs_KeyboardModifiers]- , test (qtVersion >= [5, 0]) $ mkCtor "newWithScreenPosition"- [enumT e_Type, objT c_QPointF, objT c_QPointF, enumT e_MouseButton, bitspaceT bs_MouseButtons,- bitspaceT bs_KeyboardModifiers]- , test (qtVersion >= [5, 0]) $ mkCtor "newWithWindowAndScreenPosition"- [enumT e_Type, objT c_QPointF, objT c_QPointF, objT c_QPointF, enumT e_MouseButton,- bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers]- ]) $+ classSetEntityPrefix "" $+ makeClass (ident "QMouseEvent") Nothing [c_QInputEvent] $ collect- [ just $ mkConstMethod "button" [] $ enumT e_MouseButton+ [ test (qtVersion < [5, 0]) $ mkCtor "new"+ [enumT e_Type, objT c_QPoint, enumT e_MouseButton, bitspaceT bs_MouseButtons,+ bitspaceT bs_KeyboardModifiers]+ , test (qtVersion < [5, 0]) $ mkCtor "newWithGlobalPosition"+ [enumT e_Type, objT c_QPoint, objT c_QPoint, enumT e_MouseButton, bitspaceT bs_MouseButtons,+ bitspaceT bs_KeyboardModifiers]++ , test (qtVersion >= [5, 0]) $ mkCtor "new"+ [enumT e_Type, objT c_QPointF, enumT e_MouseButton, bitspaceT bs_MouseButtons,+ bitspaceT bs_KeyboardModifiers]+ , test (qtVersion >= [5, 0]) $ mkCtor "newWithScreenPosition"+ [enumT e_Type, objT c_QPointF, objT c_QPointF, enumT e_MouseButton, bitspaceT bs_MouseButtons,+ bitspaceT bs_KeyboardModifiers]+ , test (qtVersion >= [5, 0]) $ mkCtor "newWithWindowAndScreenPosition"+ [enumT e_Type, objT c_QPointF, objT c_QPointF, objT c_QPointF, enumT e_MouseButton,+ bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers]+ , just $ mkConstMethod "button" [] $ enumT e_MouseButton , just $ mkConstMethod "buttons" [] $ bitspaceT bs_MouseButtons , test (qtVersion >= [5, 3]) $ mkConstMethod "flags" [] $ bitspaceT bs_MouseEventFlags , just $ mkConstMethod "globalPos" [] $ objT c_QPoint
src/Graphics/UI/Qtah/Generator/Interface/Gui/QPolygon.hs view
@@ -24,6 +24,7 @@ Export (ExportClass), addReqIncludes, classSetConversionToGc,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -44,6 +45,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect) import Graphics.UI.Qtah.Generator.Interface.Core.QVector (c_QVectorQPoint) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_FillRule)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -55,16 +57,16 @@ c_QPolygon = addReqIncludes [includeStd "QPolygon"] $- classAddFeatures [Assignable, Copyable, Equatable] $ classSetConversionToGc $- makeClass (ident "QPolygon") Nothing [c_QVectorQPoint]- [ mkCtor "new" []- , mkCtor "newWithSize" [intT]- , mkCtor "newWithPoints" [objT c_QVectorQPoint]- , mkCtor "newWithRectangle" [objT c_QRect, boolT]- ] $+ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QPolygon") Nothing [c_QVectorQPoint] $ collect- [ just $ mkConstMethod "boundingRect" [] $ objT c_QRect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithSize" [intT]+ , just $ mkCtor "newWithPoints" [objT c_QVectorQPoint]+ , just $ mkCtor "newWithRectangle" [objT c_QRect, boolT]+ , just $ mkConstMethod "boundingRect" [] $ objT c_QRect , test (qtVersion >= [4, 3]) $ mkConstMethod "containsPoint" [objT c_QPoint, enumT e_FillRule] boolT , test (qtVersion >= [4, 3]) $ mkConstMethod "intersected" [objT c_QPolygon] $ objT c_QPolygon
src/Graphics/UI/Qtah/Generator/Interface/Gui/QPolygonF.hs view
@@ -23,6 +23,7 @@ Export (ExportClass), addReqIncludes, classSetConversionToGc,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -44,6 +45,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QVector (c_QVectorQPointF) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_FillRule) import Graphics.UI.Qtah.Generator.Interface.Gui.QPolygon (c_QPolygon)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -55,17 +57,17 @@ c_QPolygonF = addReqIncludes [includeStd "QPolygonF"] $- classAddFeatures [Assignable, Copyable, Equatable] $ classSetConversionToGc $- makeClass (ident "QPolygonF") Nothing [c_QVectorQPointF]- [ mkCtor "new" []- , mkCtor "newWithSize" [intT]- , mkCtor "newWithPoints" [objT c_QVectorQPointF]- , mkCtor "newWithPolygon" [objT c_QPolygon]- , mkCtor "newWithRectangle" [objT c_QRectF]- ] $+ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QPolygonF") Nothing [c_QVectorQPointF] $ collect- [ just $ mkConstMethod "boundingRect" [] $ objT c_QRectF+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithSize" [intT]+ , just $ mkCtor "newWithPoints" [objT c_QVectorQPointF]+ , just $ mkCtor "newWithPolygon" [objT c_QPolygon]+ , just $ mkCtor "newWithRectangle" [objT c_QRectF]+ , just $ mkConstMethod "boundingRect" [] $ objT c_QRectF , test (qtVersion >= [4, 3]) $ mkConstMethod "containsPoint" [objT c_QPointF, enumT e_FillRule] boolT , test (qtVersion >= [4, 3]) $ mkConstMethod "intersected" [objT c_QPolygonF] $ objT c_QPolygonF
src/Graphics/UI/Qtah/Generator/Interface/Gui/QRegion.hs view
@@ -24,6 +24,7 @@ Export (ExportClass, ExportEnum), addReqIncludes, classSetConversionToGc,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -43,6 +44,7 @@ import Graphics.UI.Qtah.Generator.Flags (qtVersion) 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.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -56,17 +58,17 @@ c_QRegion = addReqIncludes [includeStd "QRegion"] $- classAddFeatures [Assignable, Copyable, Equatable] $ classSetConversionToGc $- makeClass (ident "QRegion") Nothing []- [ mkCtor "new" []- , mkCtor "newFromPoints" [intT, intT, intT, intT, enumT e_RegionType]+ classAddFeatures [Assignable, Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QRegion") Nothing [] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newFromPoints" [intT, intT, intT, intT, enumT e_RegionType] -- TODO newFromPolygon (needs QPolygon) -- TODO newFromBitmap (needs QBitmap)- , mkCtor "newFromRect" [objT c_QRect, enumT e_RegionType]- ] $- collect- [ just $ mkConstMethod "boundingRect" [] $ objT c_QRect+ , just $ mkCtor "newFromRect" [objT c_QRect, enumT e_RegionType]+ , just $ mkConstMethod "boundingRect" [] $ objT c_QRect , just $ mkConstMethod' "contains" "containsPoint" [objT c_QPoint] boolT , just $ mkConstMethod' "contains" "containsRect" [objT c_QRect] boolT , test (qtVersion >= [4, 2]) $
src/Graphics/UI/Qtah/Generator/Interface/Gui/QShowEvent.hs view
@@ -22,12 +22,14 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkCtor, ) import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -40,7 +42,7 @@ c_QShowEvent = addReqIncludes [includeStd "QShowEvent"] $+ classSetEntityPrefix "" $ makeClass (ident "QShowEvent") Nothing [c_QEvent] [ mkCtor "new" [] ]- []
src/Graphics/UI/Qtah/Generator/Interface/Gui/QValidator.hs view
@@ -24,6 +24,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -33,7 +34,8 @@ import Foreign.Hoppy.Generator.Types (enumT, intT, objT, refT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_Listener)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -47,7 +49,8 @@ c_QValidator = addReqIncludes [includeStd "QValidator"] $- makeClass (ident "QValidator") Nothing [c_QObject] [] $+ classSetEntityPrefix "" $+ makeClass (ident "QValidator") Nothing [c_QObject] $ [ mkConstMethod "fixup" [refT $ objT c_QString] voidT -- TODO locale -- TODO setLocale
src/Graphics/UI/Qtah/Generator/Interface/Gui/QWheelEvent.hs view
@@ -21,6 +21,7 @@ import Foreign.Hoppy.Generator.Spec ( addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -39,6 +40,7 @@ e_ScrollPhase, ) import Graphics.UI.Qtah.Generator.Interface.Gui.QInputEvent (c_QInputEvent)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -51,24 +53,23 @@ c_QWheelEvent = addReqIncludes [includeStd "QWheelEvent"] $- makeClass (ident "QWheelEvent") Nothing [c_QInputEvent]- (collect- [ test (qtVersion < [5, 0]) $ mkCtor "new"- [objT c_QPoint, intT, bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers,- enumT e_Orientation]- , test (qtVersion < [5, 0]) $ mkCtor "newWithGlobalPosition"- [objT c_QPoint, objT c_QPoint, intT, bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers,- enumT e_Orientation]-- , test (qtVersion >= [5, 0]) $ mkCtor "new"- [objT c_QPointF, objT c_QPointF, objT c_QPoint, objT c_QPoint, intT, enumT e_Orientation,- bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers]- , test (qtVersion >= [5, 2]) $ mkCtor "newWithPhase"- [objT c_QPointF, objT c_QPointF, objT c_QPoint, objT c_QPoint, intT, enumT e_Orientation,- bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers, enumT e_ScrollPhase]- ]) $+ classSetEntityPrefix "" $+ makeClass (ident "QWheelEvent") Nothing [c_QInputEvent] $ collect- [ test (qtVersion >= [5, 0]) $ mkConstMethod "angleDelta" [] $ objT c_QPoint+ [ test (qtVersion < [5, 0]) $ mkCtor "new"+ [objT c_QPoint, intT, bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers,+ enumT e_Orientation]+ , test (qtVersion < [5, 0]) $ mkCtor "newWithGlobalPosition"+ [objT c_QPoint, objT c_QPoint, intT, bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers,+ enumT e_Orientation]++ , test (qtVersion >= [5, 0]) $ mkCtor "new"+ [objT c_QPointF, objT c_QPointF, objT c_QPoint, objT c_QPoint, intT, enumT e_Orientation,+ bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers]+ , test (qtVersion >= [5, 2]) $ mkCtor "newWithPhase"+ [objT c_QPointF, objT c_QPointF, objT c_QPoint, objT c_QPoint, intT, enumT e_Orientation,+ bitspaceT bs_MouseButtons, bitspaceT bs_KeyboardModifiers, enumT e_ScrollPhase]+ , test (qtVersion >= [5, 0]) $ mkConstMethod "angleDelta" [] $ objT c_QPoint , just $ mkConstMethod "buttons" [] $ bitspaceT bs_MouseButtons , test (qtVersion < [5, 0]) $ mkConstMethod "delta" [] intT , just $ mkConstMethod "globalPos" [] $ objT c_QPoint
+ src/Graphics/UI/Qtah/Generator/Interface/Internal.hs view
@@ -0,0 +1,32 @@+-- This file is part of Qtah.+--+-- Copyright 2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.Internal (modules) where++import qualified Graphics.UI.Qtah.Generator.Interface.Internal.Callback as Callback+import qualified Graphics.UI.Qtah.Generator.Interface.Internal.EventListener as EventListener+import qualified Graphics.UI.Qtah.Generator.Interface.Internal.Listener as Listener+import Graphics.UI.Qtah.Generator.Module (AModule)++{-# ANN module "HLint: ignore Use camelCase" #-}++modules :: [AModule]+modules =+ [ Callback.aModule+ , EventListener.aModule+ , Listener.aModule+ ]
+ src/Graphics/UI/Qtah/Generator/Interface/Internal/Callback.hs view
@@ -0,0 +1,138 @@+-- This file is part of Qtah.+--+-- Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.Internal.Callback where++import Foreign.Hoppy.Generator.Spec (+ Export (ExportCallback),+ makeCallback,+ makeModule,+ moduleAddExports,+ moduleAddHaskellName,+ moduleModify',+ toExtName,+ )+import Foreign.Hoppy.Generator.Types (boolT, doubleT, enumT, intT, objT, ptrT, voidT)+import Graphics.UI.Qtah.Generator.Interface.Core.QEvent (c_QEvent)+import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)+import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint)+import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize)+import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)+import {-# SOURCE #-} qualified Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard as QClipboard+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (+ c_QAbstractButton,+ )+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider (+ e_SliderAction,+ )+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction)+import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)+import Graphics.UI.Qtah.Generator.Module (AModule (AHoppyModule))++{-# ANN module "HLint: ignore Use camelCase" #-}++aModule =+ AHoppyModule $+ moduleModify' (makeModule "callback" "b_callback.hpp" "b_callback.cpp") $ do+ moduleAddHaskellName ["Internal", "Callback"]+ moduleAddExports+ [ ExportCallback cb_BoolVoid+ , ExportCallback cb_DoubleVoid+ , ExportCallback cb_IntVoid+ , ExportCallback cb_IntBoolVoid+ , ExportCallback cb_IntIntVoid+ , ExportCallback cb_PtrQAbstractButtonVoid+ , ExportCallback cb_PtrQAbstractButtonBoolVoid+ , ExportCallback cb_PtrQActionVoid+ , ExportCallback cb_PtrQObjectPtrQEventBool+ , ExportCallback cb_PtrQObjectVoid+ , ExportCallback cb_PtrQWidgetPtrQWidgetVoid+ , ExportCallback cb_QAbstractSliderActionVoid+ , ExportCallback cb_QClipboardModeVoid+ , ExportCallback cb_QPointVoid+ , ExportCallback cb_QSizeVoid+ , ExportCallback cb_QStringVoid+ , ExportCallback cb_Void+ ]++cb_BoolVoid =+ makeCallback (toExtName "CallbackBoolVoid")+ [boolT] voidT++cb_DoubleVoid =+ makeCallback (toExtName "CallbackDoubleVoid")+ [doubleT] voidT++cb_IntVoid =+ makeCallback (toExtName "CallbackIntVoid")+ [intT] voidT++cb_IntBoolVoid =+ makeCallback (toExtName "CallbackIntBoolVoid")+ [intT, boolT] voidT++cb_IntIntVoid =+ makeCallback (toExtName "CallbackIntIntVoid")+ [intT, intT] voidT++cb_PtrQAbstractButtonVoid =+ makeCallback (toExtName "CallbackPtrQAbstractButtonVoid")+ [ptrT $ objT c_QAbstractButton] voidT++cb_PtrQAbstractButtonBoolVoid =+ makeCallback (toExtName "CallbackPtrQAbstractButtonBoolVoid")+ [ptrT $ objT c_QAbstractButton, boolT] voidT++cb_PtrQActionVoid =+ makeCallback (toExtName "CallbackPtrQActionVoid")+ [ptrT $ objT c_QAction] voidT++cb_PtrQObjectPtrQEventBool =+ makeCallback (toExtName "CallbackPtrQObjectPtrQEventBool")+ [ptrT $ objT c_QObject, ptrT $ objT c_QEvent] boolT++cb_PtrQObjectVoid =+ makeCallback (toExtName "CallbackPtrQObjectVoid")+ [ptrT $ objT c_QObject] voidT++cb_PtrQWidgetPtrQWidgetVoid =+ makeCallback (toExtName "CallbackPtrQWidgetPtrQWidgetVoid")+ [ptrT $ objT c_QWidget, ptrT $ objT c_QWidget] voidT++cb_QAbstractSliderActionVoid =+ makeCallback (toExtName "CallbackQAbstractSliderActionVoid")+ [enumT e_SliderAction] voidT++cb_QClipboardModeVoid =+ makeCallback (toExtName "CallbackQClipboardModeVoid")+ [enumT QClipboard.e_Mode] voidT++cb_QPointVoid =+ makeCallback (toExtName "CallbackQPointVoid")+ [objT c_QPoint] voidT++cb_QSizeVoid =+ makeCallback (toExtName "CallbackQSizeVoid")+ [objT c_QSize] voidT++cb_QStringVoid =+ makeCallback (toExtName "CallbackQStringVoid")+ [objT c_QString] voidT++cb_Void =+ makeCallback (toExtName "CallbackVoid")+ [] voidT
+ src/Graphics/UI/Qtah/Generator/Interface/Internal/EventListener.hs view
@@ -0,0 +1,49 @@+-- This file is part of Qtah.+--+-- Copyright 2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.Internal.EventListener (+ aModule,+ ) where++import Foreign.Hoppy.Generator.Spec (+ Export (ExportClass),+ addReqIncludes,+ classSetEntityPrefix,+ ident2,+ includeLocal,+ makeClass,+ mkCtor,+ )+import Foreign.Hoppy.Generator.Types (callbackT, intT, ptrT)+import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)+import Graphics.UI.Qtah.Generator.Interface.Internal.Callback (cb_PtrQObjectPtrQEventBool)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)+import Graphics.UI.Qtah.Generator.Types++{-# ANN module "HLint: ignore Use camelCase" #-}++aModule =+ AQtModule $+ makeQtModule ["Internal", "EventListener"]+ [ QtExport $ ExportClass c_EventListener ]++c_EventListener =+ addReqIncludes [includeLocal "event.hpp"] $+ classSetEntityPrefix "" $+ makeClass (ident2 "qtah" "event" "EventListener") Nothing [c_QObject]+ [ mkCtor "new" [callbackT cb_PtrQObjectPtrQEventBool, ptrT intT]+ ]
+ src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs view
@@ -0,0 +1,181 @@+---------- GENERATED FILE, EDITS WILL BE LOST ----------++module Graphics.UI.Qtah.Generator.Interface.Internal.Listener where++import qualified Foreign.Hoppy.Generator.Spec as S+import qualified Foreign.Hoppy.Generator.Types as S+import qualified Foreign.Hoppy.Generator.Std.String as String+import qualified Graphics.UI.Qtah.Generator.Module as M+import qualified Graphics.UI.Qtah.Generator.Interface.Core.QObject as QObject+import qualified Graphics.UI.Qtah.Generator.Interface.Internal.Callback as C++{-# ANN module "HLint: ignore Use camelCase" #-}++c_ListenerBool =+ S.makeClass (S.ident "ListenerBool") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_BoolVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_BoolVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerDouble =+ S.makeClass (S.ident "ListenerDouble") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_DoubleVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_DoubleVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerInt =+ S.makeClass (S.ident "ListenerInt") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_IntVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_IntVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerIntBool =+ S.makeClass (S.ident "ListenerIntBool") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_IntBoolVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_IntBoolVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerIntInt =+ S.makeClass (S.ident "ListenerIntInt") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_IntIntVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_IntIntVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerPtrQAbstractButton =+ S.makeClass (S.ident "ListenerPtrQAbstractButton") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_PtrQAbstractButtonVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_PtrQAbstractButtonVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerPtrQAbstractButtonBool =+ S.makeClass (S.ident "ListenerPtrQAbstractButtonBool") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_PtrQAbstractButtonBoolVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_PtrQAbstractButtonBoolVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerPtrQAction =+ S.makeClass (S.ident "ListenerPtrQAction") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_PtrQActionVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_PtrQActionVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerPtrQObject =+ S.makeClass (S.ident "ListenerPtrQObject") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_PtrQObjectVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_PtrQObjectVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerPtrQWidgetPtrQWidget =+ S.makeClass (S.ident "ListenerPtrQWidgetPtrQWidget") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_PtrQWidgetPtrQWidgetVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_PtrQWidgetPtrQWidgetVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerQAbstractSliderAction =+ S.makeClass (S.ident "ListenerQAbstractSliderAction") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_QAbstractSliderActionVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_QAbstractSliderActionVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerQClipboardMode =+ S.makeClass (S.ident "ListenerQClipboardMode") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_QClipboardModeVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_QClipboardModeVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerQPoint =+ S.makeClass (S.ident "ListenerQPoint") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_QPointVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_QPointVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerQSize =+ S.makeClass (S.ident "ListenerQSize") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_QSizeVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_QSizeVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_ListenerQString =+ S.makeClass (S.ident "ListenerQString") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_QStringVoid]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_QStringVoid, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++c_Listener =+ S.makeClass (S.ident "Listener") Nothing [QObject.c_QObject]+ [ S.mkCtor "new" [S.callbackT C.cb_Void]+ , S.mkCtor "newWithParent"+ [S.callbackT C.cb_Void, S.ptrT $ S.objT QObject.c_QObject]+ , S.mkMethod "connectListener"+ [S.ptrT $ S.objT QObject.c_QObject, S.objT String.c_string] S.boolT+ ]++aModule :: M.AModule+aModule =+ M.AHoppyModule $+ S.addReqIncludes [S.includeLocal "listener.hpp"] $+ S.moduleModify' (S.makeModule "listener" "b_listener.hpp" "b_listener.cpp") $ do+ S.moduleAddHaskellName ["Internal", "Listener"]+ S.moduleAddExports+ [ S.ExportClass c_ListenerBool+ , S.ExportClass c_ListenerDouble+ , S.ExportClass c_ListenerInt+ , S.ExportClass c_ListenerIntBool+ , S.ExportClass c_ListenerIntInt+ , S.ExportClass c_ListenerPtrQAbstractButton+ , S.ExportClass c_ListenerPtrQAbstractButtonBool+ , S.ExportClass c_ListenerPtrQAction+ , S.ExportClass c_ListenerPtrQObject+ , S.ExportClass c_ListenerPtrQWidgetPtrQWidget+ , S.ExportClass c_ListenerQAbstractSliderAction+ , S.ExportClass c_ListenerQClipboardMode+ , S.ExportClass c_ListenerQPoint+ , S.ExportClass c_ListenerQSize+ , S.ExportClass c_ListenerQString+ , S.ExportClass c_Listener+ ]
+ src/Graphics/UI/Qtah/Generator/Interface/Internal/Listener.hs-boot view
@@ -0,0 +1,22 @@+---------- GENERATED FILE, EDITS WILL BE LOST ----------++module Graphics.UI.Qtah.Generator.Interface.Internal.Listener where++import Foreign.Hoppy.Generator.Spec (Class)++c_ListenerBool :: Class+c_ListenerDouble :: Class+c_ListenerInt :: Class+c_ListenerIntBool :: Class+c_ListenerIntInt :: Class+c_ListenerPtrQAbstractButton :: Class+c_ListenerPtrQAbstractButtonBool :: Class+c_ListenerPtrQAction :: Class+c_ListenerPtrQObject :: Class+c_ListenerPtrQWidgetPtrQWidget :: Class+c_ListenerQAbstractSliderAction :: Class+c_ListenerQClipboardMode :: Class+c_ListenerQPoint :: Class+c_ListenerQSize :: Class+c_ListenerQString :: Class+c_Listener :: Class
− src/Graphics/UI/Qtah/Generator/Interface/Listener.hs
src/Graphics/UI/Qtah/Generator/Interface/Widgets.hs view
@@ -37,6 +37,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QGridLayout as QGridLayout import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QGroupBox as QGroupBox import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QHBoxLayout as QHBoxLayout+import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QInputDialog as QInputDialog import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QLabel as QLabel import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout as QLayout import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QLayoutItem as QLayoutItem@@ -51,7 +52,9 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QRubberBand as QRubberBand import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QScrollArea as QScrollArea import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QScrollBar as QScrollBar+import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QSizePolicy as QSizePolicy import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QSlider as QSlider+import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QSpacerItem as QSpacerItem import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QSpinBox as QSpinBox import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QSplitter as QSplitter import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QStackedLayout as QStackedLayout@@ -61,7 +64,7 @@ import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QTextEdit as QTextEdit import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QVBoxLayout as QVBoxLayout import qualified Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget as QWidget-import Graphics.UI.Qtah.Generator.Types+import Graphics.UI.Qtah.Generator.Module (AModule) {-# ANN module "HLint: ignore Use camelCase" #-} @@ -87,6 +90,7 @@ , QGridLayout.aModule , QGroupBox.aModule , QHBoxLayout.aModule+ , QInputDialog.aModule , QLabel.aModule , QLayout.aModule , QLayoutItem.aModule@@ -101,7 +105,9 @@ , QRubberBand.aModule , QScrollArea.aModule , QScrollBar.aModule+ , QSizePolicy.aModule , QSlider.aModule+ , QSpacerItem.aModule , QSpinBox.aModule , QSplitter.aModule , QStackedLayout.aModule
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractButton.hs view
@@ -23,19 +23,20 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkBoolIsProp, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, intT, objT, 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.Listener (c_Listener, c_ListenerBool)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener, c_ListenerBool) 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" #-}@@ -48,26 +49,25 @@ c_QAbstractButton = addReqIncludes [includeStd "QAbstractButton"] $+ classSetEntityPrefix "" $ makeClass (ident "QAbstractButton") Nothing- [ c_QWidget ]- [] $ -- Abstact.+ [ c_QWidget ] $+ -- Abstact. [ mkMethod "animateClick" [intT] voidT- , mkMethod "click" [] voidT- -- TODO group- , mkMethod "toggle" [] voidT- ] ++- mkProps- [ mkProp "autoExclusive" boolT+ , mkProp "autoExclusive" boolT , mkProp "autoRepeat" boolT , mkProp "autoRepeatDelay" intT , mkProp "autoRepeatInterval" intT , mkBoolIsProp "checkable" , mkBoolIsProp "checked"+ , mkMethod "click" [] voidT , mkBoolIsProp "down"+ -- TODO group -- TODO icon , mkProp "iconSize" $ objT c_QSize -- TODO shortcut , mkProp "text" $ objT c_QString+ , mkMethod "toggle" [] voidT ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractScrollArea.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,12 +31,12 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, enumT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment, e_ScrollBarPolicy) 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" #-}@@ -47,18 +48,16 @@ c_QAbstractScrollArea = addReqIncludes [includeStd "QAbstractScrollArea"] $+ classSetEntityPrefix "" $ makeClass (ident "QAbstractScrollArea") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkMethod "addScrollBarWidget" [ptrT $ objT c_QWidget, bitspaceT bs_Alignment] voidT- , mkConstMethod "maximumViewportSize" [] $ objT c_QSize- -- TODO scrollBarWidgets- ] ++- mkProps- [ mkProp "cornerWidget" $ ptrT $ objT c_QWidget+ , mkMethod "addScrollBarWidget" [ptrT $ objT c_QWidget, bitspaceT bs_Alignment] voidT+ , mkProp "cornerWidget" $ ptrT $ objT c_QWidget -- TODO horizontalScrollBar , mkProp "horizontalScrollBarPolicy" $ enumT e_ScrollBarPolicy+ , mkConstMethod "maximumViewportSize" [] $ objT c_QSize+ -- TODO scrollBarWidgets -- TODO verticalScrollBar , mkProp "verticalScrollBarPolicy" $ enumT e_ScrollBarPolicy , mkProp "viewport" $ ptrT $ objT c_QWidget
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractSlider.hs view
@@ -24,6 +24,8 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix,+ enumSetValuePrefix, ident, ident1, includeStd,@@ -34,18 +36,18 @@ mkCtor, mkMethod, mkProp,- mkProps, toExtName, ) import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_Orientation)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_Listener, c_ListenerInt, c_ListenerIntInt, c_ListenerQAbstractSliderAction, ) 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" #-}@@ -59,14 +61,11 @@ c_QAbstractSlider = addReqIncludes [includeStd "QAbstractSlider"] $+ classSetEntityPrefix "" $ makeClass (ident "QAbstractSlider") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkMethod "triggerAction" [enumT e_SliderAction] voidT- ] ++- mkProps- [ mkProp "invertedAppearance" boolT+ , mkProp "invertedAppearance" boolT , mkProp "invertedControls" boolT , mkProp "maximum" intT , mkProp "minimum" intT@@ -76,6 +75,7 @@ , mkBoolIsProp "sliderDown" , mkProp "sliderPosition" intT , mkBoolHasProp "tracking"+ , mkMethod "triggerAction" [enumT e_SliderAction] voidT , mkProp "value" intT ] @@ -88,18 +88,18 @@ , makeSignal c_QAbstractSlider "valueChanged" c_ListenerInt ] --- This uses 'makeEnum' rather than 'makeQtEnum' and also drops a "Slider"--- prefix off of the start of each value name, unlike most Qt enums, because--- 'QAbstractSliderSliderAction_SliderNoAction' is a tad too repetetive.+-- This uses 'makeEnum' rather than 'makeQtEnum' in order to use the external+-- name of "QAbstractSliderAction" instead of "QAbstractSliderSliderAction". e_SliderAction = addReqIncludes [includeStd "QAbstractSlider"] $+ enumSetValuePrefix "" $ makeEnum (ident1 "QAbstractSlider" "SliderAction") (Just $ toExtName "QAbstractSliderAction")- [ (0, ["no", "action"])- , (1, ["single", "step", "add"])- , (2, ["single", "step", "sub"])- , (3, ["page", "step", "add"])- , (4, ["page", "step", "sub"])- , (5, ["to", "minimum"])- , (6, ["to", "maximum"])- , (7, ["move"])+ [ (0, ["slider", "no", "action"])+ , (1, ["slider", "single", "step", "add"])+ , (2, ["slider", "single", "step", "sub"])+ , (3, ["slider", "page", "step", "add"])+ , (4, ["slider", "page", "step", "sub"])+ , (5, ["slider", "to", "minimum"])+ , (6, ["slider", "to", "maximum"])+ , (7, ["slider", "move"]) ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAbstractSpinBox.hs view
@@ -27,6 +27,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportBitspace, ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -37,15 +38,15 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, intT, objT, ptrT, refT, voidT) import Graphics.UI.Qtah.Generator.Flag (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.Types (bs_Alignment)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_Listener)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener) 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" #-}@@ -64,32 +65,30 @@ c_QAbstractSpinBox = addReqIncludes [includeStd "QAbstractSpinBox"] $- makeClass (ident "QAbstractSpinBox") Nothing [c_QWidget]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QAbstractSpinBox") Nothing [c_QWidget] $ collect- [ just $ mkMethod "clear" [] voidT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , test (qtVersion >= [4, 2]) $ mkBoolIsProp "accelerated"+ , just $ mkProp "alignment" $ bitspaceT bs_Alignment+ , test (qtVersion >= [4, 2]) $ mkProp "buttonSymbols" $ enumT e_ButtonSymbols+ , just $ mkMethod "clear" [] voidT+ , just $ mkProp "correctionMode" $ enumT e_CorrectionMode , test (qtVersion >= [4, 2]) $ mkConstMethod "hasAcceptableInput" [] boolT , just $ mkConstMethod "fixup" [refT $ objT c_QString] voidT+ , test (qtVersion >= [4, 3]) $ mkBoolHasProp "frame"+ , test (qtVersion >= [5, 3]) $ mkBoolIsProp "groupSeparatorShown" , just $ mkMethod "interpretText" [] voidT+ , just $ mkProp "keyboardTracking" boolT+ , just $ mkBoolIsProp "readOnly" , just $ mkMethod "selectAll" [] voidT+ , just $ mkProp "specialValueText" $ objT c_QString , just $ mkMethod "stepBy" [intT] voidT , just $ mkMethod "stepDown" [] voidT , just $ mkMethod "stepUp" [] voidT , just $ mkConstMethod "text" [] $ objT c_QString -- TODO validate- ] ++- (mkProps . collect)- [ test (qtVersion >= [4, 2]) $ mkBoolIsProp "accelerated"- , just $ mkProp "alignment" $ bitspaceT bs_Alignment- , test (qtVersion >= [4, 2]) $ mkProp "buttonSymbols" $ enumT e_ButtonSymbols- , just $ mkProp "correctionMode" $ enumT e_CorrectionMode- , test (qtVersion >= [4, 3]) $ mkBoolHasProp "frame"- , just $ mkProp "keyboardTracking" boolT- , just $ mkBoolIsProp "readOnly"- , test (qtVersion >= [5, 3]) $ mkBoolIsProp "groupSeparatorShown"- , just $ mkProp "specialValueText" $ objT c_QString , just $ mkProp "wrapping" boolT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QAction.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -32,17 +33,17 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, enumT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Flag (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_Listener, c_ListenerBool)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener, c_ListenerBool) import Graphics.UI.Qtah.Generator.Interface.Widgets.QActionGroup (c_QActionGroup) import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenu (c_QMenu) 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" #-}@@ -61,46 +62,44 @@ c_QAction = addReqIncludes [includeStd "QAction"] $- makeClass (ident "QAction") Nothing- [ c_QObject ]- [ mkCtor "new" [ptrT $ objT c_QObject]- , mkCtor "newWithText" [objT c_QString, ptrT $ objT c_QObject]+ classSetEntityPrefix "" $+ makeClass (ident "QAction") Nothing [c_QObject] $+ collect+ [ just $ mkCtor "new" [ptrT $ objT c_QObject]+ , just $ mkCtor "newWithText" [objT c_QString, ptrT $ objT c_QObject] -- TODO newWithIconAndText- ] $- [ mkMethod "activate" [enumT e_ActionEvent] voidT+ , just $ mkProp "actionGroup" $ ptrT $ objT c_QActionGroup+ , just $ mkMethod "activate" [enumT e_ActionEvent] voidT -- TODO associatedGraphicsWidgets -- TODO associatedWidgets- , mkMethod "hover" [] voidT- , mkConstMethod "parentWidget" [] $ ptrT $ objT c_QWidget- , mkConstMethod "priority" [] $ enumT e_Priority- , mkMethod "setDisabled" [boolT] voidT- , mkMethod "setPriority" [enumT e_Priority] voidT- -- TODO setShortcuts- -- TODO shortcuts- , mkMethod "showStatusText" [ptrT $ objT c_QWidget] boolT- , mkMethod "toggle" [] voidT- , mkMethod "trigger" [] voidT- ] ++- (mkProps . collect)- [ just $ mkProp "actionGroup" $ ptrT $ objT c_QActionGroup , just $ mkProp "autoRepeat" boolT , just $ mkBoolIsProp "checkable" , just $ mkBoolIsProp "checked" -- TODO data , just $ mkBoolIsProp "enabled" -- TODO font+ , just $ mkMethod "hover" [] voidT -- TODO icon , just $ mkProp "iconText" $ objT c_QString , just $ mkBoolIsProp "iconVisibleInMenu" , just $ mkProp "menu" $ ptrT $ objT c_QMenu , just $ mkProp "menuRole" $ enumT e_MenuRole+ , just $ mkConstMethod "parentWidget" [] $ ptrT $ objT c_QWidget+ , just $ mkConstMethod "priority" [] $ enumT e_Priority , just $ mkBoolIsProp "separator"+ , just $ mkMethod "setDisabled" [boolT] voidT+ , just $ mkMethod "setPriority" [enumT e_Priority] voidT+ -- TODO setShortcuts -- TODO shortcut -- TODO shortcutContext+ -- TODO shortcuts+ , just $ mkMethod "showStatusText" [ptrT $ objT c_QWidget] boolT , test (qtVersion < [5]) $ mkProp "softKeyRole" $ enumT e_SoftKeyRole , just $ mkProp "statusTip" $ objT c_QString , just $ mkProp "text" $ objT c_QString+ , just $ mkMethod "toggle" [] voidT , just $ mkProp "toolTip" $ objT c_QString+ , just $ mkMethod "trigger" [] voidT , just $ mkBoolIsProp "visible" , just $ mkProp "whatsThis" $ objT c_QString ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QActionGroup.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,13 +32,13 @@ mkCtor, mkMethod, mkMethod',- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerPtrQAction)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerPtrQAction) import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -50,21 +51,19 @@ c_QActionGroup = addReqIncludes [includeStd "QActionGroup"] $+ classSetEntityPrefix "" $ makeClass (ident "QActionGroup") Nothing [ c_QObject ] [ mkCtor "new" [ptrT $ objT c_QObject]- ] $- [ -- TODO actions+ , -- TODO actions mkMethod' "addAction" "addAction" [ptrT $ objT c_QAction] $ ptrT $ objT c_QAction , mkMethod' "addAction" "addNewAction" [objT c_QString] $ ptrT $ objT c_QAction -- TODO addNewActionWithIcon , mkConstMethod "checkedAction" [] $ ptrT $ objT c_QAction+ , mkBoolIsProp "enabled"+ , mkBoolIsProp "exclusive" , mkMethod "removeAction" [ptrT $ objT c_QAction] voidT , mkMethod "setDisabled" [boolT] voidT- ] ++- mkProps- [ mkBoolIsProp "enabled"- , mkBoolIsProp "exclusive" , mkBoolIsProp "visible" ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QApplication.hs view
@@ -24,6 +24,7 @@ MethodApplicability (MStatic), Purity (Nonpure), addReqIncludes,+ classSetEntityPrefix, ident, ident1, ident2,@@ -33,7 +34,6 @@ makeClass, mkConstMethod, mkProp,- mkProps, mkStaticMethod, mkStaticMethod', mkStaticProp,@@ -49,8 +49,12 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QStringList (c_QStringList) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_LayoutDirection, e_NavigationMode) import Graphics.UI.Qtah.Generator.Interface.Gui.QClipboard (c_QClipboard)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_Listener, c_ListenerPtrQWidgetPtrQWidget)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (+ c_Listener,+ c_ListenerPtrQWidgetPtrQWidget,+ ) 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" #-}@@ -68,24 +72,32 @@ addReqIncludes [ includeStd "QApplication" , includeLocal "wrap_qapplication.hpp" ] $- makeClass (ident "QApplication") Nothing [c_QCoreApplication] [] $+ classSetEntityPrefix "" $+ makeClass (ident "QApplication") Nothing [c_QCoreApplication] $ collect [ just $ makeFnMethod (ident2 "qtah" "qapplication" "create") "new" MStatic Nonpure [objT c_QStringList] $ ptrT $ objT c_QApplication , just $ mkStaticMethod "aboutQt" [] voidT , just $ mkStaticMethod "activeModalWidget" [] $ ptrT $ objT c_QWidget , just $ mkStaticMethod "activePopupWidget" [] $ ptrT $ objT c_QWidget+ , just $ mkStaticProp "activeWindow" $ ptrT $ objT c_QWidget , just $ mkStaticMethod "alert" [ptrT $ objT c_QWidget, intT] voidT , just $ mkStaticMethod "allWidgets" [] $ objT c_QListQWidget+ , just $ mkProp "autoSipEnabled" boolT , just $ mkStaticMethod "beep" [] voidT -- TODO changeOverrideCursor , just $ mkStaticMethod "clipboard" [] $ ptrT $ objT c_QClipboard , just $ mkStaticMethod "closeAllWindows" [] voidT+ , just $ mkStaticProp "colorSpec" intT -- TODO commitData+ , just $ mkStaticProp "cursorFlashTime" intT -- TODO desktop+ , just $ mkStaticProp "desktopSettingsAware" boolT+ , just $ mkStaticProp "doubleClickInterval" intT , just $ mkStaticMethod "focusWidget" [] $ ptrT $ objT c_QWidget -- TODO font -- TODO fontMetrics+ , just $ mkStaticProp "globalStrut" $ objT c_QSize -- TODO inputContext -- TODO isEffectEnabled , just $ mkStaticMethod "isLeftToRight" [] boolT@@ -122,7 +134,10 @@ -- TODO setPalette , just $ mkStaticMethod "setQuitOnLastWindowClosed" [boolT] voidT -- TODO setStyle+ , just $ mkProp "startDragDistance" intT+ , just $ mkProp "startDragTime" intT -- TODO style+ , just $ mkProp "styleSheet" $ objT c_QString , test (qtVersion < [5]) $ mkStaticMethod "syncX" [] voidT -- TODO symbianEventFilter -- TODO symbianProcessEvent@@ -131,24 +146,12 @@ -- TODO topLevelWidgets -- We rename type() since @type@ is a Haskell keyword. , test (qtVersion < [5]) $ mkStaticMethod' "type" "applicationType" [] $ enumT e_Type+ , just $ mkStaticProp "wheelScrollLines" intT , just $ mkStaticMethod' "widgetAt" "widgetAtPoint" [objT c_QPoint] $ ptrT $ objT c_QWidget , just $ mkStaticMethod' "widgetAt" "widgetAtRaw" [intT, intT] $ ptrT $ objT c_QWidget+ -- TODO windowIcon -- TODO x11EventFilter -- TODO x11ProcessEvent- ] ++- mkProps- [ mkStaticProp "activeWindow" $ ptrT $ objT c_QWidget- , mkProp "autoSipEnabled" boolT- , mkStaticProp "colorSpec" intT- , mkStaticProp "cursorFlashTime" intT- , mkStaticProp "desktopSettingsAware" boolT- , mkStaticProp "doubleClickInterval" intT- , mkStaticProp "globalStrut" $ objT c_QSize- , mkProp "startDragDistance" intT- , mkProp "startDragTime" intT- , mkProp "styleSheet" $ objT c_QString- , mkStaticProp "wheelScrollLines" intT- -- TODO windowIcon ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QBoxLayout.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,12 +32,12 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment) import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout (c_QLayout) 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" #-}@@ -50,11 +51,11 @@ c_QBoxLayout = addReqIncludes [includeStd "QBoxLayout"] $+ classSetEntityPrefix "" $ makeClass (ident "QBoxLayout") Nothing [c_QLayout] [ mkCtor "new" [enumT e_Direction] , mkCtor "newWithParent" [enumT e_Direction, ptrT $ objT c_QWidget]- ] $- [ mkMethod' "addLayout" "addLayout" [ptrT $ objT c_QLayout] voidT+ , mkMethod' "addLayout" "addLayout" [ptrT $ objT c_QLayout] voidT , mkMethod' "addLayout" "addLayoutWithStretch" [ptrT $ objT c_QLayout, intT] voidT , mkMethod "addSpacing" [intT] voidT , mkMethod' "addStretch" "addStretch" [] voidT@@ -64,6 +65,7 @@ , mkMethod' "addWidget" "addWidgetWithStretch" [ptrT $ objT c_QWidget, intT] voidT , mkMethod' "addWidget" "addWidgetWithStretchAndAlignment" [ptrT $ objT c_QWidget, intT, bitspaceT bs_Alignment] voidT+ , mkProp "direction" $ enumT e_Direction , mkMethod' "insertLayout" "insertLayout" [intT, ptrT $ objT c_QLayout] voidT , mkMethod' "insertLayout" "insertLayoutWithStretch" [intT, ptrT $ objT c_QLayout, intT] voidT -- TODO insertSpacerItem@@ -77,9 +79,6 @@ , mkMethod "setStretch" [intT, intT] voidT , mkMethod' "setStretchFactor" "setWidgetStretchFactor" [ptrT $ objT c_QWidget, intT] boolT , mkMethod' "setStretchFactor" "setLayoutStretchFactor" [ptrT $ objT c_QLayout, intT] boolT- ] ++- mkProps- [ mkProp "direction" $ enumT e_Direction , mkProp "spacing" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QButtonGroup.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,20 +31,20 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, 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.QList (c_QListQAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_ListenerInt, c_ListenerIntBool, c_ListenerPtrQAbstractButton, c_ListenerPtrQAbstractButtonBool, ) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -56,23 +57,21 @@ c_QButtonGroup = addReqIncludes [includeStd "QButtonGroup"] $- makeClass (ident "QButtonGroup") Nothing [c_QObject]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QObject]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QButtonGroup") Nothing [c_QObject] $ collect- [ just $ mkMethod' "addButton" "addButton" [ptrT $ objT c_QAbstractButton] voidT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QObject]+ , just $ mkMethod' "addButton" "addButton" [ptrT $ objT c_QAbstractButton] voidT , just $ mkMethod' "addButton" "addButtonWithId" [ptrT $ objT c_QAbstractButton, intT] voidT , test (qtVersion >= [4, 1]) $ mkConstMethod "button" [intT] $ ptrT $ objT c_QAbstractButton , just $ mkConstMethod "buttons" [] $ objT c_QListQAbstractButton , just $ mkConstMethod "checkedButton" [] $ ptrT $ objT c_QAbstractButton , test (qtVersion >= [4, 1]) $ mkConstMethod "checkedId" [] intT+ , just $ mkProp "exclusive" boolT , test (qtVersion >= [4, 1]) $ mkConstMethod "id" [ptrT $ objT c_QAbstractButton] intT , just $ mkMethod "removeButton" [ptrT $ objT c_QAbstractButton] voidT , test (qtVersion >= [4, 1]) $ mkMethod "setId" [ptrT $ objT c_QAbstractButton, intT] voidT- ] ++- mkProps- [ mkProp "exclusive" boolT ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QCheckBox.hs view
@@ -23,19 +23,20 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkBoolIsProp, mkCtor, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (enumT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_CheckState) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton) 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" #-}@@ -47,13 +48,12 @@ c_QCheckBox = addReqIncludes [includeStd "QCheckBox"] $- makeClass (ident "QCheckBox") Nothing [ c_QAbstractButton ]+ classSetEntityPrefix "" $+ makeClass (ident "QCheckBox") Nothing [c_QAbstractButton] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithText" [objT c_QString] , mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget]- ] $- mkProps- [ mkProp "checkState" $ enumT e_CheckState+ , mkProp "checkState" $ enumT e_CheckState , mkBoolIsProp "tristate" ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDial.hs view
@@ -22,18 +22,19 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkConstMethod, mkCtor, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, intT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Core.Types (qreal) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider (c_QAbstractSlider) 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" #-}@@ -45,14 +46,12 @@ c_QDial = addReqIncludes [includeStd "QDial"] $+ classSetEntityPrefix "" $ makeClass (ident "QDial") Nothing [c_QAbstractSlider] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkConstMethod "notchSize" [] intT- ] ++- mkProps- [ mkProp "notchTarget" qreal+ , mkConstMethod "notchSize" [] intT+ , mkProp "notchTarget" qreal , mkProp "notchesVisible" boolT , mkProp "wrapping" boolT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDialog.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,13 +32,12 @@ mkCtor, mkMethod, mkProp,- mkProps,- ) import Foreign.Hoppy.Generator.Types (bitspaceT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_WindowFlags)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_Listener, c_ListenerInt)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener, c_ListenerInt) 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" #-}@@ -51,19 +51,17 @@ c_QDialog = addReqIncludes [includeStd "QDialog"] $+ classSetEntityPrefix "" $ makeClass (ident "QDialog") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithParentAndFlags" [ptrT $ objT c_QWidget, bitspaceT bs_WindowFlags]- ] $- [ mkMethod "accept" [] voidT+ , mkMethod "accept" [] voidT , mkMethod "done" [intT] voidT , mkMethod "exec" [] intT+ , mkBoolIsProp "modal" , mkMethod "open" [] voidT , mkMethod "reject" [] voidT- ] ++- mkProps- [ mkBoolIsProp "modal" , mkProp "result" intT , mkBoolIsProp "sizeGripEnabled" ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDialogButtonBox.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportBitspace, ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,19 +32,19 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QList (c_QListQAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_Orientation)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_Listener, c_ListenerPtrQAbstractButton, ) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Widgets.QPushButton (c_QPushButton) import Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -64,6 +65,7 @@ c_QDialogButtonBox = addReqIncludes [includeStd "QDialogButtonBox"] $+ classSetEntityPrefix "" $ makeClass (ident "QDialogButtonBox") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]@@ -74,21 +76,18 @@ --, mkCtor "newWithParent" [ptrT $ objT c_QWidget] --, mkCtor "new" [] --, mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkMethod' "addButton" "addButton" [ptrT $ objT c_QAbstractButton, enumT e_ButtonRole] voidT+ , mkMethod' "addButton" "addButton" [ptrT $ objT c_QAbstractButton, enumT e_ButtonRole] voidT , mkMethod' "addButton" "addButtonWithText" [objT c_QString, enumT e_ButtonRole] $ ptrT $ objT c_QPushButton , mkMethod' "addButton" "addStandardButton" [enumT e_StandardButton] $ ptrT $ objT c_QPushButton , mkConstMethod "button" [enumT e_StandardButton] $ ptrT $ objT c_QPushButton , mkConstMethod "buttonRole" [ptrT $ objT c_QAbstractButton] $ enumT e_ButtonRole , mkConstMethod "buttons" [] $ objT c_QListQAbstractButton+ , mkProp "centerButtons" boolT , mkMethod "clear" [] voidT+ , mkProp "orientation" $ enumT e_Orientation , mkMethod "removeButton" [ptrT $ objT c_QAbstractButton] voidT , mkConstMethod "standardButton" [ptrT $ objT c_QAbstractButton] $ enumT e_StandardButton- ] ++- mkProps- [ mkProp "centerButtons" boolT- , mkProp "orientation" $ enumT e_Orientation , mkProp "standardButtons" $ bitspaceT bs_StandardButtons ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QDoubleSpinBox.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,16 +31,16 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (doubleT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_ListenerDouble, c_ListenerQString, ) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSpinBox (c_QAbstractSpinBox) 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" #-}@@ -52,23 +53,21 @@ c_QDoubleSpinBox = addReqIncludes [includeStd "QDoubleSpinBox"] $+ classSetEntityPrefix "" $ makeClass (ident "QDoubleSpinBox") Nothing [c_QAbstractSpinBox] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkConstMethod "cleanText" [] $ objT c_QString- , mkMethod "setRange" [doubleT, doubleT] voidT- , mkConstMethod "textFromValue" [doubleT] $ objT c_QString- , mkConstMethod "valueFromText" [objT c_QString] doubleT- ] ++- mkProps- [ mkProp "decimals" intT+ , mkConstMethod "cleanText" [] $ objT c_QString+ , mkProp "decimals" intT , mkProp "maximum" doubleT , mkProp "minimum" doubleT , mkProp "prefix" $ objT c_QString+ , mkMethod "setRange" [doubleT, doubleT] voidT , mkProp "singleStep" doubleT , mkProp "suffix" $ objT c_QString+ , mkConstMethod "textFromValue" [doubleT] $ objT c_QString , mkProp "value" doubleT+ , mkConstMethod "valueFromText" [objT c_QString] doubleT ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QFileDialog.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportBitspace, ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,7 +32,6 @@ mkMethod, mkMethod', mkProp,- mkProps, mkStaticMethod', ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, objT, ptrT, voidT)@@ -41,9 +41,10 @@ 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.Types (bs_WindowFlags)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerQString)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerQString) import Graphics.UI.Qtah.Generator.Interface.Widgets.QDialog (c_QDialog) 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" #-}@@ -62,19 +63,23 @@ c_QFileDialog = addReqIncludes [includeStd "QFileDialog"] $- makeClass (ident "QFileDialog") Nothing [c_QDialog]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- , mkCtor "newWithParentAndFlags" [ptrT $ objT c_QWidget, bitspaceT bs_WindowFlags]- , mkCtor "newWithParentAndCaption" [ptrT $ objT c_QWidget, objT c_QString]- , mkCtor "newWithParentAndCaptionAndDirectory"+ classSetEntityPrefix "" $+ makeClass (ident "QFileDialog") Nothing [c_QDialog] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkCtor "newWithParentAndFlags" [ptrT $ objT c_QWidget, bitspaceT bs_WindowFlags]+ , just $ mkCtor "newWithParentAndCaption" [ptrT $ objT c_QWidget, objT c_QString]+ , just $ mkCtor "newWithParentAndCaptionAndDirectory" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString]- , mkCtor "newWithParentAndCaptionAndDirectoryAndFilter"+ , just $ mkCtor "newWithParentAndCaptionAndDirectoryAndFilter" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, objT c_QString]- ] $- collect- [ just $ mkConstMethod "directory" [] $ objT c_QDir+ , just $ mkProp "acceptMode" $ enumT e_AcceptMode+ , just $ mkProp "defaultSuffix" $ objT c_QString+ , just $ mkConstMethod "directory" [] $ objT c_QDir -- TODO directoryUrl (>=5.2)+ , just $ mkProp "fileMode" $ enumT e_FileMode+ , test (qtVersion >= [4, 4]) $ mkProp "filter" $ bitspaceT bs_Filters , just $ mkStaticMethod' "getExistingDirectory" "getExistingDirectory" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ objT c_QString , just $ mkStaticMethod' "getExistingDirectory" "getExistingDirectoryWithOptions"@@ -101,11 +106,14 @@ objT c_QString, ptrT $ objT c_QString, bitspaceT bs_Options] $ objT c_QString -- TODO getSaveFileUrl (>=5.2)-+ , just $ mkProp "history" $ objT c_QStringList -- TODO iconProvider -- TODO itemDelegate , just $ mkConstMethod "labelText" [enumT e_DialogLabel] $ objT c_QString+ , test (qtVersion >= [5, 2]) $ mkProp "mimeTypeFilters" $ objT c_QStringList+ , test (qtVersion >= [4, 4]) $ mkProp "nameFilters" $ objT c_QStringList -- TODO open (>=4.5)+ , test (qtVersion >= [4, 5]) $ mkProp "options" $ bitspaceT bs_Options -- TODO proxyModel -- TODO restoreState (>=4.3) -- TODO saveState (>=4.3)@@ -126,18 +134,8 @@ , test (qtVersion >= [4, 4]) $ mkMethod "setNameFilter" [objT c_QString] voidT , test (qtVersion >= [4, 5]) $ mkMethod "setOption" [enumT e_Option, boolT] voidT -- TODO setProxyModel (>=4.3)- -- TODO testOption (>=4.5)- ] ++- (mkProps . collect)- [ just $ mkProp "acceptMode" $ enumT e_AcceptMode- , just $ mkProp "defaultSuffix" $ objT c_QString- , just $ mkProp "fileMode" $ enumT e_FileMode- , test (qtVersion >= [4, 4]) $ mkProp "filter" $ bitspaceT bs_Filters- , just $ mkProp "history" $ objT c_QStringList- , test (qtVersion >= [5, 2]) $ mkProp "mimeTypeFilters" $ objT c_QStringList- , test (qtVersion >= [4, 4]) $ mkProp "nameFilters" $ objT c_QStringList- , test (qtVersion >= [4, 5]) $ mkProp "options" $ bitspaceT bs_Options -- TODO sidebarUrls (>=4.3)+ -- TODO testOption (>=4.5) , just $ mkProp "viewMode" $ enumT e_ViewMode ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QFormLayout.hs view
@@ -24,6 +24,7 @@ MethodApplicability (MConst), Purity (Nonpure), addReqIncludes,+ classSetEntityPrefix, ident, ident1, ident2,@@ -37,7 +38,6 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, constT, enumT, intT, objT, ptrT, refT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)@@ -45,6 +45,7 @@ import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout (c_QLayout) import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayoutItem (c_QLayoutItem) import Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -63,16 +64,18 @@ c_QFormLayout = addReqIncludes [includeStd "QFormLayout", includeLocal "wrap_qformlayout.hpp"] $+ classSetEntityPrefix "" $ makeClass (ident "QFormLayout") Nothing [c_QLayout] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkMethod' "addRow" "addRowWidgetWidget" [ptrT $ objT c_QWidget, ptrT $ objT c_QWidget] voidT+ , mkMethod' "addRow" "addRowWidgetWidget" [ptrT $ objT c_QWidget, ptrT $ objT c_QWidget] voidT , mkMethod' "addRow" "addRowWidgetLayout" [ptrT $ objT c_QWidget, ptrT $ objT c_QLayout] voidT , mkMethod' "addRow" "addRowStringWidget" [objT c_QString, ptrT $ objT c_QWidget] voidT , mkMethod' "addRow" "addRowStringLayout" [objT c_QString, ptrT $ objT c_QLayout] voidT , mkMethod' "addRow" "addRowWidget" [ptrT $ objT c_QWidget] voidT , mkMethod' "addRow" "addRowLayout" [ptrT $ objT c_QLayout] voidT+ , mkProp "fieldGrowthPolicy" $ enumT e_FieldGrowthPolicy+ , mkProp "formAlignment" $ bitspaceT bs_Alignment , makeFnMethod (ident2 "qtah" "qformlayout" "getItemRow") "getItemRow" MConst Nonpure [refT $ constT $ objT c_QFormLayout, intT] intT , makeFnMethod (ident2 "qtah" "qformlayout" "getItemRole") "getItemRole" MConst Nonpure@@ -85,6 +88,7 @@ [refT $ constT $ objT c_QFormLayout, ptrT $ objT c_QWidget] intT , makeFnMethod (ident2 "qtah" "qformlayout" "getWidgetRole") "getWidgetRole" MConst Nonpure [refT $ constT $ objT c_QFormLayout, ptrT $ objT c_QWidget] $ enumT e_ItemRole+ , mkProp "horizontalSpacing" intT , mkMethod' "insertRow" "insertRowWidgetWidget" [intT, ptrT $ objT c_QWidget, ptrT $ objT c_QWidget] voidT , mkMethod' "insertRow" "insertRowWidgetLayout"@@ -96,21 +100,16 @@ , mkMethod' "insertRow" "insertRowWidget" [intT, ptrT $ objT c_QWidget] voidT , mkMethod' "insertRow" "insertRowLayout" [intT, ptrT $ objT c_QLayout] voidT , mkConstMethod "itemAt" [intT, enumT e_ItemRole] $ ptrT $ objT c_QLayoutItem+ , mkProp "labelAlignment" $ bitspaceT bs_Alignment , mkConstMethod' "labelForField" "labelForFieldWidget" [ptrT $ objT c_QWidget] $ ptrT $ objT c_QWidget , mkConstMethod' "labelForField" "labelForFieldLayout" [ptrT $ objT c_QLayout] $ ptrT $ objT c_QWidget , mkConstMethod "rowCount" [] intT+ , mkProp "rowWrapPolicy" $ enumT e_RowWrapPolicy , mkMethod "setItem" [intT, enumT e_ItemRole, ptrT $ objT c_QLayoutItem] voidT , mkMethod "setLayout" [intT, enumT e_ItemRole, ptrT $ objT c_QLayout] voidT , mkMethod "setWidget" [intT, enumT e_ItemRole, ptrT $ objT c_QWidget] voidT- ] ++- mkProps- [ mkProp "fieldGrowthPolicy" $ enumT e_FieldGrowthPolicy- , mkProp "formAlignment" $ bitspaceT bs_Alignment- , mkProp "horizontalSpacing" intT- , mkProp "labelAlignment" $ bitspaceT bs_Alignment- , mkProp "rowWrapPolicy" $ enumT e_RowWrapPolicy , mkProp "spacing" intT , mkProp "verticalSpacing" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QFrame.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -30,11 +31,11 @@ mkConstMethod, mkCtor, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (enumT, intT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect) 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" #-}@@ -50,18 +51,16 @@ c_QFrame = addReqIncludes [includeStd "QFrame"] $+ classSetEntityPrefix "" $ makeClass (ident "QFrame") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] -- TODO QFrame(QWidget*, Qt::WindowFlags)- ] $- [ mkConstMethod "frameWidth" [] intT- ] ++- mkProps- [ mkProp "frameRect" $ objT c_QRect+ , mkProp "frameRect" $ objT c_QRect , mkProp "frameShadow" $ enumT e_Shadow , mkProp "frameShape" $ enumT e_Shape , mkProp "frameStyle" intT+ , mkConstMethod "frameWidth" [] intT , mkProp "lineWidth" intT , mkProp "midLineWidth" intT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QGridLayout.hs view
@@ -24,6 +24,7 @@ MethodApplicability (MConst, MNormal), Purity (Nonpure), addReqIncludes,+ classSetEntityPrefix, ident, ident2, includeLocal,@@ -35,7 +36,6 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, constT, enumT, intT, objT, ptrT, refT, voidT) import Foreign.Hoppy.Generator.Version (collect, just, test)@@ -45,6 +45,7 @@ import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout (c_QLayout) import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayoutItem (c_QLayoutItem) 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" #-}@@ -57,12 +58,12 @@ c_QGridLayout = addReqIncludes [includeStd "QGridLayout", includeLocal "wrap_qgridlayout.hpp"] $- makeClass (ident "QGridLayout") Nothing [c_QLayout]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QGridLayout") Nothing [c_QLayout] $ collect- [ just $ mkMethod' "addItem" "addItem" [ptrT $ objT c_QLayoutItem, intT, intT] voidT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkMethod' "addItem" "addItem" [ptrT $ objT c_QLayoutItem, intT, intT] voidT , just $ mkMethod' "addItem" "addItemWithSpan" [ptrT $ objT c_QLayoutItem, intT, intT, intT, intT] voidT , just $ mkMethod' "addItem" "addItemWithSpanAndAlignment"@@ -89,8 +90,10 @@ getItemPositionAppl Nonpure [getItemPositionThis, intT] intT , just $ makeFnMethod (ident2 "qtah" "qgridlayout" "getItemColumnSpan") "getItemColumnSpan" getItemPositionAppl Nonpure [getItemPositionThis, intT] intT+ , test (qtVersion >= [4, 3]) $ mkProp "horizontalSpacing" intT , test (qtVersion >= [4, 4]) $ mkConstMethod "itemAtPosition" [intT, intT] $ ptrT $ objT c_QLayoutItem+ , just $ mkProp "originCorner" $ enumT e_Corner , just $ mkConstMethod "rowCount" [] intT , just $ mkConstMethod "rowMinimumHeight" [intT] intT , just $ mkConstMethod "rowStretch" [intT] intT@@ -99,11 +102,7 @@ , just $ mkMethod "setRowMinimumHeight" [intT, intT] voidT , just $ mkMethod "setRowStretch" [intT, intT] voidT , just $ mkConstMethod "spacing" [] intT- ] ++- (mkProps . collect)- [ test (qtVersion >= [4, 3]) $ mkProp "horizontalSpacing" intT , test (qtVersion >= [4, 3]) $ mkProp "verticalSpacing" intT- , just $ mkProp "originCorner" $ enumT e_Corner ] where (getItemPositionAppl, getItemPositionThis) =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QGroupBox.hs view
@@ -22,23 +22,24 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkBoolIsProp, mkCtor, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, objT, ptrT) 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.Types (bs_Alignment)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_ListenerBool, ) 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" #-}@@ -51,14 +52,13 @@ c_QGroupBox = addReqIncludes [includeStd "QGroupBox"] $+ classSetEntityPrefix "" $ makeClass (ident "QGroupBox") 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]- ] $- mkProps- [ mkProp "alignment" $ bitspaceT bs_Alignment+ , mkProp "alignment" $ bitspaceT bs_Alignment , mkBoolIsProp "checkable" , mkBoolIsProp "checked" , mkBoolIsProp "flat"
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QHBoxLayout.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,6 +31,7 @@ import Foreign.Hoppy.Generator.Types (objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Widgets.QBoxLayout (c_QBoxLayout) 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" #-}@@ -41,8 +43,8 @@ c_QHBoxLayout = addReqIncludes [includeStd "QHBoxLayout"] $+ classSetEntityPrefix "" $ makeClass (ident "QHBoxLayout") Nothing [c_QBoxLayout] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] ]- []
+ src/Graphics/UI/Qtah/Generator/Interface/Widgets/QInputDialog.hs view
@@ -0,0 +1,152 @@+-- This file is part of Qtah.+--+-- Copyright 2015-2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.QInputDialog (+ aModule,+ ) where++import Foreign.Hoppy.Generator.Spec (+ Export (ExportBitspace, ExportEnum, ExportClass),+ addReqIncludes,+ classSetEntityPrefix,+ ident,+ ident1,+ includeStd,+ makeClass,+ mkBoolIsProp,+ mkConstMethod,+ mkCtor,+ mkMethod,+ mkProp,+ mkStaticMethod',+ )+import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, doubleT, 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.QString (c_QString)+import Graphics.UI.Qtah.Generator.Interface.Core.QStringList (c_QStringList)+import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_InputMethodHints, bs_WindowFlags)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (+ c_ListenerDouble,+ c_ListenerInt,+ c_ListenerQString,+ )+import Graphics.UI.Qtah.Generator.Interface.Widgets.QDialog (c_QDialog)+import Graphics.UI.Qtah.Generator.Interface.Widgets.QLineEdit (e_EchoMode)+import Graphics.UI.Qtah.Generator.Interface.Widgets.QWidget (c_QWidget)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModuleWithMinVersion)+import Graphics.UI.Qtah.Generator.Types++{-# ANN module "HLint: ignore Use camelCase" #-}++minVersion = [4, 5]++aModule =+ AQtModule $+ makeQtModuleWithMinVersion ["Widgets", "QInputDialog"] minVersion $+ QtExport (ExportClass c_QInputDialog) :+ map QtExportSignal signals +++ [ QtExport $ ExportEnum e_InputDialogOption+ , QtExport $ ExportBitspace bs_InputDialogOptions+ , QtExport $ ExportEnum e_InputMode+ ]++c_QInputDialog =+ addReqIncludes [includeStd "QInputDialog"] $+ classSetEntityPrefix "" $+ makeClass (ident "QInputDialog") Nothing [c_QDialog] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkCtor "newWithParentAndFlags" [ptrT $ objT c_QWidget, bitspaceT bs_WindowFlags]+ , just $ mkProp "cancelButtonText" $ objT c_QString+ , just $ mkBoolIsProp "comboBoxEditable"+ , just $ mkProp "comboBoxItems" $ objT c_QStringList+ , just $ mkProp "doubleDecimals" intT+ , just $ mkProp "doubleMaximum" doubleT+ , just $ mkProp "doubleMinimum" doubleT+ , just $ mkProp "doubleValue" doubleT+ , just $ mkStaticMethod' "getDouble" "getDouble"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] doubleT+ , just $ mkStaticMethod' "getDouble" "getDoubleWithOptions"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, doubleT, doubleT, doubleT,+ intT, ptrT boolT, bitspaceT bs_WindowFlags]+ doubleT+ , just $ mkStaticMethod' "getInt" "getInt"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] intT+ , just $ mkStaticMethod' "getInt" "getIntWithOptions"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, intT, intT, intT,+ intT, ptrT boolT, bitspaceT bs_WindowFlags]+ intT+ , just $ mkStaticMethod' "getItem" "getItem"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, objT c_QStringList] $ objT c_QString+ , just $ mkStaticMethod' "getItem" "getItemWithOptions"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, objT c_QStringList,+ intT, boolT, ptrT boolT, bitspaceT bs_WindowFlags, bitspaceT bs_InputMethodHints] $+ objT c_QString+ , test (qtVersion >= [5, 2]) $ mkStaticMethod' "getMultiLineText" "getMultiLineText"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ objT c_QString+ , test (qtVersion >= [5, 2]) $ mkStaticMethod' "getMultiLineText" "getMultiLineTextWithOptions"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, objT c_QString, ptrT boolT,+ bitspaceT bs_WindowFlags, bitspaceT bs_InputMethodHints] $+ objT c_QString+ , just $ mkStaticMethod' "getText" "getText"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ objT c_QString+ , just $ mkStaticMethod' "getText" "getTextWithOptions"+ [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, enumT e_EchoMode,+ objT c_QString, ptrT boolT, bitspaceT bs_WindowFlags, bitspaceT bs_InputMethodHints] $+ objT c_QString+ , just $ mkProp "inputMode" $ enumT e_InputMode+ , just $ mkProp "intMaximum" intT+ , just $ mkProp "intMinimum" intT+ , just $ mkProp "intStep" intT+ , just $ mkProp "intValue" intT+ , just $ mkProp "labelText" $ objT c_QString+ , just $ mkProp "okButtonText" $ objT c_QString+ -- TODO open (if it can fit into the type system nicely)+ , just $ mkProp "options" $ bitspaceT bs_InputDialogOptions+ , just $ mkMethod "setDoubleRange" [doubleT, doubleT] voidT+ , just $ mkMethod "setIntRange" [intT, intT] voidT+ , just $ mkMethod "setOption" [enumT e_InputDialogOption, boolT] voidT+ , just $ mkConstMethod "testOption" [enumT e_InputDialogOption] boolT+ , just $ mkProp "textEchoMode" $ enumT e_EchoMode+ , just $ mkProp "textValue" $ objT c_QString+ ]++signals =+ [ makeSignal c_QInputDialog "doubleValueChanged" c_ListenerDouble+ , makeSignal c_QInputDialog "doubleValueSelected" c_ListenerDouble+ , makeSignal c_QInputDialog "intValueChanged" c_ListenerInt+ , makeSignal c_QInputDialog "intValueSelected" c_ListenerInt+ , makeSignal c_QInputDialog "textValueChanged" c_ListenerQString+ , makeSignal c_QInputDialog "textValueSelected" c_ListenerQString+ ]++(e_InputDialogOption, bs_InputDialogOptions) =+ makeQtEnumBitspace (ident1 "QInputDialog" "InputDialogOption") "InputDialogOptions"+ [includeStd "QInputDialog"]+ [ (0x1, ["no", "buttons"])+ , (0x2, ["use", "list", "view", "for", "combo", "box", "items"])+ , (0x4, ["use", "plain", "text", "edit", "for", "text", "input"])+ ]++e_InputMode =+ makeQtEnum (ident1 "QInputDialog" "InputMode") [includeStd "QInputDialog"]+ [ (0, ["text", "input"])+ , (1, ["int", "input"])+ , (2, ["double", "input"])+ ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLabel.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,14 +32,14 @@ mkMethod', mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, doubleT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment, e_TextFormat)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerQString)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerQString) import Graphics.UI.Qtah.Generator.Interface.Widgets.QFrame (c_QFrame) 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" #-}@@ -51,24 +52,17 @@ c_QLabel = addReqIncludes [includeStd "QLabel"] $+ classSetEntityPrefix "" $ makeClass (ident "QLabel") Nothing [c_QFrame] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithText" [objT c_QString] , mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget] -- TODO Ctors taking Qt::WindowFlags.- ] $- [ mkMethod "clear" [] voidT- , mkConstMethod "hasSelectedText" [] boolT- , mkConstMethod "selectedText" [] $ objT c_QString- , mkConstMethod "selectionStart" [] intT- , mkMethod' "setNum" "setInt" [intT] voidT- , mkMethod' "setNum" "setDouble" [doubleT] voidT- , mkMethod "setSelection" [intT, intT] voidT- ] ++- mkProps- [ mkProp "alignment" $ bitspaceT bs_Alignment+ , mkProp "alignment" $ bitspaceT bs_Alignment , mkProp "buddy" $ ptrT $ objT c_QWidget+ , mkMethod "clear" [] voidT+ , mkConstMethod "hasSelectedText" [] boolT , mkProp "indent" intT , mkProp "margin" intT -- TODO movie@@ -76,6 +70,11 @@ -- TODO picture -- TODO pixmap , mkBoolHasProp "scaledContents"+ , mkConstMethod "selectedText" [] $ objT c_QString+ , mkConstMethod "selectionStart" [] intT+ , mkMethod' "setNum" "setInt" [intT] voidT+ , mkMethod' "setNum" "setDouble" [doubleT] voidT+ , mkMethod "setSelection" [intT, intT] voidT , mkProp "text" $ objT c_QString , mkProp "textFormat" $ enumT e_TextFormat -- TODO textInteractionFlags
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLayout.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -33,7 +34,6 @@ mkMethod', mkStaticMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Flag (collect, just, test)@@ -45,6 +45,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment) import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayoutItem (c_QLayoutItem) 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" #-}@@ -58,9 +59,10 @@ c_QLayout = addReqIncludes [includeStd "QLayout"] $- makeClass (ident "QLayout") Nothing [c_QObject, c_QLayoutItem]- [] $ -- Abstract.+ classSetEntityPrefix "" $+ makeClass (ident "QLayout") Nothing [c_QObject, c_QLayoutItem] $ collect+ -- Abstract. [ just $ mkMethod "activate" [] boolT , just $ mkMethod "addItem" [ptrT $ objT c_QLayoutItem] voidT , just $ mkMethod "addWidget" [ptrT $ objT c_QWidget] voidT@@ -69,8 +71,10 @@ , test (qtVersion >= [4, 6]) $ mkConstMethod "contentsMargins" [] $ objT c_QMargins , test (qtVersion >= [4, 3]) $ mkConstMethod "contentsRect" [] $ objT c_QRect , just $ mkConstMethod "count" [] intT+ , just $ mkBoolIsProp "enabled" , just $ mkConstMethod "indexOf" [ptrT $ objT c_QWidget] intT , just $ mkConstMethod "itemAt" [intT] $ ptrT $ objT c_QLayoutItem+ , just $ mkProp "menuBar" $ ptrT $ objT c_QWidget , just $ mkConstMethod "parentWidget" [] $ ptrT $ objT c_QWidget , just $ mkMethod "removeItem" [ptrT $ objT c_QLayoutItem] voidT , just $ mkMethod "removeWidget" [ptrT $ objT c_QWidget] voidT@@ -83,14 +87,10 @@ [objT c_QMargins] voidT , test (qtVersion >= [4, 3]) $ mkMethod' "setContentsMargins" "setContentsMarginsRaw" [intT, intT, intT, intT] voidT+ , just $ mkProp "sizeConstraint" $ enumT e_SizeConstraint+ , just $ mkProp "spacing" intT , just $ mkMethod "takeAt" [intT] $ ptrT $ objT c_QLayoutItem , just $ mkMethod "update" [] voidT- ] ++- mkProps- [ mkBoolIsProp "enabled"- , mkProp "menuBar" $ ptrT $ objT c_QWidget- , mkProp "sizeConstraint" $ enumT e_SizeConstraint- , mkProp "spacing" intT ] e_SizeConstraint =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLayoutItem.hs view
@@ -23,13 +23,13 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass, mkConstMethod, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect)@@ -37,6 +37,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment, bs_Orientations) import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout (c_QLayout) 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" #-}@@ -48,10 +49,13 @@ c_QLayoutItem = addReqIncludes [includeStd "QLayoutItem"] $+ classSetEntityPrefix "" $ makeClass (ident "QLayoutItem") Nothing []- [] $ -- Abstract.- [ -- TODO controlTypes- mkConstMethod "expandingDirections" [] $ bitspaceT bs_Orientations+ -- Abstract.+ [ mkProp "alignment" $ bitspaceT bs_Alignment+ -- TODO controlTypes+ , mkConstMethod "expandingDirections" [] $ bitspaceT bs_Orientations+ , mkProp "geometry" $ objT c_QRect , mkConstMethod "hasHeightForWidth" [] boolT , mkConstMethod "heightForWidth" [intT] intT , mkMethod "invalidate" [] voidT@@ -63,8 +67,4 @@ , mkConstMethod "sizeHint" [] $ objT c_QSize -- TODO spacerItem , mkConstMethod "widget" [] $ ptrT $ objT c_QWidget- ] ++- mkProps- [ mkProp "alignment" $ bitspaceT bs_Alignment- , mkProp "geometry" $ objT c_QRect ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QLineEdit.hs view
@@ -17,11 +17,13 @@ module Graphics.UI.Qtah.Generator.Interface.Widgets.QLineEdit ( aModule,+ e_EchoMode, ) where import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -33,7 +35,6 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, constT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QMargins (c_QMargins)@@ -41,13 +42,14 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment, e_CursorMoveStyle) import Graphics.UI.Qtah.Generator.Interface.Gui.QValidator (c_QValidator)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_Listener, c_ListenerIntInt, c_ListenerQString, ) import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenu (c_QMenu) 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" #-}@@ -61,18 +63,22 @@ 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]- ] $- [ mkMethod "backspace" [] voidT+ , mkProp "alignment" $ bitspaceT bs_Alignment+ , mkMethod "backspace" [] voidT , mkMethod "clear" [] voidT+ -- 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@@ -80,14 +86,22 @@ , 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@@ -95,23 +109,9 @@ , 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- ] ++- mkProps- [ mkProp "alignment" $ bitspaceT bs_Alignment- -- TODO completer- , mkProp "cursorMoveStyle" $ enumT e_CursorMoveStyle- , mkProp "cursorPosition" intT- , mkProp "dragEnabled" boolT- , mkProp "echoMode" $ enumT e_EchoMode- , mkBoolHasProp "frame"- , mkProp "inputMask" $ objT c_QString- , mkProp "maxLength" intT- , mkBoolIsProp "modified"- , mkProp "placeholderText" $ objT c_QString- , mkBoolIsProp "readOnly"- , mkProp "text" $ objT c_QString , mkProp "validator" $ ptrT $ constT $ objT c_QValidator ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMainWindow.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -29,15 +30,15 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Core.QSize (c_QSize)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerQSize)+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.QWidget (c_QWidget)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -50,19 +51,27 @@ c_QMainWindow = addReqIncludes [includeStd "QMainWindow"] $+ classSetEntityPrefix "" $ makeClass (ident "QMainWindow") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] -- TODO Ctor with Qt::WindowFlags.- ] $- [ -- TODO addDockWidget+ -- TODO addDockWidget -- TODO addToolBar -- TODO addToolBarBreak+ , mkBoolIsProp "animated"+ , mkProp "centralWidget" $ ptrT $ objT c_QWidget -- TODO corner- mkMethod "createPopupMenu" [] $ ptrT $ objT c_QMenu+ , mkMethod "createPopupMenu" [] $ ptrT $ objT c_QMenu+ , mkBoolIsProp "dockNestingEnabled"+ -- TODO dockOptions -- TODO dockWidgetArea+ , mkProp "documentMode" boolT+ , mkProp "iconSize" $ objT c_QSize -- TODO insertToolBar -- TODO insertToolBarBreak+ , mkProp "menuBar" $ ptrT $ objT c_QMenuBar+ , mkProp "menuWidget" $ ptrT $ objT c_QWidget -- TODO removeDockWidget -- TODO restoreState -- TODO saveState@@ -70,24 +79,13 @@ -- TODO setTabPosition -- TODO setTabShape -- TODO splitDockWidget+ , mkProp "statusBar" $ ptrT $ objT c_QStatusBar -- TODO tabifiedDockWidgets -- TODO tabifyDockWidget -- TODO tabPosition -- TODO tabShape -- TODO toolBarArea -- TODO toolBarBreak- ] ++- mkProps- [ mkBoolIsProp "animated"- , mkProp "centralWidget" $ ptrT $ objT c_QWidget- , mkBoolIsProp "dockNestingEnabled"- -- TODO dockOptions- , mkProp "documentMode" boolT- , mkProp "iconSize" $ objT c_QSize- , mkProp "menuBar" $ ptrT $ objT c_QMenuBar- , mkProp "menuWidget" $ ptrT $ objT c_QWidget- , mkProp "statusBar" $ ptrT $ objT c_QStatusBar- -- TODO tabShape -- TODO toolButtonStyle , mkProp "unifiedTitleAndToolBarOnMac" boolT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMenu.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -32,15 +33,15 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, objT, ptrT, voidT) 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.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_Listener, c_ListenerPtrQAction)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_Listener, c_ListenerPtrQAction) import {-# SOURCE #-} Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction) 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" #-}@@ -53,15 +54,16 @@ c_QMenu = addReqIncludes [includeStd "QMenu"] $+ classSetEntityPrefix "" $ makeClass (ident "QMenu") 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]- ] $- [ mkConstMethod "actionAt" [objT c_QPoint] $ ptrT $ objT c_QAction+ , mkConstMethod "actionAt" [objT c_QPoint] $ ptrT $ objT c_QAction , mkConstMethod "actionGeometry" [ptrT $ objT c_QAction] $ objT c_QRect+ , mkProp "activeAction" $ ptrT $ objT c_QAction , mkMethod' "addAction" "addAction" [ptrT $ objT c_QAction] voidT , mkMethod' "addAction" "addNewAction" [objT c_QString] $ ptrT $ objT c_QAction -- TODO addNewActionWithIcon and connecting forms@@ -70,10 +72,12 @@ -- TODO addNewMenuWithIcon , mkMethod "addSeparator" [] $ ptrT $ objT c_QAction , mkMethod "clear" [] voidT+ , mkProp "defaultAction" $ ptrT $ objT c_QAction , mkMethod' "exec" "exec" [] $ ptrT $ objT c_QAction , mkMethod' "exec" "execAt" [objT c_QPoint, ptrT $ objT c_QAction] $ ptrT $ objT c_QAction -- TODO Static exec , mkMethod "hideTearOffMenu" [] voidT+ -- TODO icon , mkMethod "insertMenu" [ptrT $ objT c_QAction, ptrT $ objT c_QMenu] $ ptrT $ objT c_QAction , mkMethod "insertSeparator" [ptrT $ objT c_QAction] $ ptrT $ objT c_QAction , mkConstMethod "isEmpty" [] boolT@@ -81,13 +85,8 @@ , mkConstMethod "menuAction" [] $ ptrT $ objT c_QAction , mkMethod' "popup" "popup" [objT c_QPoint] voidT , mkMethod' "popup" "popupAction" [objT c_QPoint, ptrT $ objT c_QAction] voidT- -- TODO setIcon- ] ++- mkProps- [ mkProp "activeAction" $ ptrT $ objT c_QAction- , mkProp "defaultAction" $ ptrT $ objT c_QAction- -- TODO icon , mkProp "separatorsCollapsible" boolT+ -- TODO setIcon , mkBoolIsProp "tearOffEnabled" , mkProp "title" $ objT c_QString ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMenuBar.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -32,7 +33,6 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (enumT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Flag (collect, just, test)@@ -41,10 +41,11 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QRect (c_QRect) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_Corner)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerPtrQAction)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerPtrQAction) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction) import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenu (c_QMenu) 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 aModule =@@ -55,31 +56,30 @@ c_QMenuBar = addReqIncludes [includeStd "QMenuBar"] $- makeClass (ident "QMenuBar") Nothing- [ c_QWidget ]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkConstMethod "actionAt" [objT c_QPoint] $ ptrT $ objT c_QAction- , mkConstMethod "actionGeometry" [ptrT $ objT c_QAction] $ objT c_QRect- , mkMethod' "addAction" "addAction" [ptrT $ objT c_QAction] voidT- , mkMethod' "addAction" "addNewAction" [objT c_QString] $ ptrT $ objT c_QAction+ classSetEntityPrefix "" $+ makeClass (ident "QMenuBar") Nothing [c_QWidget] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkConstMethod "actionAt" [objT c_QPoint] $ ptrT $ objT c_QAction+ , just $ mkConstMethod "actionGeometry" [ptrT $ objT c_QAction] $ objT c_QRect+ , just $ mkProp "activeAction" $ ptrT $ objT c_QAction+ , just $ mkMethod' "addAction" "addAction" [ptrT $ objT c_QAction] voidT+ , just $ mkMethod' "addAction" "addNewAction" [objT c_QString] $ ptrT $ objT c_QAction -- TODO addNewActionWithIcon and connecting forms- , mkMethod' "addMenu" "addMenu" [ptrT $ objT c_QMenu] $ ptrT $ objT c_QAction- , mkMethod' "addMenu" "addNewMenu" [objT c_QString] $ ptrT $ objT c_QMenu+ , just $ mkMethod' "addMenu" "addMenu" [ptrT $ objT c_QMenu] $ ptrT $ objT c_QAction+ , just $ mkMethod' "addMenu" "addNewMenu" [objT c_QString] $ ptrT $ objT c_QMenu -- TODO addNewMenuWithIcon- , mkMethod "addSeparator" [] $ ptrT $ objT c_QAction- , mkMethod "clear" [] voidT- , mkConstMethod "cornerWidget" [enumT e_Corner] $ ptrT $ objT c_QWidget- , mkMethod "insertMenu" [ptrT $ objT c_QAction, ptrT $ objT c_QMenu] $ ptrT $ objT c_QAction- , mkMethod "insertSeparator" [ptrT $ objT c_QAction] $ ptrT $ objT c_QAction- , mkMethod "setCornerWidget" [ptrT $ objT c_QWidget, enumT e_Corner] voidT- ] ++- (mkProps . collect)- [ just $ mkProp "activeAction" $ ptrT $ objT c_QAction+ , just $ mkMethod "addSeparator" [] $ ptrT $ objT c_QAction+ , just $ mkMethod "clear" [] voidT+ , just $ mkConstMethod "cornerWidget" [enumT e_Corner] $ ptrT $ objT c_QWidget , test wsWince $ mkProp "defaultAction" $ ptrT $ objT c_QAction , just $ mkBoolIsProp "defaultUp"+ , just $+ mkMethod "insertMenu" [ptrT $ objT c_QAction, ptrT $ objT c_QMenu] $ ptrT $ objT c_QAction+ , just $ mkMethod "insertSeparator" [ptrT $ objT c_QAction] $ ptrT $ objT c_QAction , just $ mkBoolIsProp "nativeMenuBar"+ , just $ mkMethod "setCornerWidget" [ptrT $ objT c_QWidget, enumT e_Corner] voidT ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QMessageBox.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportBitspace, ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,7 +32,6 @@ mkMethod, mkMethod', mkProp,- mkProps, mkStaticMethod, mkStaticMethod', )@@ -45,12 +45,13 @@ e_TextFormat, e_WindowModality, )-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerPtrQAbstractButton)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerPtrQAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Widgets.QCheckBox (c_QCheckBox) import Graphics.UI.Qtah.Generator.Interface.Widgets.QDialog (c_QDialog) import Graphics.UI.Qtah.Generator.Interface.Widgets.QPushButton (c_QPushButton) 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" #-}@@ -68,12 +69,12 @@ c_QMessageBox = addReqIncludes [includeStd "QMessageBox"] $- makeClass (ident "QMessageBox") Nothing [c_QDialog]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QMessageBox") Nothing [c_QDialog] $ collect- [ just $ mkStaticMethod "about" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] voidT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkStaticMethod "about" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] voidT , just $ mkStaticMethod "aboutQt" [ptrT $ objT c_QWidget, objT c_QString] voidT , test (qtVersion >= [4, 2]) $ mkMethod' "addButton" "addButton" [ptrT $ objT c_QAbstractButton, enumT e_ButtonRole] voidT@@ -86,6 +87,7 @@ , test (qtVersion >= [4, 5]) $ mkConstMethod "buttonRole" [ptrT $ objT c_QAbstractButton] $ enumT e_ButtonRole , test (qtVersion >= [4, 5]) $ mkConstMethod "buttons" [] $ objT c_QListQAbstractButton+ , test (qtVersion >= [5, 2]) $ mkProp "checkBox" $ ptrT $ objT c_QCheckBox , test (qtVersion >= [4, 2]) $ mkConstMethod "clickedButton" [] $ ptrT $ objT c_QAbstractButton , test (qtVersion >= [4, 2]) $ mkStaticMethod' "critical" "critical" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ enumT e_StandardButton@@ -94,7 +96,10 @@ bitspaceT bs_StandardButtons, enumT e_StandardButton] $ enumT e_StandardButton , just $ mkConstMethod "defaultButton" [] $ ptrT $ objT c_QPushButton+ , test (qtVersion >= [4, 2]) $ mkProp "detailedText" $ objT c_QString , test (qtVersion >= [4, 2]) $ mkConstMethod "escapeButton" [] $ ptrT $ objT c_QAbstractButton+ , just $ mkProp "icon" $ enumT e_Icon+ -- TODO iconPixmap , test (qtVersion >= [4, 2]) $ mkStaticMethod' "information" "information" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ enumT e_StandardButton , test (qtVersion >= [4, 2]) $ mkStaticMethod' "information" "informationWithButtons"@@ -102,6 +107,7 @@ bitspaceT bs_StandardButtons, enumT e_StandardButton] $ enumT e_StandardButton -- OMIT open+ , test (qtVersion >= [4, 2]) $ mkProp "informativeText" $ objT c_QString , test (qtVersion >= [4, 2]) $ mkStaticMethod' "question" "question" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ enumT e_StandardButton , test (qtVersion >= [4, 2]) $ mkStaticMethod' "question" "questionWithButtons"@@ -121,23 +127,16 @@ , test (qtVersion >= [4, 2]) $ mkMethod "setWindowTitle" [objT c_QString] voidT , test (qtVersion >= [4, 2]) $ mkConstMethod "standardButton" [ptrT $ objT c_QAbstractButton] $ enumT e_StandardButton+ , test (qtVersion >= [4, 2]) $ mkProp "standardButtons" $ bitspaceT bs_StandardButtons+ , just $ mkProp "text" $ objT c_QString+ , just $ mkProp "textFormat" $ enumT e_TextFormat+ , test (qtVersion >= [5, 1]) $ mkProp "textInteractionFlags" $ bitspaceT bs_TextInteractionFlags , test (qtVersion >= [4, 2]) $ mkStaticMethod' "warning" "warning" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString] $ enumT e_StandardButton , test (qtVersion >= [4, 2]) $ mkStaticMethod' "warning" "warningWithButtons" [ptrT $ objT c_QWidget, objT c_QString, objT c_QString, bitspaceT bs_StandardButtons, enumT e_StandardButton] $ enumT e_StandardButton- ] ++- (mkProps . collect)- [ test (qtVersion >= [5, 2]) $ mkProp "checkBox" $ ptrT $ objT c_QCheckBox- , test (qtVersion >= [4, 2]) $ mkProp "detailedText" $ objT c_QString- , just $ mkProp "icon" $ enumT e_Icon- -- TODO iconPixmap- , test (qtVersion >= [4, 2]) $ mkProp "informativeText" $ objT c_QString- , test (qtVersion >= [4, 2]) $ mkProp "standardButtons" $ bitspaceT bs_StandardButtons- , just $ mkProp "text" $ objT c_QString- , just $ mkProp "textFormat" $ enumT e_TextFormat- , test (qtVersion >= [5, 1]) $ mkProp "textInteractionFlags" $ bitspaceT bs_TextInteractionFlags ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QProgressBar.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,15 +32,15 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, 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.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment, e_Orientation)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerInt)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerInt) 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" #-}@@ -55,23 +56,22 @@ c_QProgressBar = addReqIncludes [includeStd "QProgressBar"] $- makeClass (ident "QProgressBar") Nothing [c_QWidget]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QProgressBar") Nothing [c_QWidget] $ collect- [ just $ mkMethod "reset" [] voidT- , test (qtVersion >= [5, 0]) $ mkMethod "resetFormat" [] voidT -- ADDED-BETWEEN 4.8 5.4- , just $ mkMethod "setRange" [intT, intT] voidT- , just $ mkConstMethod "text" [] $ objT c_QString- ] ++- (mkProps . collect)- [ just $ mkProp "alignment" $ bitspaceT bs_Alignment+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]++ , just $ mkProp "alignment" $ bitspaceT bs_Alignment , test (qtVersion >= [4, 2]) $ mkProp "format" $ objT c_QString , test (qtVersion >= [4, 1]) $ mkProp "invertedAppearance" boolT , just $ mkProp "maximum" intT , just $ mkProp "minimum" intT , test (qtVersion >= [4, 1]) $ mkProp "orientation" $ enumT e_Orientation+ , just $ mkMethod "reset" [] voidT+ , test (qtVersion >= [5, 0]) $ mkMethod "resetFormat" [] voidT -- ADDED-BETWEEN 4.8 5.4+ , just $ mkMethod "setRange" [intT, intT] voidT+ , just $ mkConstMethod "text" [] $ objT c_QString , test (qtVersion >= [4, 1]) $ mkProp "textDirection" $ enumT e_Direction , just $ mkBoolIsProp "textVisible" , just $ mkProp "value" intT
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QPushButton.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,13 +31,13 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton) import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenu (c_QMenu) 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" #-}@@ -48,6 +49,7 @@ c_QPushButton = addReqIncludes [includeStd "QPushButton"] $+ classSetEntityPrefix "" $ makeClass (ident "QPushButton") Nothing [ c_QAbstractButton ] [ mkCtor "new" []@@ -55,12 +57,9 @@ , mkCtor "newWithText" [objT c_QString] , mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget] -- TODO Ctors with QIcon.- ] $- [ mkMethod "showMenu" [] voidT- ] ++- mkProps- [ mkProp "autoDefault" boolT+ , mkProp "autoDefault" boolT , mkBoolIsProp "default" , mkBoolIsProp "flat" , mkProp "menu" $ ptrT $ objT c_QMenu+ , mkMethod "showMenu" [] voidT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QRadioButton.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,6 +32,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractButton (c_QAbstractButton) 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" #-}@@ -42,10 +44,10 @@ c_QRadioButton = addReqIncludes [includeStd "QRadioButton"] $+ classSetEntityPrefix "" $ makeClass (ident "QRadioButton") Nothing [c_QAbstractButton] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithText" [objT c_QString] , mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget] ]- []
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QRubberBand.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -35,6 +36,7 @@ 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.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" #-}@@ -48,11 +50,11 @@ c_QRubberBand = addReqIncludes [includeStd "QRubberBand"] $+ classSetEntityPrefix "" $ makeClass (ident "QRubberBand") Nothing [c_QWidget] [ mkCtor "new" [enumT e_Shape] , mkCtor "newWithParent" [enumT e_Shape, ptrT $ objT c_QWidget]- ]- [ mkMethod "move" [objT c_QPoint] voidT+ , mkMethod "move" [objT c_QPoint] voidT , mkMethod "resize" [objT c_QSize] voidT , mkMethod "setGeometry" [objT c_QRect] voidT , mkConstMethod "shape" [] $ enumT e_Shape
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QScrollArea.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -29,7 +30,6 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, intT, objT, ptrT, voidT) import Foreign.Hoppy.Generator.Version (collect, just, test)@@ -37,6 +37,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea (c_QAbstractScrollArea) 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" #-}@@ -48,21 +49,19 @@ c_QScrollArea = addReqIncludes [includeStd "QScrollArea"] $- makeClass (ident "QScrollArea") Nothing [c_QAbstractScrollArea]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QScrollArea") Nothing [c_QAbstractScrollArea] $ collect- [ just $ mkMethod' "ensureVisible" "ensureVisible" [intT, intT] voidT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , test (qtVersion >= [4, 2]) $ mkProp "alignment" $ bitspaceT bs_Alignment+ , just $ mkMethod' "ensureVisible" "ensureVisible" [intT, intT] voidT , just $ mkMethod' "ensureVisible" "ensureVisibleWithMargins" [intT, intT, intT, intT] voidT , test (qtVersion >= [4, 2]) $ mkMethod' "ensureWidgetVisible" "ensureWidgetVisible" [ptrT $ objT c_QWidget] voidT , test (qtVersion >= [4, 2]) $ mkMethod' "ensureWidgetVisible" "ensureWidgetVisibleWithMargins" [ptrT $ objT c_QWidget, intT, intT] voidT , just $ mkMethod "takeWidget" [] $ ptrT $ objT c_QWidget- ] ++- (mkProps . collect)- [ test (qtVersion >= [4, 2]) $ mkProp "alignment" $ bitspaceT bs_Alignment , just $ mkProp "widget" $ ptrT $ objT c_QWidget , just $ mkProp "widgetResizable" boolT ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QScrollBar.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,6 +32,7 @@ import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_Orientation) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider (c_QAbstractSlider) 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" #-}@@ -42,10 +44,10 @@ c_QScrollBar = addReqIncludes [includeStd "QScrollBar"] $+ classSetEntityPrefix "" $ makeClass (ident "QScrollBar") Nothing [c_QAbstractSlider] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithOrientation" [enumT e_Orientation] , mkCtor "newWithOrientationAndParent" [enumT e_Orientation, ptrT $ objT c_QWidget] ]- []
+ src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSizePolicy.hs view
@@ -0,0 +1,122 @@+-- This file is part of Qtah.+--+-- Copyright 2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.QSizePolicy (+ aModule,+ c_QSizePolicy,+ e_Policy,+ ) where++import Foreign.Hoppy.Generator.Spec (+ Export (ExportBitspace, ExportClass, ExportEnum),+ addReqIncludes,+ classSetConversionToGc,+ classSetEntityPrefix,+ ident,+ ident1,+ includeStd,+ makeClass,+ mkBoolHasProp,+ mkConstMethod,+ mkCtor,+ mkMethod,+ mkProp,+ )+import Foreign.Hoppy.Generator.Spec.ClassFeature (+ ClassFeature (Copyable, Equatable),+ classAddFeatures,+ )+import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, intT, voidT)+import Graphics.UI.Qtah.Generator.Flag (collect, just, test)+import Graphics.UI.Qtah.Generator.Flags (qtVersion)+import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Orientations)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)+import Graphics.UI.Qtah.Generator.Types++{-# ANN module "HLint: ignore Use camelCase" #-}++aModule =+ AQtModule $+ makeQtModule ["Widgets", "QSizePolicy"] $+ collect+ [ just $ QtExport $ ExportClass c_QSizePolicy+ , test (qtVersion >= [4, 3]) $ QtExport $ ExportEnum e_ControlType+ , test (qtVersion >= [4, 3]) $ QtExport $ ExportBitspace bs_ControlTypes+ , just $ QtExport $ ExportEnum e_Policy+ , just $ QtExport $ ExportEnum e_PolicyFlag+ ]++c_QSizePolicy =+ addReqIncludes [includeStd "QSizePolicy"] $+ classSetConversionToGc $+ classAddFeatures [Copyable, Equatable] $+ classSetEntityPrefix "" $+ makeClass (ident "QSizePolicy") Nothing [] $+ collect+ [ just $ mkCtor "new" []+ , test (qtVersion >= [4, 3]) $ mkCtor "newWithOptions"+ [enumT e_Policy, enumT e_Policy, enumT e_ControlType]+ , test (qtVersion >= [4, 3]) $ mkProp "controlType" $ enumT e_ControlType+ , just $ mkConstMethod "expandingDirections" [] $ bitspaceT bs_Orientations+ , just $ mkBoolHasProp "heightForWidth"+ , just $ mkBoolHasProp "widthForHeight"+ , just $ mkProp "horizontalPolicy" $ enumT e_Policy+ , just $ mkProp "horizontalStretch" intT+ , just $ mkProp "verticalPolicy" $ enumT e_Policy+ , just $ mkProp "verticalStretch" intT+ , test (qtVersion >= [5, 2]) $ mkProp "retainSizeWhenHidden" boolT+ , just $ mkMethod "transpose" [] voidT+ ]++(e_ControlType, bs_ControlTypes) =+ makeQtEnumBitspace (ident1 "QSizePolicy" "ControlType") "ControlTypes"+ [includeStd "QSizePolicy"]+ [ (0x00000001, ["default", "type"])+ , (0x00000002, ["button", "box"])+ , (0x00000004, ["check", "box"])+ , (0x00000008, ["combo", "box"])+ , (0x00000010, ["frame"])+ , (0x00000020, ["group", "box"])+ , (0x00000040, ["label"])+ , (0x00000080, ["line"])+ , (0x00000100, ["line", "edit"])+ , (0x00000200, ["push", "button"])+ , (0x00000400, ["radio", "button"])+ , (0x00000800, ["slider"])+ , (0x00001000, ["spin", "box"])+ , (0x00002000, ["tab", "widget"])+ , (0x00004000, ["tool", "button"])+ ]++e_Policy =+ makeQtEnum (ident1 "QSizePolicy" "Policy") [includeStd "QSizePolicy"]+ [ (0x0, ["fixed"])+ , (0x1, ["minimum"]) -- GrowFlag+ , (0x4, ["maximum"]) -- ShrinkFlag+ , (0x5, ["preferred"]) -- GrowFlag | ShrinkFlag+ , (0x7, ["expanding"]) -- GrowFlag | ShrinkFlag | ExpandFlag+ , (0x3, ["minimum", "expanding"]) -- GrowFlag | ExpandFlag+ , (0xd, ["ignored"]) -- ShrinkFlag | GrowFlag | IgnoreFlag+ ]++e_PolicyFlag =+ makeQtEnum (ident1 "QSizePolicy" "PolicyFlag") [includeStd "QSizePolicy"]+ [ (0x1, ["grow", "flag"])+ , (0x2, ["expand", "flag"])+ , (0x4, ["shrink", "flag"])+ , (0x8, ["ignore", "flag"])+ ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSlider.hs view
@@ -22,18 +22,19 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd, makeClass, mkCtor, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (enumT, intT, objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_Orientation) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSlider (c_QAbstractSlider) 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" #-}@@ -47,14 +48,13 @@ c_QSlider = addReqIncludes [includeStd "QSlider"] $+ classSetEntityPrefix "" $ makeClass (ident "QSlider") Nothing [c_QAbstractSlider] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithOrientation" [enumT e_Orientation] , mkCtor "newWithOrientationAndParent" [enumT e_Orientation, ptrT $ objT c_QWidget]- ] $- mkProps- [ mkProp "tickInterval" intT+ , mkProp "tickInterval" intT , mkProp "tickPosition" $ enumT e_TickPosition ]
+ src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSpacerItem.hs view
@@ -0,0 +1,61 @@+-- This file is part of Qtah.+--+-- Copyright 2016 Bryan Gardiner <bog@khumba.net>+--+-- 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.QSpacerItem (+ aModule,+ c_QSpacerItem,+ ) where++import Foreign.Hoppy.Generator.Spec (+ Export (ExportClass),+ addReqIncludes,+ classSetEntityPrefix,+ ident,+ includeStd,+ makeClass,+ mkConstMethod,+ mkCtor,+ mkMethod',+ )+import Foreign.Hoppy.Generator.Types (enumT, intT, objT, voidT)+import Graphics.UI.Qtah.Generator.Flag (collect, just, test)+import Graphics.UI.Qtah.Generator.Flags (qtVersion)+import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayoutItem (c_QLayoutItem)+import Graphics.UI.Qtah.Generator.Interface.Widgets.QSizePolicy (c_QSizePolicy, e_Policy)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)+import Graphics.UI.Qtah.Generator.Types++{-# ANN module "HLint: ignore Use camelCase" #-}++aModule =+ AQtModule $+ makeQtModule ["Widgets", "QSpacerItem"]+ [ QtExport $ ExportClass c_QSpacerItem ]++c_QSpacerItem =+ addReqIncludes [includeStd "QSpacerItem"] $+ classSetEntityPrefix "" $+ makeClass (ident "QSpacerItem") Nothing+ [ c_QLayoutItem ] $+ collect+ [ just $ mkCtor "new" [intT, intT]+ , just $ mkCtor "newWithOptions" [intT, intT, enumT e_Policy, enumT e_Policy]+ , just $ mkMethod' "changeSize" "changeSize" [intT, intT] voidT+ , just $ mkMethod' "changeSize" "changeSizeWithOptions"+ [intT, intT, enumT e_Policy, enumT e_Policy] voidT+ , test (qtVersion >= [5, 5]) $ mkConstMethod "sizePolicy" [] $ objT c_QSizePolicy+ ]
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSpinBox.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,18 +31,18 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Flag (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.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_ListenerInt, c_ListenerQString, ) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractSpinBox (c_QAbstractSpinBox) 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" #-}@@ -54,18 +55,17 @@ c_QSpinBox = addReqIncludes [includeStd "QSpinBox"] $- makeClass (ident "QSpinBox") Nothing [c_QAbstractSpinBox]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkConstMethod "cleanText" [] $ objT c_QString- , mkMethod "setRange" [intT, intT] voidT- ] ++- (mkProps . collect)- [ test (qtVersion >= [5, 2]) $ mkProp "displayIntegerBase" intT+ classSetEntityPrefix "" $+ makeClass (ident "QSpinBox") Nothing [c_QAbstractSpinBox] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkConstMethod "cleanText" [] $ objT c_QString+ , test (qtVersion >= [5, 2]) $ mkProp "displayIntegerBase" intT , just $ mkProp "maximum" intT , just $ mkProp "minimum" intT , just $ mkProp "prefix" $ objT c_QString+ , just $ mkMethod "setRange" [intT, intT] voidT , just $ mkProp "singleStep" intT , just $ mkProp "suffix" $ objT c_QString , just $ mkProp "value" intT
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QSplitter.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -29,14 +30,14 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QList (c_QListInt) import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_Orientation)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerIntInt)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerIntInt) import Graphics.UI.Qtah.Generator.Interface.Widgets.QFrame (c_QFrame) 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" #-}@@ -49,19 +50,23 @@ c_QSplitter = addReqIncludes [includeStd "QSplitter"] $+ classSetEntityPrefix "" $ makeClass (ident "QSplitter") Nothing [c_QFrame] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithOrientation" [enumT e_Orientation] , mkCtor "newWithOrientationAndParent" [enumT e_Orientation, ptrT $ objT c_QWidget]- ] $- [ mkMethod "addWidget" [ptrT $ objT c_QWidget] voidT+ , mkMethod "addWidget" [ptrT $ objT c_QWidget] voidT+ , mkProp "childrenCollapsible" boolT , mkConstMethod "count" [] intT -- TODO getRange -- TODO handle+ , mkProp "handleWidth" intT , mkConstMethod "indexOf" [ptrT $ objT c_QWidget] intT , mkMethod "insertWidget" [intT, ptrT $ objT c_QWidget] voidT , mkConstMethod "isCollapsible" [intT] boolT+ , mkProp "opaqueResize" boolT+ , mkProp "orientation" $ enumT e_Orientation , mkMethod "refresh" [] voidT -- TODO restoreState -- TODO saveState@@ -70,12 +75,6 @@ , mkMethod "setStretchFactor" [intT, intT] voidT , mkMethod "sizes" [] $ objT c_QListInt , mkConstMethod "widget" [intT] $ ptrT $ objT c_QWidget- ] ++- mkProps- [ mkProp "childrenCollapsible" boolT- , mkProp "handleWidth" intT- , mkProp "opaqueResize" boolT- , mkProp "orientation" $ enumT e_Orientation ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QStackedLayout.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -30,14 +31,14 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (enumT, intT, objT, ptrT) import Foreign.Hoppy.Generator.Version (collect, just, test) import Graphics.UI.Qtah.Generator.Flags (qtVersion)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerInt)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerInt) import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout (c_QLayout) 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" #-}@@ -56,20 +57,19 @@ c_QStackedLayout = addReqIncludes [includeStd "QStackedLayout"] $- makeClass (ident "QStackedLayout") Nothing [c_QLayout]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- , mkCtor "newWithLayout" [ptrT $ objT c_QLayout]- ] $- [ mkMethod "addWidget" [ptrT $ objT c_QWidget] intT- , mkConstMethod "count" [] intT- , mkMethod "insertWidget" [intT, ptrT $ objT c_QWidget] intT- , mkConstMethod "widget" [intT] $ ptrT $ objT c_QWidget- ] ++- (mkProps . collect)- [ just $ mkProp "currentIndex" intT+ classSetEntityPrefix "" $+ makeClass (ident "QStackedLayout") Nothing [c_QLayout] $+ collect+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkCtor "newWithLayout" [ptrT $ objT c_QLayout]+ , just $ mkMethod "addWidget" [ptrT $ objT c_QWidget] intT+ , just $ mkConstMethod "count" [] intT+ , just $ mkProp "currentIndex" intT , just $ mkProp "currentWidget" $ ptrT $ objT c_QWidget+ , just $ mkMethod "insertWidget" [intT, ptrT $ objT c_QWidget] intT , test (qtVersion >= [4, 4]) $ mkProp "stackingMode" $ enumT e_StackingMode+ , just $ mkConstMethod "widget" [intT] $ ptrT $ objT c_QWidget ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QStackedWidget.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -29,12 +30,12 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerInt)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerInt) import Graphics.UI.Qtah.Generator.Interface.Widgets.QFrame (c_QFrame) 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" #-}@@ -47,20 +48,18 @@ c_QStackedWidget = addReqIncludes [includeStd "QStackedWidget"] $+ classSetEntityPrefix "" $ makeClass (ident "QStackedWidget") Nothing [c_QFrame] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkMethod "addWidget" [ptrT $ objT c_QWidget] intT+ , mkMethod "addWidget" [ptrT $ objT c_QWidget] intT , mkConstMethod "count" [] intT+ , mkProp "currentIndex" intT+ , mkProp "currentWidget" $ ptrT $ objT c_QWidget , mkConstMethod "indexOf" [ptrT $ objT c_QWidget] intT , mkMethod "insertWidget" [intT, ptrT $ objT c_QWidget] intT , mkMethod "removeWidget" [ptrT $ objT c_QWidget] voidT , mkConstMethod "widget" [intT] $ ptrT $ objT c_QWidget- ] ++- mkProps- [ mkProp "currentIndex" intT- , mkProp "currentWidget" $ ptrT $ objT c_QWidget ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QStatusBar.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -31,12 +32,12 @@ mkCtor, mkMethod, mkMethod',- mkProps, ) import Foreign.Hoppy.Generator.Types (intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerQString)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerQString) 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" #-}@@ -49,11 +50,11 @@ c_QStatusBar = addReqIncludes [includeStd "QStatusBar"] $+ classSetEntityPrefix "" $ makeClass (ident "QStatusBar") Nothing [c_QWidget] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $- [ mkMethod' "addPermanentWidget" "addPermanentWidget" [ptrT $ objT c_QWidget] voidT+ , mkMethod' "addPermanentWidget" "addPermanentWidget" [ptrT $ objT c_QWidget] voidT , mkMethod' "addPermanentWidget" "addPermanentWidgetWithStretch" [ptrT $ objT c_QWidget, intT] voidT , mkMethod' "addWidget" "addWidget" [ptrT $ objT c_QWidget] voidT@@ -68,9 +69,7 @@ , mkMethod "removeWidget" [ptrT $ objT c_QWidget] voidT , mkMethod' "showMessage" "showMessage" [objT c_QString] voidT , mkMethod' "showMessage" "showMessageWithTimeout" [objT c_QString, intT] voidT- ] ++- mkProps- [ mkBoolIsProp "sizeGripEnabled"+ , mkBoolIsProp "sizeGripEnabled" ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QTabWidget.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass, ExportEnum), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -31,7 +32,6 @@ mkCtor, mkMethod, mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, objT, ptrT, voidT) import Foreign.Hoppy.Generator.Version (collect, just, test)@@ -39,8 +39,9 @@ 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_Corner, e_TextElideMode)-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerInt)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerInt) 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" #-}@@ -56,20 +57,26 @@ c_QTabWidget = addReqIncludes [includeStd "QTabWidget"] $- makeClass (ident "QTabWidget") Nothing [c_QWidget]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QTabWidget") Nothing [c_QWidget] $ collect- [ just $ mkMethod "addTab" [ptrT $ objT c_QWidget, objT c_QString] intT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkMethod "addTab" [ptrT $ objT c_QWidget, objT c_QString] intT -- TODO addTabWithIcon , just $ mkMethod "clear" [] voidT , just $ mkConstMethod "cornerWidget" [enumT e_Corner] $ ptrT $ objT c_QWidget , just $ mkConstMethod "count" [] intT+ , just $ mkProp "currentIndex" intT+ , just $ mkProp "currentWidget" $ ptrT $ objT c_QWidget+ , test (qtVersion >= [4, 5]) $ mkProp "documentMode" boolT+ , test (qtVersion >= [4, 2]) $ mkProp "elideMode" $ enumT e_TextElideMode+ , test (qtVersion >= [4, 2]) $ mkProp "iconSize" $ objT c_QSize , just $ mkConstMethod "indexOf" [ptrT $ objT c_QWidget] intT , just $ mkMethod "insertTab" [intT, ptrT $ objT c_QWidget, objT c_QString] intT -- TODO insertTabWithIcon , just $ mkConstMethod "isTabEnabled" [intT] boolT+ , test (qtVersion >= [4, 5]) $ mkBoolIsProp "movable" , just $ mkMethod "removeTab" [intT] voidT , just $ mkMethod "setCornerWidget" [ptrT $ objT c_QWidget, enumT e_Corner] voidT , just $ mkMethod "setTabEnabled" [intT, boolT] voidT@@ -78,24 +85,16 @@ , just $ mkMethod "setTabToolTip" [intT, objT c_QString] voidT , test (qtVersion >= [4, 1]) $ mkMethod "setTabWhatsThis" [intT, objT c_QString] voidT -- TODO tabBar+ , test (qtVersion >= [5, 4]) $ mkProp "tabBarAutoHide" boolT -- TODO tabIcon+ , just $ mkProp "tabPosition" $ enumT e_TabPosition+ , just $ mkProp "tabShape" $ enumT e_TabShape , just $ mkConstMethod "tabText" [intT] $ objT c_QString , just $ mkConstMethod "tabToolTip" [intT] $ objT c_QString , just $ mkConstMethod "tabWhatsThis" [intT] $ objT c_QString- , just $ mkConstMethod "widget" [intT] $ ptrT $ objT c_QWidget- ] ++- (mkProps . collect)- [ just $ mkProp "currentIndex" intT- , just $ mkProp "currentWidget" $ ptrT $ objT c_QWidget- , test (qtVersion >= [4, 5]) $ mkProp "documentMode" boolT- , test (qtVersion >= [4, 2]) $ mkProp "elideMode" $ enumT e_TextElideMode- , test (qtVersion >= [4, 2]) $ mkProp "iconSize" $ objT c_QSize- , test (qtVersion >= [4, 5]) $ mkBoolIsProp "movable"- , test (qtVersion >= [5, 4]) $ mkProp "tabBarAutoHide" boolT- , just $ mkProp "tabPosition" $ enumT e_TabPosition- , just $ mkProp "tabShape" $ enumT e_TabShape , test (qtVersion >= [4, 5]) $ mkProp "tabsClosable" boolT , test (qtVersion >= [4, 2]) $ mkProp "usesScrollButtons" boolT+ , just $ mkConstMethod "widget" [intT] $ ptrT $ objT c_QWidget ] e_TabPosition =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QTextEdit.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportEnum, ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, ident1, includeStd,@@ -33,7 +34,6 @@ mkMethod, mkMethod', mkProp,- mkProps, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, intT, objT, ptrT, voidT) import Graphics.UI.Qtah.Generator.Interface.Core.QPoint (c_QPoint)@@ -41,13 +41,14 @@ import Graphics.UI.Qtah.Generator.Interface.Core.QString (c_QString) import Graphics.UI.Qtah.Generator.Interface.Core.Types (bs_Alignment, qreal) import Graphics.UI.Qtah.Generator.Interface.Gui.QColor (c_QColor)-import Graphics.UI.Qtah.Generator.Interface.Listener (+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener ( c_Listener, c_ListenerBool, ) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAbstractScrollArea (c_QAbstractScrollArea) import Graphics.UI.Qtah.Generator.Interface.Widgets.QMenu (c_QMenu) 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" #-}@@ -61,75 +62,73 @@ c_QTextEdit = addReqIncludes [includeStd "QTextEdit"] $+ classSetEntityPrefix "" $ makeClass (ident "QTextEdit") Nothing [c_QAbstractScrollArea] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] , mkCtor "newWithText" [objT c_QString] , mkCtor "newWithTextAndParent" [objT c_QString, ptrT $ objT c_QWidget]- ] $- [ mkConstMethod "anchorAt" [objT c_QPoint] $ objT c_QString+ , mkProp "acceptRichText" boolT+ , mkProp "alignment" $ bitspaceT bs_Alignment+ , mkConstMethod "anchorAt" [objT c_QPoint] $ objT c_QString , mkMethod "append" [objT c_QString] voidT+ -- TODO autoFormatting , mkConstMethod "canPaste" [] boolT , mkMethod "clear" [] voidT , mkMethod "copy" [] voidT , mkMethod' "createStandardContextMenu" "createStandardContextMenu" [] $ ptrT $ objT c_QMenu , mkMethod' "createStandardContextMenu" "createStandardContextMenuAt" [objT c_QPoint] $ ptrT $ objT c_QMenu+ -- TODO currentCharFormat+ -- TODO currentFont -- TODO cursorForPosition , mkConstMethod' "cursorRect" "cursorRect" [] $ objT c_QRect -- TODO cursorRect(const QTextCursor&)+ , mkProp "cursorWidth" intT , mkMethod "cut" [] voidT+ -- TODO document+ , mkProp "documentTitle" $ objT c_QString , mkMethod "ensureCursorVisible" [] voidT+ -- TODO extraSelections , mkMethod' "find" "find" [objT c_QString] boolT -- TODO find with FindFlags+ , mkProp "fontFamily" $ objT c_QString+ , mkProp "fontItalic" boolT+ , mkProp "fontPointSize" qreal+ , mkProp "fontUnderline" boolT+ , mkProp "fontWeight" intT , mkMethod "insertHtml" [objT c_QString] voidT , mkMethod "insertPlainText" [objT c_QString] voidT+ , mkProp "lineWrapColumnOrWidth" intT+ , mkProp "lineWrapMode" $ enumT e_LineWrapMode -- TODO loadResource -- TODO mergeCurrentCharFormat -- TODO moveCursor+ , mkProp "overwriteMode" boolT , mkMethod "paste" [] voidT -- TODO print+ , mkBoolIsProp "readOnly" , mkMethod "redo" [] voidT , mkMethod "scrollToAnchor" [objT c_QString] voidT , mkMethod "selectAll" [] voidT , mkMethod "setHtml" [objT c_QString] voidT , mkMethod "setPlainText" [objT c_QString] voidT , mkMethod "setText" [objT c_QString] voidT- , mkConstMethod "toHtml" [] $ objT c_QString- , mkConstMethod "toPlainText" [] $ objT c_QString- , mkMethod "undo" [] voidT- , mkMethod "zoomIn" [] voidT- , mkMethod' "zoomIn" "zoomInPoints" [intT] voidT- , mkMethod "zoomOut" [] voidT- , mkMethod' "zoomOut" "zoomOutPoints" [intT] voidT- ] ++- mkProps- [ mkProp "acceptRichText" boolT- , mkProp "alignment" $ bitspaceT bs_Alignment- -- TODO autoFormatting- -- TODO currentCharFormat- -- TODO currentFont- , mkProp "cursorWidth" intT- -- TODO document- , mkProp "documentTitle" $ objT c_QString- -- TODO extraSelections- , mkProp "fontFamily" $ objT c_QString- , mkProp "fontItalic" boolT- , mkProp "fontPointSize" qreal- , mkProp "fontUnderline" boolT- , mkProp "fontWeight" intT- , mkProp "lineWrapColumnOrWidth" intT- , mkProp "lineWrapMode" $ enumT e_LineWrapMode- , mkProp "overwriteMode" boolT- , mkBoolIsProp "readOnly" , mkProp "tabChangesFocus" boolT , mkProp "tabStopWidth" intT , mkProp "textBackgroundColor" $ objT c_QColor , mkProp "textColor" $ objT c_QColor -- TODO textCursor -- TODO textInteractionFlags+ , mkConstMethod "toHtml" [] $ objT c_QString+ , mkConstMethod "toPlainText" [] $ objT c_QString+ , mkMethod "undo" [] voidT , mkBoolIsProp "undoRedoEnabled" -- TODO wordWrapMode+ , mkMethod "zoomIn" [] voidT+ , mkMethod' "zoomIn" "zoomInPoints" [intT] voidT+ , mkMethod "zoomOut" [] voidT+ , mkMethod' "zoomOut" "zoomOutPoints" [intT] voidT ] signals =
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QVBoxLayout.hs view
@@ -22,6 +22,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -30,6 +31,7 @@ import Foreign.Hoppy.Generator.Types (objT, ptrT) import Graphics.UI.Qtah.Generator.Interface.Widgets.QBoxLayout (c_QBoxLayout) 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" #-}@@ -41,8 +43,8 @@ c_QVBoxLayout = addReqIncludes [includeStd "QVBoxLayout"] $+ classSetEntityPrefix "" $ makeClass (ident "QVBoxLayout") Nothing [c_QBoxLayout] [ mkCtor "new" [] , mkCtor "newWithParent" [ptrT $ objT c_QWidget] ]- []
src/Graphics/UI/Qtah/Generator/Interface/Widgets/QWidget.hs view
@@ -23,6 +23,7 @@ import Foreign.Hoppy.Generator.Spec ( Export (ExportClass), addReqIncludes,+ classSetEntityPrefix, ident, includeStd, makeClass,@@ -32,7 +33,6 @@ mkMethod, mkMethod', mkProp,- mkProps, mkStaticMethod, ) import Foreign.Hoppy.Generator.Types (bitspaceT, boolT, enumT, intT, objT, ptrT, voidT)@@ -52,9 +52,10 @@ e_WindowType, qreal, )-import Graphics.UI.Qtah.Generator.Interface.Listener (c_ListenerQPoint)+import Graphics.UI.Qtah.Generator.Interface.Internal.Listener (c_ListenerQPoint) import Graphics.UI.Qtah.Generator.Interface.Widgets.QAction (c_QAction) import Graphics.UI.Qtah.Generator.Interface.Widgets.QLayout (c_QLayout)+import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule) import Graphics.UI.Qtah.Generator.Types {-# ANN module "HLint: ignore Use camelCase" #-}@@ -67,13 +68,12 @@ c_QWidget = addReqIncludes [includeStd "QWidget"] $- makeClass (ident "QWidget") Nothing- [ c_QObject ]- [ mkCtor "new" []- , mkCtor "newWithParent" [ptrT $ objT c_QWidget]- ] $+ classSetEntityPrefix "" $+ makeClass (ident "QWidget") Nothing [c_QObject] $ collect- [ just $ mkConstMethod "acceptDrops" [] boolT+ [ just $ mkCtor "new" []+ , just $ mkCtor "newWithParent" [ptrT $ objT c_QWidget]+ , just $ mkConstMethod "acceptDrops" [] boolT , just $ mkConstMethod "accessibleDescription" [] $ objT c_QString , just $ mkConstMethod "accessibleName" [] $ objT c_QString -- TODO actions@@ -286,23 +286,21 @@ , just $ mkConstMethod "width" [] intT , just $ mkConstMethod "window" [] $ ptrT $ objT c_QWidget , just $ mkConstMethod "windowFilePath" [] $ objT c_QString+ , just $ mkProp "windowFlags" $ bitspaceT bs_WindowFlags -- TODO windowIcon , just $ mkConstMethod "windowIconText" [] $ objT c_QString+ , just $ mkProp "windowModality" $ enumT e_WindowModality+ , just $ mkProp "windowOpacity" qreal , just $ mkConstMethod "windowRole" [] $ objT c_QString -- TODO windowSurface+ , just $ mkProp "windowState" $ bitspaceT bs_WindowStates+ , just $ mkProp "windowTitle" $ objT c_QString , test (qtVersion < [5, 0]) $ mkConstMethod "windowType" [] $ enumT e_WindowType -- TODO winId , just $ mkConstMethod "x" [] intT -- TODO x11Info -- TODO x11PictureHandle , just $ mkConstMethod "y" [] intT- ] ++- mkProps- [ mkProp "windowFlags" $ bitspaceT bs_WindowFlags- , mkProp "windowModality" $ enumT e_WindowModality- , mkProp "windowOpacity" qreal- , mkProp "windowState" $ bitspaceT bs_WindowStates- , mkProp "windowTitle" $ objT c_QString ] signals =
src/Graphics/UI/Qtah/Generator/Module.hs view
@@ -18,17 +18,26 @@ {-# LANGUAGE CPP #-} module Graphics.UI.Qtah.Generator.Module (- generateModule,+ AModule (..),+ aModuleHoppyModules,+ QtModule,+ makeQtModule,+ makeQtModuleWithMinVersion,+ qtModulePath,+ qtModuleQtExports,+ qtModuleHoppy, ) where -import Control.Monad (forM_, unless, when)+import Control.Monad (unless) #if MIN_VERSION_mtl(2,2,1) import Control.Monad.Except (throwError) #else import Control.Monad.Error (throwError) #endif-import Data.List (find, intercalate, intersperse, isPrefixOf, sort)-import Data.Maybe (isJust)+import Data.Char (toLower)+import Data.Foldable (forM_)+import Data.List (find, intersperse, sort)+import Data.Maybe (isJust, mapMaybe) #if !MIN_VERSION_base(4,8,0) import Data.Monoid (mconcat) #endif@@ -38,29 +47,30 @@ HsTypeSide (HsHsSide), addExport, addExports,+ addExtension, addImports,+ askInterface, cppTypeToHsTypeAndUse,- execGenerator, getClassHaskellConversion,- importHsModuleForExtName,+ getModuleForExtName,+ getModuleName, indent, inFunction, ln, prettyPrint,- renderPartial, sayLn, saysLn,- toHsBitspaceClassName,- toHsBitspaceToNumName,- toHsBitspaceTypeName,- toHsBitspaceValueName,- toHsCastMethodName,- toHsDataTypeName,- toHsDownCastMethodName,- toHsEnumTypeName,- toHsFnName,- toHsPtrClassName,- toHsValueClassName,+ toHsBitspaceClassName',+ toHsBitspaceToNumName',+ toHsBitspaceTypeName',+ toHsBitspaceValueName',+ toHsCastMethodName',+ toHsDataTypeName',+ toHsDownCastMethodName',+ toHsEnumTypeName',+ toHsFnName',+ toHsPtrClassName',+ toHsValueClassName', ) import Foreign.Hoppy.Generator.Spec ( Class,@@ -70,42 +80,44 @@ ExtName, FnName (FnName), Function,- Interface, Method, MethodImpl (RealMethod),+ Module, Type (Internal_TCallback),- bitspaceExtName,+ addAddendumHaskell, bitspaceValueNames, callbackParams, classCtors,+ classEntityForeignName, classExtName,+ classHaskellConversionFromCppFn,+ classHaskellConversionToCppFn, classMethods, ctorExtName, ctorParams,- enumExtName, fnExtName, fromExtName,- getClassyExtName,+ getPrimaryExtName, hsImport1, hsImports,+ hsWholeModuleImport,+ makeModule, methodExtName, methodImpl,- toExtName,- varExtName,+ moduleAddExports,+ moduleAddHaskellName,+ moduleModify', varGetterExtName, varIsConst, varSetterExtName, ) import Foreign.Hoppy.Generator.Types (objT)-import Graphics.UI.Qtah.Generator.Flags (qrealFloat)-import Graphics.UI.Qtah.Generator.Common (fromMaybeM, writeFileIfDifferent)+import Graphics.UI.Qtah.Generator.Flags (Version, qrealFloat, qtVersion)+import Graphics.UI.Qtah.Generator.Common (fromMaybeM) import Graphics.UI.Qtah.Generator.Types ( QtExport (QtExport, QtExportEvent, QtExportFnRenamed, QtExportSignal, QtExportSpecials),- QtModule, Signal,- moduleNameAppend,- qtModulePath,- qtModuleQtExports,+ qtExportToExport, signalClass, signalCName, signalHaskellName,@@ -118,37 +130,78 @@ HsQualType (HsQualType), HsType (HsTyApp, HsTyCon, HsTyFun, HsTyVar), )-import System.Directory (createDirectoryIfMissing)-import System.Exit (exitFailure)-import System.FilePath ((</>), (<.>), pathSeparator, takeDirectory) -generateModule :: Interface -> FilePath -> String -> QtModule -> IO ()-generateModule iface srcDir baseModuleName qtModule = do- let fullModuleName = moduleNameAppend baseModuleName $ intercalate "." $ qtModulePath qtModule- qtExports = qtModuleQtExports qtModule+-- | A union of Hoppy and Qt modules.+data AModule = AHoppyModule Module | AQtModule QtModule - let generation =- fmap (("{-# LANGUAGE NoMonomorphismRestriction #-}\n\n" ++) . renderPartial) $- execGenerator iface fullModuleName $ do- -- As in generated Hoppy bindings, avoid non-qualified Prelude uses in- -- generated code here.- addImports $ hsImports "Prelude" []+aModuleHoppyModules :: AModule -> [Module]+aModuleHoppyModules (AHoppyModule m) = [m]+aModuleHoppyModules (AQtModule qm) = [qtModuleHoppy qm, qtModuleHoppyWrapper qm] - -- Generate bindings for all of the exports.- mapM_ (sayQtExport $ qtModulePath qtModule) qtExports+-- | A @QtModule@ (distinct from a Hoppy 'Module'), is a description of a+-- Haskell module in the @Graphics.UI.Qtah.Q@ namespace that:+--+-- 1. reexports 'Export's from a Hoppy module, dropping @ClassName_@+-- prefixes from the reexported names.+-- 2. generates Signal definitions for Qt signals.+data QtModule = QtModule+ { qtModulePath :: [String]+ , qtModuleQtExports :: [QtExport]+ -- ^ A list of exports whose generated Hoppy bindings will be re-exported in+ -- this module.+ , qtModuleHoppy :: Module+ , qtModuleHoppyWrapper :: Module+ } - case generation of- Left errorMsg -> do- putStrLn $ "Error generating Qt modules: " ++ errorMsg- exitFailure- Right source -> do- let path =- srcDir </>- map (\c -> if c == '.' then pathSeparator else c) fullModuleName <.>- "hs"- createDirectoryIfMissing True $ takeDirectory path- writeFileIfDifferent path source+makeQtModule :: [String] -> [QtExport] -> QtModule+makeQtModule [] _ = error "makeQtModule: Module path must be nonempty."+makeQtModule modulePath@(_:moduleNameParts) qtExports =+ let lowerName = map toLower $ concat moduleNameParts+ in QtModule+ { qtModulePath = modulePath+ , qtModuleQtExports = qtExports+ , qtModuleHoppy =+ moduleModify' (makeModule lowerName+ (concat ["b_", lowerName, ".hpp"])+ (concat ["b_", lowerName, ".cpp"])) $ do+ moduleAddHaskellName $ "Generated" : modulePath+ moduleAddExports $ mapMaybe qtExportToExport qtExports+ , qtModuleHoppyWrapper =+ addAddendumHaskell (sayWrapperModule modulePath qtExports) $+ moduleModify' (makeModule (lowerName ++ "wrap")+ (concat ["b_", lowerName, "_w.hpp"])+ (concat ["b_", lowerName, "_w.cpp"])) $+ moduleAddHaskellName modulePath+ } +-- | Creates a 'QtModule' (a la 'makeQtModule') that has a minimum version+-- applied to all of its contents. If Qtah is being built against a version of+-- Qt below this minimum version, then the module will still be generated, but+-- it will be empty; the exports list will be replaced with an empty list.+makeQtModuleWithMinVersion :: [String] -> Version -> [QtExport] -> QtModule+makeQtModuleWithMinVersion modulePath minVersion qtExports =+ makeQtModule modulePath $+ if qtVersion >= minVersion then qtExports else []++sayWrapperModule :: [String] -> [QtExport] -> Generator ()+sayWrapperModule modulePath qtExports = inFunction "<Qtah generateModule>" $ do+ addExtension "NoMonomorphismRestriction"++ -- As in generated Hoppy bindings, avoid non-qualified Prelude uses in+ -- generated code here.+ addImports $ hsImports "Prelude" []++ -- Import the underlying Hoppy module wholesale.+ case mapMaybe qtExportToExport qtExports of+ [] -> return ()+ export:_ -> importWholeModuleForExtName $ getPrimaryExtName export++ -- Generate bindings for all of the exports.+ mapM_ (sayQtExport modulePath) qtExports++getFnImportName :: Function -> String+getFnImportName = toHsFnName' . fnExtName+ getFnReexportName :: Function -> String getFnReexportName = getFnImportName @@ -170,81 +223,59 @@ classDecodeReexportName :: String classDecodeReexportName = "decode" -getCtorReexportName :: Class -> Ctor -> String-getCtorReexportName cls = toBindingNameWithoutClassPrefix cls . ctorExtName--getMethodReexportName :: Class -> Method -> String-getMethodReexportName cls = toBindingNameWithoutClassPrefix cls . methodExtName---- | Qtah uses @ClassName_innerName@ 'ExtName's for things in classes. This--- function strips the @ClassName_@ prefix off of an 'ExtName', if present, and--- converts it to a function name.-toBindingNameWithoutClassPrefix :: Class -> ExtName -> String-toBindingNameWithoutClassPrefix cls name =- toHsFnName $ toExtName $- dropPrefix (fromExtName (classExtName cls) ++ "_") $- fromExtName name---- | @dropPrefix prefix str@ strips @prefix@ from @str@ if @str@ starts with--- @prefix@, and returns @str@ unmodified otherwise.-dropPrefix :: String -> String -> String-dropPrefix prefix str =- if prefix `isPrefixOf` str- then drop (length prefix) str- else str+getCtorReexportName :: Ctor -> String+getCtorReexportName = toHsFnName' . ctorExtName -getFnImportName :: Function -> String-getFnImportName = toHsFnName . fnExtName+getMethodReexportName :: Method -> String+getMethodReexportName = toHsFnName' . methodExtName sayClassEncodingFnReexports :: Class -> Generator ()-sayClassEncodingFnReexports cls = inFunction "sayClassEncodingFnReexports" $- when (classIsConvertible cls) $ do- -- Generated encode and decode functions require some things from Hoppy- -- support and the Prelude.- addImports $ mconcat [importForPrelude, importForRuntime]+sayClassEncodingFnReexports cls = inFunction "sayClassEncodingFnReexports" $ do+ let conv = getClassHaskellConversion cls + forM_ (classHaskellConversionToCppFn conv) $ \_ -> do hsHsType <- cppTypeToHsTypeAndUse HsHsSide (objT cls)- let constPtrClassName = toHsPtrClassName Const cls- dataTypeName = toHsDataTypeName Nonconst cls+ let dataTypeName = toHsDataTypeName' Nonconst cls ptrHsType = HsTyCon $ UnQual $ HsIdent dataTypeName- thisTyVar = HsTyVar $ HsIdent "this" encodeFnType = HsTyFun hsHsType $ HsTyApp (HsTyCon $ UnQual $ HsIdent "QtahP.IO") ptrHsType- decodeFnType = HsQualType [(UnQual $ HsIdent constPtrClassName, [thisTyVar])] $- HsTyFun thisTyVar $- HsTyApp (HsTyCon $ UnQual $ HsIdent "QtahP.IO") hsHsType+ addImports $ mconcat [importForPrelude, importForRuntime] ln saysLn [classEncodeReexportName, " :: ", prettyPrint encodeFnType] saysLn [classEncodeReexportName, " = QtahFHR.encodeAs (QtahP.undefined :: ", dataTypeName, ")"]++ forM_ (classHaskellConversionFromCppFn conv) $ \_ -> do+ hsHsType <- cppTypeToHsTypeAndUse HsHsSide (objT cls)+ let constPtrClassName = toHsPtrClassName' Const cls+ thisTyVar = HsTyVar $ HsIdent "this"+ decodeFnType = HsQualType [(UnQual $ HsIdent constPtrClassName, [thisTyVar])] $+ HsTyFun thisTyVar $+ HsTyApp (HsTyCon $ UnQual $ HsIdent "QtahP.IO") hsHsType+ addImports $ mconcat [importForPrelude, importForRuntime] ln saysLn [classDecodeReexportName, " :: ", prettyPrint decodeFnType]- saysLn [classDecodeReexportName, " = QtahFHR.decode QtahP.. ", toHsCastMethodName Const cls]+ saysLn [classDecodeReexportName, " = QtahFHR.decode QtahP.. ", toHsCastMethodName' Const cls] sayQtExport :: [String] -> QtExport -> Generator () sayQtExport path qtExport = case qtExport of QtExport (ExportVariable v) -> do- importHsModuleForExtName $ varExtName v- addExport $ toHsFnName $ varGetterExtName v- unless (varIsConst v) $ addExport $ toHsFnName $ varSetterExtName v+ addExport $ toHsFnName' $ varGetterExtName v+ unless (varIsConst v) $ addExport $ toHsFnName' $ varSetterExtName v QtExport (ExportEnum e) -> do- importHsModuleForExtName $ enumExtName e- let spec = toHsEnumTypeName e ++ " (..)"+ let spec = toHsEnumTypeName' e ++ " (..)" addExport spec QtExport (ExportBitspace b) -> do- importHsModuleForExtName $ bitspaceExtName b- addExport $ toHsBitspaceTypeName b- addExport $ toHsBitspaceToNumName b- addExport $ toHsBitspaceClassName b ++ " (..)"+ addExport $ toHsBitspaceTypeName' b+ addExport $ toHsBitspaceToNumName' b+ addExport $ toHsBitspaceClassName' b ++ " (..)" forM_ (bitspaceValueNames b) $ \(_, valueName) ->- addExport $ toHsBitspaceValueName b valueName+ addExport $ toHsBitspaceValueName' b valueName QtExport (ExportFn fn) -> do- importHsModuleForExtName $ fnExtName fn addExport $ getFnReexportName fn QtExportFnRenamed fn rename -> do- importHsModuleForExtName $ fnExtName fn addExport rename sayBind rename $ getFnImportName fn @@ -257,7 +288,7 @@ QtExportEvent cls -> do sayExportClass cls - let typeName = toHsDataTypeName Nonconst cls+ let typeName = toHsDataTypeName' Nonconst cls addImports $ mconcat [hsImport1 "Prelude" "($)", importForEvent] ln@@ -283,34 +314,34 @@ sayExportClass :: Class -> Generator () sayExportClass cls = do- importHsModuleForExtName $ classExtName cls addExports $- (toHsValueClassName cls ++ " (..)") :- (toHsPtrClassName Const cls ++ " (..)") :- (toHsPtrClassName Nonconst cls ++ " (..)") :- toHsDataTypeName Const cls :- toHsDataTypeName Nonconst cls :+ (toHsValueClassName' cls ++ " (..)") :+ (toHsPtrClassName' Const cls ++ " (..)") :+ (toHsPtrClassName' Nonconst cls ++ " (..)") :+ toHsDataTypeName' Const cls :+ toHsDataTypeName' Nonconst cls : classUpCastConstReexportName : classUpCastReexportName : classDownCastConstReexportName : classDownCastReexportName :- concat [ if classIsConvertible cls- then [classEncodeReexportName, classDecodeReexportName]+ concat [ if isJust $ classHaskellConversionToCppFn $ getClassHaskellConversion cls+ then [classEncodeReexportName] else []- , sort $ map (getCtorReexportName cls) $ classCtors cls- , sort $ map (getMethodReexportName cls) $ classMethods cls+ , if isJust $ classHaskellConversionFromCppFn $ getClassHaskellConversion cls+ then [classDecodeReexportName]+ else []+ , sort $ map getCtorReexportName $ classCtors cls+ , sort $ map getMethodReexportName $ classMethods cls ] ln- sayBind classUpCastConstReexportName $ toHsCastMethodName Const cls- sayBind classUpCastReexportName $ toHsCastMethodName Nonconst cls- sayBind classDownCastConstReexportName $ toHsDownCastMethodName Const cls- sayBind classDownCastReexportName $ toHsDownCastMethodName Nonconst cls+ sayBind classUpCastConstReexportName $ toHsCastMethodName' Const cls+ sayBind classUpCastReexportName $ toHsCastMethodName' Nonconst cls+ sayBind classDownCastConstReexportName $ toHsDownCastMethodName' Const cls+ sayBind classDownCastReexportName $ toHsDownCastMethodName' Nonconst cls sayClassEncodingFnReexports cls- forM_ (classCtors cls) $ \ctor ->- sayBind (getCtorReexportName cls ctor) $ toHsFnName $ getClassyExtName cls ctor- forM_ (classMethods cls) $ \method ->- sayBind (getMethodReexportName cls method) $ toHsFnName $ getClassyExtName cls method+ -- Class constructors and methods don't need to be rebound, because their+ -- names don't change. -- | Generates and exports a @Signal@ definition. We create the signal from -- scratch in this module, rather than reexporting it from somewhere else.@@ -320,12 +351,12 @@ let name = signalCName signal cls = signalClass signal- ptrClassName = toHsPtrClassName Nonconst cls+ ptrClassName = toHsPtrClassName' Nonconst cls varName = toSignalBindingName signal addExport varName let listenerClass = signalListenerClass signal- importHsModuleForExtName $ classExtName listenerClass+ importWholeModuleForExtName $ classExtName listenerClass -- Find the listener constructor that only takes a callback. listenerCtor <- fromMaybeM (throwError $ concat@@ -365,8 +396,9 @@ indent $ do sayLn "{ QtahSignal.internalConnectSignal = \\object' fn' -> do" indent $ do- saysLn ["listener' <- ", toHsFnName $ getClassyExtName listenerClass listenerCtor, " fn'"]- saysLn [toHsFnName $ getClassyExtName listenerClass listenerConnectMethod,+ saysLn ["listener' <- ",+ toHsFnName' $ classEntityForeignName listenerClass listenerCtor, " fn'"]+ saysLn [toHsFnName' $ classEntityForeignName listenerClass listenerConnectMethod, " listener' object' ", show (toSignalConnectName signal paramTypes)] saysLn [", QtahSignal.internalName = ", show internalName] sayLn "}"@@ -386,7 +418,7 @@ intersperse "," (map (execChunkWriter . sayType Nothing) paramTypes) ++ [")"] --- | Returns true iff a given class is convertible to/from a Haskell--- type with @encode@ and @decode@.-classIsConvertible :: Class -> Bool-classIsConvertible = isJust . getClassHaskellConversion+importWholeModuleForExtName :: ExtName -> Generator ()+importWholeModuleForExtName extName = do+ iface <- askInterface+ addImports . hsWholeModuleImport . getModuleName iface =<< getModuleForExtName extName
src/Graphics/UI/Qtah/Generator/Types.hs view
@@ -16,24 +16,14 @@ -- along with this program. If not, see <http://www.gnu.org/licenses/>. module Graphics.UI.Qtah.Generator.Types (- moduleNameAppend,- AModule (..),- aModuleHoppy,- QtModule,- makeQtModule,- makeQtModuleWithMinVersion,- qtModulePath,- qtModuleQtExports,- qtModuleHoppy, QtExport (..),+ qtExportToExport, makeQtEnum, makeQtEnumBitspace, Signal, makeSignal, makeSignal', signalCName, signalHaskellName, signalClass, signalListenerClass, ) where -import Data.Char (toLower)-import Data.Maybe (mapMaybe) import Foreign.Hoppy.Generator.Spec ( Bitspace, Class,@@ -42,84 +32,21 @@ Function, Identifier, Include,- Module, addReqIncludes, bitspaceAddCppType, bitspaceAddEnum,+ bitspaceSetValuePrefix,+ enumSetValuePrefix, identifierParts, identT, idPartBase, includeStd, makeBitspace, makeEnum,- makeModule,- moduleAddExports,- moduleAddHaskellName,- moduleModify', toExtName, ) import Foreign.Hoppy.Generator.Types (enumT, intT)-import Graphics.UI.Qtah.Generator.Flags (Version, qtVersion) -moduleNameAppend :: String -> String -> String-moduleNameAppend "" y = y-moduleNameAppend x "" = x-moduleNameAppend x y = concat [x, ".", y]---- | A union of Hoppy and Qt modules.-data AModule = AHoppyModule Module | AQtModule QtModule---- | Extracts the Hoppy 'Module' for an 'AModule'.-aModuleHoppy :: AModule -> Module-aModuleHoppy (AHoppyModule m) = m-aModuleHoppy (AQtModule qm) = qtModuleHoppy qm---- | A @QtModule@ (distinct from a Hoppy 'Module'), is a description of a--- Haskell module in the @Graphics.UI.Qtah.Q@ namespace that:------ 1. reexports 'Export's from a Hoppy module, dropping @ClassName_@--- prefixes from the reexported names.--- 2. generates Signal definitions for Qt signals.-data QtModule = QtModule- { qtModulePath :: [String]- , qtModuleQtExports :: [QtExport]- -- ^ A list of exports whose generated Hoppy bindings will be re-exported in- -- this module.- , qtModuleHoppy :: Module- }--makeQtModule :: [String] -> [QtExport] -> QtModule-makeQtModule [] _ = error "makeQtModule: Module path must be nonempty."-makeQtModule modulePath@(_:moduleNameParts) qtExports =- let lowerName = map toLower $ concat moduleNameParts- in QtModule- { qtModulePath = modulePath- , qtModuleQtExports = qtExports- , qtModuleHoppy =- moduleModify' (makeModule lowerName- (concat ["b_", lowerName, ".hpp"])- (concat ["b_", lowerName, ".cpp"])) $ do- moduleAddHaskellName modulePath- moduleAddExports $ mapMaybe qtExportToExport qtExports- }---- | Creates a 'QtModule' (a la 'makeQtModule') that has a minimum version--- applied to all of its contents. If Qtah is being built against a version of--- Qt below this minimum version, then the module will still be generated, but--- it will be empty; the exports list will be replaced with an empty list.-makeQtModuleWithMinVersion :: [String] -> Version -> [QtExport] -> QtModule-makeQtModuleWithMinVersion modulePath minVersion qtExports =- makeQtModule modulePath $- if qtVersion >= minVersion then qtExports else []--qtExportToExport :: QtExport -> Maybe Export-qtExportToExport qtExport = case qtExport of- QtExport export -> Just export- QtExportFnRenamed fn _ -> Just $ ExportFn fn- QtExportSignal {} -> Nothing- QtExportEvent cls -> Just $ ExportClass cls- QtExportSpecials -> Nothing- data QtExport = QtExport Export | QtExportFnRenamed Function String@@ -129,11 +56,20 @@ -- ^ This is a special value that is exported exactly once, and generates -- some bindings that need special logic. +qtExportToExport :: QtExport -> Maybe Export+qtExportToExport qtExport = case qtExport of+ QtExport export -> Just export+ QtExportFnRenamed fn _ -> Just $ ExportFn fn+ QtExportSignal {} -> Nothing+ QtExportEvent cls -> Just $ ExportClass cls+ QtExportSpecials -> Nothing+ -- | Creates a 'CppEnum' whose 'ExtName' is the concatenation of all part of its -- 'Identifier'. This should be used for all Qt enums. makeQtEnum :: Identifier -> [Include] -> [(Int, [String])] -> CppEnum makeQtEnum identifier includes valueNames = addReqIncludes includes $+ enumSetValuePrefix "" $ makeEnum identifier (Just $ toExtName $ concat $ map idPartBase $ identifierParts identifier) valueNames@@ -152,6 +88,7 @@ (Just "QFlag") (Just "int") $ bitspaceAddEnum enum $+ bitspaceSetValuePrefix "" $ makeBitspace bitspaceExtName intT valueNames) where replaceLast _ [] = [] replaceLast y [_] = [y]
src/Main.hs view
@@ -17,9 +17,8 @@ module Main where -import Data.Foldable (forM_) import Data.List (intercalate)-import Foreign.Hoppy.Generator.Main (Action (GenHaskell), run)+import Foreign.Hoppy.Generator.Main (run) import Foreign.Hoppy.Generator.Spec ( Interface, Module,@@ -30,15 +29,11 @@ moduleSetHppPath, ) import qualified Foreign.Hoppy.Generator.Std as Std-import Graphics.UI.Qtah.Generator.Flags (qtVersion)-import Graphics.UI.Qtah.Generator.Common (maybeFail)+import Graphics.UI.Qtah.Generator.Flags (qmakeArguments, qmakeExecutable, qtVersion) import Graphics.UI.Qtah.Generator.Module-import Graphics.UI.Qtah.Generator.Types-import qualified Graphics.UI.Qtah.Generator.Interface.Callback as Callback import qualified Graphics.UI.Qtah.Generator.Interface.Core as Core-import qualified Graphics.UI.Qtah.Generator.Interface.EventListener as EventListener import qualified Graphics.UI.Qtah.Generator.Interface.Gui as Gui-import qualified Graphics.UI.Qtah.Generator.Interface.Listener as Listener+import qualified Graphics.UI.Qtah.Generator.Interface.Internal as Internal import qualified Graphics.UI.Qtah.Generator.Interface.Widgets as Widgets import System.Environment (getArgs) import System.Exit (exitFailure)@@ -57,19 +52,17 @@ modules = concat [ [ AHoppyModule mod_std- , Callback.aModule- , EventListener.aModule- , Listener.aModule ] , Core.modules , Gui.modules+ , Internal.modules , Widgets.modules ] interfaceResult :: Either String Interface interfaceResult =- interfaceAddHaskellModuleBase ["Graphics", "UI", "Qtah", "Generated"] =<<- interface "qtah" (map aModuleHoppy modules)+ interfaceAddHaskellModuleBase ["Graphics", "UI", "Qtah"] =<<+ interface "qtah" (concatMap aModuleHoppyModules modules) main :: IO () main =@@ -81,20 +74,10 @@ args <- getArgs case args of ["--qt-version"] -> putStrLn $ intercalate "." $ map show qtVersion+ ["--qmake-executable"] -> putStrLn $ unlines $ qmakeExecutable : qmakeArguments _ -> do- actions <- run [iface] args- forM_ actions $ \action -> case action of- GenHaskell path -> do- -- Generate nicely-named Qt modules that will point to the bindings,- -- and also contain signal definitions.- srcDir <- maybeFail ("Couldn't find src directory for path " ++ show path ++- " to generate Qt modules.") $- findSrcDir path- forM_ modules $ \aModule -> case aModule of- AHoppyModule _ -> return ()- AQtModule qm -> generateModule iface srcDir "Graphics.UI.Qtah" qm-- _ -> return ()+ _ <- run [iface] args+ return () findSrcDir :: FilePath -> Maybe FilePath findSrcDir = go . dropTrailingPathSeparator