module GI.WebKit.Interfaces.SpellChecker
(
SpellChecker(..) ,
noSpellChecker ,
IsSpellChecker ,
toSpellChecker ,
SpellCheckerCheckSpellingOfStringMethodInfo,
spellCheckerCheckSpellingOfString ,
SpellCheckerGetAutocorrectSuggestionsForMisspelledWordMethodInfo,
spellCheckerGetAutocorrectSuggestionsForMisspelledWord,
SpellCheckerGetGuessesForWordMethodInfo ,
spellCheckerGetGuessesForWord ,
SpellCheckerIgnoreWordMethodInfo ,
spellCheckerIgnoreWord ,
SpellCheckerLearnWordMethodInfo ,
spellCheckerLearnWord ,
SpellCheckerUpdateSpellCheckingLanguagesMethodInfo,
spellCheckerUpdateSpellCheckingLanguages,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GI.GObject.Objects.Object as GObject.Object
newtype SpellChecker = SpellChecker (ManagedPtr SpellChecker)
noSpellChecker :: Maybe SpellChecker
noSpellChecker = Nothing
type instance O.SignalList SpellChecker = SpellCheckerSignalList
type SpellCheckerSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "webkit_spell_checker_get_type"
c_webkit_spell_checker_get_type :: IO GType
instance GObject SpellChecker where
gobjectType _ = c_webkit_spell_checker_get_type
class GObject o => IsSpellChecker o
#if MIN_VERSION_base(4,9,0)
instance (GObject a, O.UnknownAncestorError SpellChecker a) =>
IsSpellChecker a
#endif
instance IsSpellChecker SpellChecker
instance GObject.Object.IsObject SpellChecker
toSpellChecker :: IsSpellChecker o => o -> IO SpellChecker
toSpellChecker = unsafeCastTo SpellChecker
instance O.HasAttributeList SpellChecker
type instance O.AttributeList SpellChecker = SpellCheckerAttributeList
type SpellCheckerAttributeList = ('[ ] :: [(Symbol, *)])
type family ResolveSpellCheckerMethod (t :: Symbol) (o :: *) :: * where
ResolveSpellCheckerMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveSpellCheckerMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveSpellCheckerMethod "checkSpellingOfString" o = SpellCheckerCheckSpellingOfStringMethodInfo
ResolveSpellCheckerMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveSpellCheckerMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveSpellCheckerMethod "ignoreWord" o = SpellCheckerIgnoreWordMethodInfo
ResolveSpellCheckerMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveSpellCheckerMethod "learnWord" o = SpellCheckerLearnWordMethodInfo
ResolveSpellCheckerMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveSpellCheckerMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveSpellCheckerMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveSpellCheckerMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveSpellCheckerMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
ResolveSpellCheckerMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
ResolveSpellCheckerMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveSpellCheckerMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveSpellCheckerMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveSpellCheckerMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveSpellCheckerMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveSpellCheckerMethod "updateSpellCheckingLanguages" o = SpellCheckerUpdateSpellCheckingLanguagesMethodInfo
ResolveSpellCheckerMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveSpellCheckerMethod "getAutocorrectSuggestionsForMisspelledWord" o = SpellCheckerGetAutocorrectSuggestionsForMisspelledWordMethodInfo
ResolveSpellCheckerMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveSpellCheckerMethod "getGuessesForWord" o = SpellCheckerGetGuessesForWordMethodInfo
ResolveSpellCheckerMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveSpellCheckerMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveSpellCheckerMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveSpellCheckerMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveSpellCheckerMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveSpellCheckerMethod t SpellChecker, O.MethodInfo info SpellChecker p) => O.IsLabelProxy t (SpellChecker -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveSpellCheckerMethod t SpellChecker, O.MethodInfo info SpellChecker p) => O.IsLabel t (SpellChecker -> p) where
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
foreign import ccall "webkit_spell_checker_check_spelling_of_string" webkit_spell_checker_check_spelling_of_string ::
Ptr SpellChecker ->
CString ->
Ptr Int32 ->
Ptr Int32 ->
IO ()
spellCheckerCheckSpellingOfString ::
(B.CallStack.HasCallStack, MonadIO m, IsSpellChecker a) =>
a
-> T.Text
-> m (Int32,Int32)
spellCheckerCheckSpellingOfString checker string = liftIO $ do
checker' <- unsafeManagedPtrCastPtr checker
string' <- textToCString string
misspellingLocation <- allocMem :: IO (Ptr Int32)
misspellingLength <- allocMem :: IO (Ptr Int32)
webkit_spell_checker_check_spelling_of_string checker' string' misspellingLocation misspellingLength
misspellingLocation' <- peek misspellingLocation
misspellingLength' <- peek misspellingLength
touchManagedPtr checker
freeMem string'
freeMem misspellingLocation
freeMem misspellingLength
return (misspellingLocation', misspellingLength')
data SpellCheckerCheckSpellingOfStringMethodInfo
instance (signature ~ (T.Text -> m (Int32,Int32)), MonadIO m, IsSpellChecker a) => O.MethodInfo SpellCheckerCheckSpellingOfStringMethodInfo a signature where
overloadedMethod _ = spellCheckerCheckSpellingOfString
foreign import ccall "webkit_spell_checker_get_autocorrect_suggestions_for_misspelled_word" webkit_spell_checker_get_autocorrect_suggestions_for_misspelled_word ::
Ptr SpellChecker ->
CString ->
IO CString
spellCheckerGetAutocorrectSuggestionsForMisspelledWord ::
(B.CallStack.HasCallStack, MonadIO m, IsSpellChecker a) =>
a
-> T.Text
-> m T.Text
spellCheckerGetAutocorrectSuggestionsForMisspelledWord checker word = liftIO $ do
checker' <- unsafeManagedPtrCastPtr checker
word' <- textToCString word
result <- webkit_spell_checker_get_autocorrect_suggestions_for_misspelled_word checker' word'
checkUnexpectedReturnNULL "spellCheckerGetAutocorrectSuggestionsForMisspelledWord" result
result' <- cstringToText result
freeMem result
touchManagedPtr checker
freeMem word'
return result'
data SpellCheckerGetAutocorrectSuggestionsForMisspelledWordMethodInfo
instance (signature ~ (T.Text -> m T.Text), MonadIO m, IsSpellChecker a) => O.MethodInfo SpellCheckerGetAutocorrectSuggestionsForMisspelledWordMethodInfo a signature where
overloadedMethod _ = spellCheckerGetAutocorrectSuggestionsForMisspelledWord
foreign import ccall "webkit_spell_checker_get_guesses_for_word" webkit_spell_checker_get_guesses_for_word ::
Ptr SpellChecker ->
CString ->
CString ->
IO (Ptr CString)
spellCheckerGetGuessesForWord ::
(B.CallStack.HasCallStack, MonadIO m, IsSpellChecker a) =>
a
-> T.Text
-> Maybe (T.Text)
-> m [T.Text]
spellCheckerGetGuessesForWord checker word context = liftIO $ do
checker' <- unsafeManagedPtrCastPtr checker
word' <- textToCString word
maybeContext <- case context of
Nothing -> return nullPtr
Just jContext -> do
jContext' <- textToCString jContext
return jContext'
result <- webkit_spell_checker_get_guesses_for_word checker' word' maybeContext
checkUnexpectedReturnNULL "spellCheckerGetGuessesForWord" result
result' <- unpackZeroTerminatedUTF8CArray result
mapZeroTerminatedCArray freeMem result
freeMem result
touchManagedPtr checker
freeMem word'
freeMem maybeContext
return result'
data SpellCheckerGetGuessesForWordMethodInfo
instance (signature ~ (T.Text -> Maybe (T.Text) -> m [T.Text]), MonadIO m, IsSpellChecker a) => O.MethodInfo SpellCheckerGetGuessesForWordMethodInfo a signature where
overloadedMethod _ = spellCheckerGetGuessesForWord
foreign import ccall "webkit_spell_checker_ignore_word" webkit_spell_checker_ignore_word ::
Ptr SpellChecker ->
CString ->
IO ()
spellCheckerIgnoreWord ::
(B.CallStack.HasCallStack, MonadIO m, IsSpellChecker a) =>
a
-> T.Text
-> m ()
spellCheckerIgnoreWord checker word = liftIO $ do
checker' <- unsafeManagedPtrCastPtr checker
word' <- textToCString word
webkit_spell_checker_ignore_word checker' word'
touchManagedPtr checker
freeMem word'
return ()
data SpellCheckerIgnoreWordMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsSpellChecker a) => O.MethodInfo SpellCheckerIgnoreWordMethodInfo a signature where
overloadedMethod _ = spellCheckerIgnoreWord
foreign import ccall "webkit_spell_checker_learn_word" webkit_spell_checker_learn_word ::
Ptr SpellChecker ->
CString ->
IO ()
spellCheckerLearnWord ::
(B.CallStack.HasCallStack, MonadIO m, IsSpellChecker a) =>
a
-> T.Text
-> m ()
spellCheckerLearnWord checker word = liftIO $ do
checker' <- unsafeManagedPtrCastPtr checker
word' <- textToCString word
webkit_spell_checker_learn_word checker' word'
touchManagedPtr checker
freeMem word'
return ()
data SpellCheckerLearnWordMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsSpellChecker a) => O.MethodInfo SpellCheckerLearnWordMethodInfo a signature where
overloadedMethod _ = spellCheckerLearnWord
foreign import ccall "webkit_spell_checker_update_spell_checking_languages" webkit_spell_checker_update_spell_checking_languages ::
Ptr SpellChecker ->
CString ->
IO ()
spellCheckerUpdateSpellCheckingLanguages ::
(B.CallStack.HasCallStack, MonadIO m, IsSpellChecker a) =>
a
-> Maybe (T.Text)
-> m ()
spellCheckerUpdateSpellCheckingLanguages checker languages = liftIO $ do
checker' <- unsafeManagedPtrCastPtr checker
maybeLanguages <- case languages of
Nothing -> return nullPtr
Just jLanguages -> do
jLanguages' <- textToCString jLanguages
return jLanguages'
webkit_spell_checker_update_spell_checking_languages checker' maybeLanguages
touchManagedPtr checker
freeMem maybeLanguages
return ()
data SpellCheckerUpdateSpellCheckingLanguagesMethodInfo
instance (signature ~ (Maybe (T.Text) -> m ()), MonadIO m, IsSpellChecker a) => O.MethodInfo SpellCheckerUpdateSpellCheckingLanguagesMethodInfo a signature where
overloadedMethod _ = spellCheckerUpdateSpellCheckingLanguages