packages feed

lhae-0.0.2: src/View/Component/TextWindow.hs

module View.Component.TextWindow (TextWindow,new,newSingleLine
                                 ,printString,print,text)
    where

import Prelude hiding (print)
import qualified Graphics.UI.WX as WX
import qualified Graphics.UI.WXCore as WXC

type TextWindow = WX.TextCtrl ()

new :: WX.Window a -> [WX.Prop TextWindow] -> IO TextWindow
new = WX.textCtrl

newSingleLine :: WX.Window a -> [WX.Prop TextWindow] -> IO TextWindow
newSingleLine = WX.textEntry

printString :: String -> TextWindow -> IO ()
printString s win = WXC.textCtrlAppendText win $ s ++ "\n"
  
print :: Show a => a -> TextWindow -> IO ()
print s win = WXC.textCtrlAppendText win $ show s ++ "\n"

text :: TextWindow -> IO String
text = WXC.textCtrlGetValue