qtah-generator-0.9.0: src/Graphics/UI/Qtah/Generator/Interface/Gui/QTextDocument.hs
-- This file is part of Qtah.
--
-- Copyright 2024 The Qtah Authors.
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
module Graphics.UI.Qtah.Generator.Interface.Gui.QTextDocument (
aModule,
c_QTextDocument,
) where
import Foreign.Hoppy.Generator.Spec (
(~:),
addReqIncludes,
classSetEntityPrefix,
ident,
includeStd,
makeClass,
mkBoolIsProp,
mkConstMethod,
mkCtor,
mkMethod,
mkMethod',
mkProp,
np,
)
import Foreign.Hoppy.Generator.Types (boolT, enumT, intT, objT, ptrT, voidT)
import Foreign.Hoppy.Generator.Version (collect, just, test)
import Graphics.UI.Qtah.Generator.Config (qtVersion)
import Graphics.UI.Qtah.Generator.Interface.Core.Types (e_CursorMoveStyle, qreal)
import Graphics.UI.Qtah.Generator.Interface.Core.QChar (c_QChar)
import Graphics.UI.Qtah.Generator.Interface.Core.QObject (c_QObject)
import Graphics.UI.Qtah.Generator.Interface.Core.QRectF (c_QRectF)
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.Internal.Listener (
listener,
listenerBool,
listenerInt,
listenerIntIntInt,
listenerQUrl,
)
import Graphics.UI.Qtah.Generator.Interface.Core.QUrl (c_QUrl)
import Graphics.UI.Qtah.Generator.Interface.Core.QVariant (c_QVariant)
import Graphics.UI.Qtah.Generator.Interface.Gui.QFont (c_QFont)
import Graphics.UI.Qtah.Generator.Interface.Gui.QPainter (c_QPainter)
import Graphics.UI.Qtah.Generator.Module (AModule (AQtModule), makeQtModule)
import Graphics.UI.Qtah.Generator.Types
{-# ANN module "HLint: ignore Use camelCase" #-}
aModule =
AQtModule $
makeQtModule ["Gui", "QTextDocument"]
[ QtExportClassAndSignals c_QTextDocument signals ]
(c_QTextDocument, signals) =
makeQtClassAndSignals signalGens $
addReqIncludes [includeStd "QTextDocument"] $
classSetEntityPrefix "" $
makeClass (ident "QTextDocument") Nothing [c_QObject] $
collect
[ just $ mkCtor "new" np
, just $ mkCtor "newWithParent" [ptrT $ objT c_QObject]
, just $ mkCtor "newWithString" [objT c_QString]
, just $ mkCtor "newWithStringAndParent" [objT c_QString, ptrT $ objT c_QObject]
, just $ mkMethod "addResource" [intT, objT c_QUrl, objT c_QVariant] voidT
, just $ mkMethod "adjustSize" np voidT
-- TODO allFormats
, just $ mkConstMethod "availableRedoSteps" np intT
, just $ mkConstMethod "availableUndoSteps" np intT
, just $ mkProp "baseUrl" $ objT c_QUrl
, test (qtVersion >= [6]) $ mkConstMethod "baselineOffset" np qreal
-- TODO begin
, just $ mkConstMethod "blockCount" np intT
, just $ mkConstMethod "characterAt" [intT] $ objT c_QChar
, just $ mkConstMethod "characterCount" np intT
, just $ mkMethod "clear" np voidT
-- TODO clearUndoRedoStacks
, just $ mkMethod "clone" [ptrT $ objT c_QObject] voidT
, just $ mkProp "defaultCursorMoveStyle" $ enumT e_CursorMoveStyle
, just $ mkProp "defaultFont" $ objT c_QFont
-- TODO defaultResourceProvider (>= 6.1)
, just $ mkProp "defaultStyleSheet" $ objT c_QString
-- TODO defaultTextOption (prop)
-- TODO documentLayout (prop)
, just $ mkProp "documentMargin" qreal
, just $ mkMethod' "drawContents" "drawContents" [ptrT $ objT c_QPainter] voidT
, just $ mkMethod' "drawContents" "drawContentsWithRect"
[ptrT $ objT c_QPainter, objT c_QRectF] voidT
-- TODO end
-- TODO find
-- TODO findBlock*
-- TODO firstBlock
, just $ mkConstMethod "idealWidth" np qreal
, just $ mkProp "indentWidth" qreal
, just $ mkConstMethod "isEmpty" np boolT
, just $ mkConstMethod "isRedoAvailable" np boolT
, just $ mkConstMethod "isUndoAvailable" np boolT
-- TODO lastBlock
-- TODO layoutEnabled (prop, >= 6.4) - not accessible?
, just $ mkConstMethod "lineCount" np intT
, just $ mkMethod "markContentsDirty" ["position" ~: intT, "length" ~: intT] voidT
, just $ mkProp "maximumBlockCount" intT
-- TODO metaInformation (prop)
, just $ mkBoolIsProp "modified"
-- TODO object
-- TODO objectForFormat
, just $ mkConstMethod "pageCount" np intT
, just $ mkProp "pageSize" $ objT c_QSizeF
-- TODO print
, just $ mkMethod "redo" np voidT
-- TODO redo(QTextCursor*)
, just $ mkConstMethod "resource" [intT, objT c_QUrl] $ objT c_QVariant
-- TODO resourceProvider (>= 6.1)
, just $ mkConstMethod "revision" np intT
-- TODO rootFrame
-- TODO setDefaultResourceProvider (>= 6.1)
, just $ mkMethod "setHtml" [objT c_QString] voidT
, just $ mkMethod "setMarkdown" [objT c_QString] voidT
-- TODO setMarkdown(QString, QTextDocument::MarkdownFeatures)
, just $ mkMethod "setPlainText" [objT c_QString] voidT
-- TODO setResourceProvider (>= 6.1)
, test (qtVersion >= [6]) $ mkProp "subScriptBaseline" qreal
, test (qtVersion >= [6]) $ mkProp "superScriptBaseline" qreal
, just $ mkConstMethod "size" np $ objT c_QSizeF
, just $ mkProp "textWidth" qreal
, just $ mkConstMethod "toMarkdown" np voidT
-- TODO toMarkdown(QTextDocument::MarkdownFeatures)
, just $ mkMethod "undo" np voidT
-- TODO undo(QTextCursor*)
, just $ mkBoolIsProp "undoRedoEnabled"
, just $ mkProp "useDesignMetrics" boolT
]
signalGens :: [SignalGen]
signalGens =
[ makeSignal "baseUrlChanged" listenerQUrl
, makeSignal "blockCountChanged" listenerInt
, makeSignal "contentsChange" listenerIntIntInt
, makeSignal "contentsChanged" listener
-- TODO cursorPositionChanged
, makeSignal "documentLayoutChanged" listener
, makeSignal "modificationChanged" listenerBool
, makeSignal "redoAvailable" listenerBool
, makeSignal "undoAvailable" listenerBool
, makeSignal "undoCommandAdded" listener
]
-- TODO FindFlag, FindFlags
-- TODO MarkdownFeatures (definition not present in Qt docs?)
-- TODO MetaInformation
-- TODO ResourceProvider (>= 6.1)
-- TODO ResourceType
-- TODO Stacks