-- GENERATED by C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.TextEditor
       (
         textEditorNew,
         textEditorCustom,
         KeyBinding(..),
         KeyFunc(..),
         KeyFuncPrim,
         toKeyFuncPrim,
         keyBindingsToArray,
         arrayToKeyBindings
  , drawTextEditorBase
  , handleTextEditorBase
  , resizeTextEditorBase
  , hideTextEditorBase
  , showWidgetTextEditorBase
         -- * Hierarchy
         --
         -- $hierarchy

         -- * Functions
         --
         -- $functions
       )
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import qualified Foreign.Storable as C2HSImp





import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Graphics.UI.FLTK.LowLevel.Base.Widget
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
import qualified Data.Text as T
import Graphics.UI.FLTK.LowLevel.Utils
import Data.List

data KeyBinding  = KeyBinding KeyBindingKeySequence (FunPtr KeyFuncPrim)
data KeyFunc     = forall a. (Parent a TextEditorBase) => KeyFunc (Ref a -> Char -> IO ())
type KeyFuncPrim = CInt -> Ptr () -> IO ()

foreign import ccall "wrapper"
        mkKeyFuncPrim :: KeyFuncPrim -> IO (FunPtr KeyFuncPrim)

toKeyFuncPrim :: KeyFunc -> IO (FunPtr KeyFuncPrim)
toKeyFuncPrim :: KeyFunc -> IO (FunPtr KeyFuncPrim)
toKeyFuncPrim (KeyFunc f :: Ref a -> Char -> IO ()
f) =
    KeyFuncPrim -> IO (FunPtr KeyFuncPrim)
mkKeyFuncPrim
     (
       \char' :: CInt
char' ptr :: Ptr ()
ptr -> do
         Ref a
ref <- Ptr () -> IO (Ref a)
forall a. Ptr () -> IO (Ref a)
toRef Ptr ()
ptr
         Ref a -> Char -> IO ()
f Ref a
ref (CChar -> Char
castCCharToChar (CChar -> Char) -> CChar -> Char
forall a b. (a -> b) -> a -> b
$ CInt -> CChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
char')
     )

keyBindingsToArray :: [KeyBinding] -> IO (Ptr ())
keyBindingsToArray :: [KeyBinding] -> IO (Ptr ())
keyBindingsToArray kbs :: [KeyBinding]
kbs =
  case [KeyBinding]
kbs of
    (kb' :: KeyBinding
kb':kbs' :: [KeyBinding]
kbs') -> (IO (Ptr ()) -> KeyBinding -> IO (Ptr ()))
-> IO (Ptr ()) -> [KeyBinding] -> IO (Ptr ())
forall (t :: * -> *) b a.
Foldable t =>
(b -> a -> b) -> b -> t a -> b
foldl'
                  (
                    \p' :: IO (Ptr ())
p' kb'' :: KeyBinding
kb'' -> do
                           Ptr ()
curr <- KeyBinding -> IO (Ptr ())
forall b. KeyBinding -> IO (Ptr b)
ptrToKb KeyBinding
kb''
                           IO (Ptr ())
p' IO (Ptr ()) -> (Ptr () -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (\ptr :: Ptr ()
ptr val :: Ptr ()
val -> do {Ptr () -> Int -> Ptr () -> IO ()
forall a b. Storable a => Ptr b -> Int -> a -> IO ()
C2HSImp.pokeByteOff Ptr ()
ptr 16 (Ptr ()
val :: (C2HSImp.Ptr ()))}) Ptr ()
curr
                           Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
curr
                  )
                  (KeyBinding -> IO (Ptr ())
forall b. KeyBinding -> IO (Ptr b)
ptrToKb KeyBinding
kb')
                  [KeyBinding]
kbs'
    []       -> Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
forall a. Ptr a
nullPtr
  where
    extractCodes :: KeyBindingKeySequence -> (a, b)
extractCodes (KeyBindingKeySequence es :: Maybe [EventState]
es key' :: KeyType
key') =
      let keyNum :: b
keyNum = case KeyType
key' of
            SpecialKeyType c' :: SpecialKey
c' -> Int -> b
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> b) -> Int -> b
forall a b. (a -> b) -> a -> b
$ SpecialKey -> Int
forall a. Enum a => a -> Int
fromEnum SpecialKey
c'
            NormalKeyType c' :: Char
c' -> CChar -> b
forall a b. (Integral a, Num b) => a -> b
fromIntegral (CChar -> b) -> CChar -> b
forall a b. (a -> b) -> a -> b
$ Char -> CChar
castCharToCChar Char
c'
          stateCode :: a
stateCode = a -> ([EventState] -> a) -> Maybe [EventState] -> a
forall b a. b -> (a -> b) -> Maybe a -> b
maybe 0 (Int -> a
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> a) -> ([EventState] -> Int) -> [EventState] -> a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. [EventState] -> Int
forall a. (Enum a, Ord a) => [a] -> Int
combine) Maybe [EventState]
es
      in
      (a
stateCode, b
keyNum)
    ptrToKb (KeyBinding kb fr) =
      let (sc,kn) = extractCodes kb
      in do
       p <- mallocBytes 24
{-# LINE 80 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

       (\ptr val -> do {C2HSImp.pokeByteOff ptr 0 (val :: C2HSImp.CInt)}) p kn
       (\ptr val -> do {C2HSImp.pokeByteOff ptr 4 (val :: C2HSImp.CInt)}) p sc
       (\ptr val -> do {C2HSImp.pokeByteOff ptr 8 (val :: (C2HSImp.FunPtr (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt)))))}) p (castFunPtr  fr)
       (\ptr val -> do {C2HSImp.pokeByteOff ptr 16 (val :: (C2HSImp.Ptr ()))}) p nullPtr
       return p

arrayToKeyBindings :: Ptr () -> IO [KeyBinding]
arrayToKeyBindings :: Ptr () -> IO [KeyBinding]
arrayToKeyBindings p :: Ptr ()
p | Ptr ()
p Ptr () -> Ptr () -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr ()
forall a. Ptr a
nullPtr = [KeyBinding] -> IO [KeyBinding]
forall (m :: * -> *) a. Monad m => a -> m a
return []
arrayToKeyBindings p :: Ptr ()
p =
  [KeyBinding] -> Ptr () -> IO [KeyBinding]
go [] Ptr ()
p
  where
    go :: [KeyBinding] -> Ptr () -> IO [KeyBinding]
go accum :: [KeyBinding]
accum p' :: Ptr ()
p' | Ptr ()
p' Ptr () -> Ptr () -> Bool
forall a. Eq a => a -> a -> Bool
== Ptr ()
forall a. Ptr a
nullPtr = [KeyBinding] -> IO [KeyBinding]
forall (m :: * -> *) a. Monad m => a -> m a
return [KeyBinding]
accum
    go accum :: [KeyBinding]
accum p' :: Ptr ()
p' = do
      Int
key' <- (\ptr :: Ptr ()
ptr -> do {Ptr () -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
C2HSImp.peekByteOff Ptr ()
ptr 0 :: IO C2HSImp.CInt}) Ptr ()
p' IO CInt -> (CInt -> IO Int) -> IO Int
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= Int -> IO Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int -> IO Int) -> (CInt -> Int) -> CInt -> IO Int
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral
      CInt
state' <- (\ptr :: Ptr ()
ptr -> do {Ptr () -> Int -> IO CInt
forall a b. Storable a => Ptr b -> Int -> IO a
C2HSImp.peekByteOff Ptr ()
ptr 4 :: IO C2HSImp.CInt}) Ptr ()
p'
      FunPtr (CInt -> Ptr () -> IO CInt)
function' <- (\ptr :: Ptr ()
ptr -> do {Ptr () -> Int -> IO (FunPtr (CInt -> Ptr () -> IO CInt))
forall a b. Storable a => Ptr b -> Int -> IO a
C2HSImp.peekByteOff Ptr ()
ptr 8 :: IO (C2HSImp.FunPtr (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))))}) Ptr ()
p'
      Ptr ()
next' <- (\ptr :: Ptr ()
ptr -> do {Ptr () -> Int -> IO (Ptr ())
forall a b. Storable a => Ptr b -> Int -> IO a
C2HSImp.peekByteOff Ptr ()
ptr 16 :: IO (C2HSImp.Ptr ())}) Ptr ()
p'
      Ptr () -> IO ()
forall a. Ptr a -> IO ()
free Ptr ()
p'
      let skCandidates :: [SpecialKey]
skCandidates = (SpecialKey -> Bool) -> [SpecialKey] -> [SpecialKey]
forall a. (a -> Bool) -> [a] -> [a]
filter (\sk :: SpecialKey
sk -> SpecialKey -> Int
forall a. Enum a => a -> Int
fromEnum SpecialKey
sk Int -> Int -> Bool
forall a. Eq a => a -> a -> Bool
== Int
key') [SpecialKey]
allSpecialKeys
      let keyType :: KeyType
keyType = if ([SpecialKey] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [SpecialKey]
skCandidates)
                    then (Char -> KeyType
NormalKeyType (Char -> KeyType) -> Char -> KeyType
forall a b. (a -> b) -> a -> b
$ CChar -> Char
castCCharToChar (CChar -> Char) -> CChar -> Char
forall a b. (a -> b) -> a -> b
$ Int -> CChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
key')
                    else (SpecialKey -> KeyType
SpecialKeyType (SpecialKey -> KeyType) -> SpecialKey -> KeyType
forall a b. (a -> b) -> a -> b
$ [SpecialKey] -> SpecialKey
forall a. [a] -> a
head [SpecialKey]
skCandidates)
      let evs :: Maybe [EventState]
evs = if (CInt
state' CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
== 0)
                then Maybe [EventState]
forall a. Maybe a
Nothing
                else [EventState] -> Maybe [EventState]
forall a. a -> Maybe a
Just ([EventState] -> Maybe [EventState])
-> [EventState] -> Maybe [EventState]
forall a b. (a -> b) -> a -> b
$ [EventState] -> CInt -> [EventState]
forall a. Enum a => [a] -> CInt -> [a]
extract [EventState]
allEventStates CInt
state'
      let currKb :: KeyBinding
currKb = KeyBindingKeySequence -> FunPtr KeyFuncPrim -> KeyBinding
KeyBinding (Maybe [EventState] -> KeyType -> KeyBindingKeySequence
KeyBindingKeySequence Maybe [EventState]
evs KeyType
keyType) (FunPtr (CInt -> Ptr () -> IO CInt) -> FunPtr KeyFuncPrim
forall a b. FunPtr a -> FunPtr b
castFunPtr FunPtr (CInt -> Ptr () -> IO CInt)
function')
      [KeyBinding] -> Ptr () -> IO [KeyBinding]
go ([KeyBinding]
accum [KeyBinding] -> [KeyBinding] -> [KeyBinding]
forall a. [a] -> [a] -> [a]
++ [KeyBinding
currKb]) Ptr ()
next'

overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNewWithLabel' :: Int -> Int -> Int -> Int -> CString -> Ptr () -> IO (Ptr ())
overriddenWidgetNewWithLabel' a1 :: Int
a1 a2 :: Int
a2 a3 a4 :: Int
a4 a5 :: CString
a5 a6 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  (flip ($)) a5 $ \a5' -> 
  let {a6' = id a6} in 
  overriddenWidgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 109 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

overriddenWidgetNew' :: (Int) -> (Int) -> (Int) -> (Int) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNew' a1 a2 a3 a4 a5 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = id a5} in 
  overriddenWidgetNew''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 110 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

textEditorCustom ::
       Rectangle                         -- ^ The bounds of this TextEditor
    -> Maybe T.Text                      -- ^ The TextEditor label
    -> Maybe (Ref TextEditor -> IO ())           -- ^ Optional custom drawing function
    -> Maybe (CustomWidgetFuncs TextEditor)      -- ^ Optional custom widget functions
    -> IO (Ref TextEditor)
textEditorCustom rectangle l' draw' funcs' =
  widgetMaker
    rectangle
    l'
    draw'
    funcs'
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'

textEditorNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
textEditorNew' :: Int -> Int -> Int -> Int -> IO (Ptr ())
textEditorNew' a1 :: Int
a1 a2 :: Int
a2 a3 :: Int
a3 a4 :: Int
a4 =
  let {a1' :: CInt
a1' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1} in 
  let {a2' :: CInt
a2' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2} in 
  let {a3' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a3} in 
  let {a4' :: CInt
a4' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a4} in 
  CInt -> CInt -> CInt -> CInt -> IO (Ptr ())
textEditorNew''_ CInt
a1' CInt
a2' CInt
a3' CInt
a4' IO (Ptr ()) -> (Ptr () -> IO (Ptr ())) -> IO (Ptr ())
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: Ptr ()
res ->
  let {res' :: Ptr ()
res' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
res} in
  Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return (Ptr ()
res')

{-# LINE 126 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

textEditorNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> IO ((Ptr ()))
textEditorNewWithLabel' a1 a2 a3 a4 a5 =
  let {a1' = fromIntegral a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  (flip ($)) a5 $ \a5' -> 
  textEditorNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 127 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

textEditorNew :: Rectangle -> Maybe T.Text -> IO (Ref TextEditor)
textEditorNew rectangle l' =
  widgetMaker
    rectangle
    l'
    Nothing
    Nothing
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'

textEditorDestroy' :: (Ptr ()) -> IO ((()))
textEditorDestroy' :: Ptr () -> IO ()
textEditorDestroy' a1 =
  let {a1' = id a1} in 
  textEditorDestroy''_ a1' >>= \res ->
  let {res' = () -> ()
forall a. a -> ()
supressWarningAboutRes ()
res} in
  () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')

{-# LINE 138 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) TextEditorBase orig impl where
  runOp _ _ editor = swapRef editor $ \editorPtr -> do
    textEditorDestroy' editorPtr
    return nullPtr
setInsertMode' :: (Ptr ()) -> (Bool) -> IO ()
setInsertMode' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = cFromBool a2} in 
  setInsertMode''_ a1' a2' >>
  return ()

{-# LINE 143 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (Bool ->  IO ())) => Op (SetInsertMode ()) TextEditorBase orig impl where
   runOp _ _ text_editor b = withRef text_editor $ \text_editorPtr -> setInsertMode' text_editorPtr b
insertMode' :: (Ptr ()) -> IO ((Bool))
insertMode' a1 =
  let {a1' = id a1} in 
  insertMode''_ a1' >>= \res ->
  let {res' = cToBool res} in
  return (res')

{-# LINE 146 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ ( IO (Bool))) => Op (GetInsertMode ()) TextEditorBase orig impl where
   runOp _ _ text_editor = withRef text_editor $ \text_editorPtr -> insertMode' text_editorPtr
addDefaultKeyBindings' :: (Ptr ()) -> (Ptr ()) -> IO ((Ptr ()))
addDefaultKeyBindings' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  addDefaultKeyBindings''_ a1' a2' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 149 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (IO [KeyBinding])) => Op (GetDefaultKeyBindings ()) TextEditorBase orig impl where
  runOp _ _ text_editor = withRef text_editor $ \text_editorPtr -> do
    p' <- addDefaultKeyBindings' text_editorPtr nullPtr
    kbs <- arrayToKeyBindings p'
    return kbs
replaceKeyBindings' :: (Ptr ()) -> (Ptr ()) -> IO ()
replaceKeyBindings' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  replaceKeyBindings''_ a1' a2' >>
  return ()

{-# LINE 155 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ ([KeyBinding] -> IO ())) => Op (ReplaceKeyBindings ()) TextEditorBase orig impl where
  runOp _ _ text_editor kbs = withRef text_editor $ \text_editorPtr -> do
        p <- keyBindingsToArray kbs
        replaceKeyBindings' text_editorPtr p


drawSuper' :: (Ptr ()) -> IO ((()))
drawSuper' :: Ptr () -> IO ()
drawSuper' a1 :: Ptr ()
a1 =
  let {a1' :: Ptr ()
a1' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a1} in 
  Ptr () -> IO ()
drawSuper''_ Ptr ()
a1' IO () -> (() -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: ()
res ->
  let {res' :: ()
res' = () -> ()
forall a. a -> ()
supressWarningAboutRes ()
res} in
  () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')

{-# LINE 162 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

drawTextEditorBase ::  Ref TextEditorBase -> IO ()
drawTextEditorBase textEditor = withRef textEditor $ \textEditorPtr -> drawSuper' textEditorPtr
handleSuper' :: (Ptr ()) -> (Int) -> IO ((Int))
handleSuper' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  handleSuper''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 165 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

handleTextEditorBase :: Ref TextEditorBase -> Event ->  IO (Either UnknownEvent ())
handleTextEditorBase textEditor event = withRef textEditor $ \textEditorPtr -> handleSuper' textEditorPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
resizeSuper' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((()))
resizeSuper' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  resizeSuper''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 168 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

resizeTextEditorBase :: Ref TextEditorBase -> Rectangle -> IO ()
resizeTextEditorBase textEditor rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef textEditor $ \textEditorPtr -> resizeSuper' textEditorPtr x_pos y_pos width height
hideSuper' :: (Ptr ()) -> IO ((()))
hideSuper' a1 =
  let {a1' = id a1} in 
  hideSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 173 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

hideTextEditorBase ::  Ref TextEditorBase -> IO ()
hideTextEditorBase textEditor = withRef textEditor $ \textEditorPtr -> hideSuper' textEditorPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 176 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

showWidgetTextEditorBase ::  Ref TextEditorBase -> IO ()
showWidgetTextEditorBase textEditor = withRef textEditor $ \textEditorPtr -> showSuper' textEditorPtr

draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
  let {a1' = id a1} in 
  draw'''_ a1' >>
  return ()

{-# LINE 180 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (  IO ())) => Op (Draw ()) TextEditorBase orig impl where
  runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> draw'' textEditorPtr
textEditorHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
textEditorHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  textEditorHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 183 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) TextEditorBase orig impl where
  runOp _ _ textEditor event = withRef textEditor (\p -> textEditorHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
show' :: (Ptr ()) -> IO ()
show' a1 =
  let {a1' = id a1} in 
  show''_ a1' >>
  return ()

{-# LINE 186 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (  IO ())) => Op (ShowWidget ()) TextEditorBase orig impl where
  runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> show' textEditorPtr
hide' :: (Ptr ()) -> IO ()
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>
  return ()

{-# LINE 189 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (  IO ())) => Op (Hide ()) TextEditorBase orig impl where
  runOp _ _ textEditor = withRef textEditor $ \textEditorPtr -> hide' textEditorPtr
resize' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((()))
resize' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in 
  let {a2' = fromIntegral a2} in 
  let {a3' = fromIntegral a3} in 
  let {a4' = fromIntegral a4} in 
  let {a5' = fromIntegral a5} in 
  resize''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 192 "src/Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) TextEditorBase orig impl where
  runOp _ _ textEditor rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef textEditor $ \textEditorPtr -> resize' textEditorPtr x_pos y_pos width height


-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.Group"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.TextDisplay"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.TextEditor"
-- @

-- $functions
-- @
-- destroy :: 'Ref' 'TextEditorBase' -> 'IO' ()
--
-- draw :: 'Ref' 'TextEditorBase' -> 'IO' ()
--
-- getDefaultKeyBindings :: 'Ref' 'TextEditorBase' -> 'IO' ['KeyBinding']
--
-- getInsertMode :: 'Ref' 'TextEditorBase' -> 'IO' ('Bool')
--
-- handle :: 'Ref' 'TextEditorBase' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'TextEditorBase' -> 'IO' ()
--
-- replaceKeyBindings :: 'Ref' 'TextEditorBase' -> ['KeyBinding'] -> 'IO' ()
--
-- resize :: 'Ref' 'TextEditorBase' -> 'Rectangle' -> 'IO' ()
--
-- setInsertMode :: 'Ref' 'TextEditorBase' -> 'Bool' -> 'IO' ()
--
-- showWidget :: 'Ref' 'TextEditorBase' -> 'IO' ()
-- @

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_OverriddenText_Editor_New_WithLabel"
  overriddenWidgetNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ()))))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_OverriddenText_Editor_New"
  overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_New"
  textEditorNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_New_WithLabel"
  textEditorNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO (C2HSImp.Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_Destroy"
  textEditorDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_set_insert_mode"
  setInsertMode''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_insert_mode"
  insertMode''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_add_default_key_bindings"
  addDefaultKeyBindings''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ()))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_replace_key_bindings"
  replaceKeyBindings''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_draw_super"
  drawSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_handle_super"
  handleSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_resize_super"
  resizeSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_hide_super"
  hideSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_show_super"
  showSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_draw"
  draw'''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_handle"
  textEditorHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_show"
  show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_hide"
  hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/TextEditor.chs.h Fl_Text_Editor_resize"
  resize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))