{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Output
(
FlOutputType(..),
outputNew,
outputCustom
, drawOutputBase
, handleOutputBase
, resizeOutputBase
, hideOutputBase
, showWidgetOutputBase
)
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
import qualified Data.Text as T
import Graphics.UI.FLTK.LowLevel.Base.Widget
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
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 :: Int
a3 a4 :: Int
a4 a5 :: CString
a5 a6 :: Ptr ()
a6 =
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' :: CInt
a3' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a1 :: Int
a3 :: Int
a3} in
let {a4' :: CInt
a4' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a4} in
(((CString -> IO (Ptr ())) -> CString -> IO (Ptr ()))
-> CString -> (CString -> IO (Ptr ())) -> IO (Ptr ())
forall a b c. (a -> b -> c) -> b -> a -> c
flip (CString -> IO (Ptr ())) -> CString -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
($)) CString
a5 ((CString -> IO (Ptr ())) -> IO (Ptr ()))
-> (CString -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \a5' :: CString
a5' ->
let {a6' :: Ptr ()
a6' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a6} in
CInt -> CInt -> CInt -> CInt -> CString -> Ptr () -> IO (Ptr ())
overriddenWidgetNewWithLabel''_ CInt
a1' CInt
a2' CInt
a3' CInt
a4' CString
a5' Ptr ()
a6' 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 res} in
return (res')
{-# LINE 43 "src/Graphics/UI/FLTK/LowLevel/Base/Output.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 44 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
outputCustom ::
Rectangle
-> Maybe T.Text
-> Maybe (Ref Output -> IO ())
-> Maybe (CustomWidgetFuncs Output)
-> IO (Ref Output)
outputCustom rectangle l' draw' funcs' =
widgetMaker
rectangle
l'
draw'
funcs'
overriddenWidgetNew'
overriddenWidgetNewWithLabel'
data FlOutputType = FlNormalOutput
| FlMultilineOutput
instance Enum FlOutputType where
succ FlNormalOutput = FlMultilineOutput
succ FlMultilineOutput = error "FlOutputType.succ: FlMultilineOutput has no successor"
pred FlMultilineOutput = FlNormalOutput
pred FlNormalOutput = error "FlOutputType.pred: FlNormalOutput has no predecessor"
enumFromTo from to = go from
where
end = fromEnum to
go v = case compare (fromEnum v) end of
LT -> v : go (succ v)
EQ -> [v]
GT -> []
enumFrom :: FlOutputType -> [FlOutputType]
enumFrom from :: FlOutputType
from = FlOutputType -> FlOutputType -> [FlOutputType]
forall a. Enum a => a -> a -> [a]
enumFromTo FlOutputType
from FlOutputType
FlMultilineOutput
fromEnum FlNormalOutput = 8
fromEnum FlMultilineOutput = 12
toEnum 8 = FlNormalOutput
toEnum 12 = FlMultilineOutput
toEnum unmatched = error ("FlOutputType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 61 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
multilineOutputNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (FunPtr DestroyCallbacksPrim) -> IO ((Ptr ()))
multilineOutputNewWithLabel' a1 a2 a3 a4 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
multilineOutputNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 62 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
outputNew :: Rectangle -> Maybe T.Text -> Maybe FlOutputType -> IO (Ref Output)
outputNew rectangle l' flOutputType =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
construct = case flOutputType of
Just FlNormalOutput -> outputCustom rectangle l' Nothing Nothing
Nothing -> outputCustom rectangle l' Nothing Nothing
Just FlMultilineOutput -> do
destroyFptr <- toDestroyCallbacksPrim defaultDestroyCallbacks
lPtr <- maybe (return nullPtr) copyTextToCString l'
multilineOutputNewWithLabel' x_pos y_pos width height lPtr destroyFptr >>= toRef
in do
ref <- construct
setFlag ref WidgetFlagCopiedLabel
setFlag ref WidgetFlagCopiedTooltip
return ref
setType' :: (Ptr ()) -> (Word8) -> IO ((()))
setType' a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
setType''_ a1' a2' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 79 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
instance (impl ~ (FlOutputType -> IO ())) => Op (SetType ()) OutputBase orig impl where
runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (fromInteger $ toInteger $ fromEnum t)
drawSuper' :: (Ptr ()) -> IO ((()))
drawSuper' a1 =
let {a1' = id a1} in
drawSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 83 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
drawOutputBase :: Ref OutputBase -> IO ()
drawOutputBase output = withRef output $ \outputPtr -> drawSuper' outputPtr
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 86 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
handleOutputBase :: Ref OutputBase -> Event -> IO (Either UnknownEvent ())
handleOutputBase output event = withRef output $ \outputPtr -> handleSuper' outputPtr (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 89 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
resizeOutputBase :: Ref OutputBase -> Rectangle -> IO ()
resizeOutputBase output rectangle =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in withRef output $ \outputPtr -> resizeSuper' outputPtr 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 94 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
hideOutputBase :: Ref OutputBase -> IO ()
hideOutputBase output = withRef output $ \outputPtr -> hideSuper' outputPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
let {a1' = id a1} in
showSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 97 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
showWidgetOutputBase :: Ref OutputBase -> IO ()
showWidgetOutputBase output = withRef output $ \outputPtr -> showSuper' outputPtr
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
let {a1' = id a1} in
draw'''_ a1' >>
return ()
{-# LINE 101 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
instance (impl ~ ( IO ())) => Op (Draw ()) OutputBase orig impl where
runOp _ _ output = withRef output $ \outputPtr -> draw'' outputPtr
outputHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
outputHandle' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
outputHandle''_ a1' a2' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 104 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) OutputBase orig impl where
runOp _ _ output event = withRef output (\p -> outputHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
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 107 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) OutputBase orig impl where
runOp _ _ output rectangle = withRef output $ \outputPtr -> do
let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
resize' outputPtr x_pos y_pos w_pos h_pos
hide' :: (Ptr ()) -> IO ()
hide' a1 =
let {a1' = id a1} in
hide''_ a1' >>
return ()
{-# LINE 112 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
instance (impl ~ ( IO ())) => Op (Hide ()) OutputBase orig impl where
runOp _ _ output = withRef output $ \outputPtr -> hide' outputPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
let {a1' = id a1} in
show''_ a1' >>
return ()
{-# LINE 115 "src/Graphics/UI/FLTK/LowLevel/Base/Output.chs" #-}
instance (impl ~ ( IO ())) => Op (ShowWidget ()) OutputBase orig impl where
runOp _ _ output = withRef output $ \outputPtr -> show' outputPtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_OverriddenOutput_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/Output.chs.h Fl_OverriddenOutput_New"
overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Multiline_Output_New_WithLabel"
multilineOutputNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (IO (C2HSImp.Ptr ()))))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_set_type"
setType''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUChar -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_draw_super"
drawSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_handle_super"
handleSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_resize_super"
resizeSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_hide_super"
hideSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_show_super"
showSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_draw"
draw'''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_handle"
outputHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_resize"
resize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_hide"
hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Output.chs.h Fl_Output_show"
show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))