{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Counter
(
counterNew,
counterCustom,
CounterType(..)
, drawCounterBase
, handleCounterBase
, resizeCounterBase
, hideCounterBase
, showWidgetCounterBase
)
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_Enumerations
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
data CounterType = NormalCounterType
| SimpleCounterType
deriving (Int -> CounterType -> ShowS
[CounterType] -> ShowS
CounterType -> String
(Int -> CounterType -> ShowS)
-> (CounterType -> String)
-> ([CounterType] -> ShowS)
-> Show CounterType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CounterType] -> ShowS
$cshowList :: [CounterType] -> ShowS
show :: CounterType -> String
$cshow :: CounterType -> String
showsPrec :: Int -> CounterType -> ShowS
$cshowsPrec :: Int -> CounterType -> ShowS
Show,CounterType -> CounterType -> Bool
(CounterType -> CounterType -> Bool)
-> (CounterType -> CounterType -> Bool) -> Eq CounterType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CounterType -> CounterType -> Bool
$c/= :: CounterType -> CounterType -> Bool
== :: CounterType -> CounterType -> Bool
$c== :: CounterType -> CounterType -> Bool
Eq)
instance Enum CounterType where
succ NormalCounterType = SimpleCounterType
succ SimpleCounterType = error "CounterType.succ: SimpleCounterType has no successor"
pred SimpleCounterType = NormalCounterType
pred NormalCounterType = error "CounterType.pred: NormalCounterType 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 :: CounterType -> [CounterType]
enumFrom from :: CounterType
from = CounterType -> CounterType -> [CounterType]
forall a. Enum a => a -> a -> [a]
enumFromTo CounterType
from CounterType
SimpleCounterType
fromEnum :: CounterType -> Int
fromEnum NormalCounterType = 0
fromEnum SimpleCounterType = 1
toEnum 0 = NormalCounterType
toEnum 1 = SimpleCounterType
toEnum unmatched = error ("CounterType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 42 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNewWithLabel' 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
overriddenWidgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 44 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.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 45 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
counterCustom ::
Rectangle
-> Maybe T.Text
-> Maybe (Ref Counter -> IO ())
-> Maybe (CustomWidgetFuncs Counter)
-> IO (Ref Counter)
counterCustom rectangle l' draw' funcs' =
widgetMaker
rectangle
l'
draw'
funcs'
overriddenWidgetNew'
overriddenWidgetNewWithLabel'
counterNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
counterNew' a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
counterNew''_ a1' a2' a3' a4' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 62 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
counterNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> IO ((Ptr ()))
counterNewWithLabel' 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' ->
counterNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 63 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
counterNew :: Rectangle -> Maybe T.Text -> IO (Ref Counter)
counterNew rectangle l'=
widgetMaker
rectangle
l'
Nothing
Nothing
overriddenWidgetNew'
overriddenWidgetNewWithLabel'
counterDestroy' :: (Ptr ()) -> IO ((()))
counterDestroy' :: Ptr () -> IO ()
counterDestroy' a1 :: Ptr ()
a1 =
let {a1' = id a1} in
counterDestroy''_ a1' >>= \res ->
let {res' = () -> ()
forall a. a -> ()
supressWarningAboutRes ()
res} in
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')
{-# LINE 74 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (IO ())) => Op (Destroy ()) CounterBase orig impl where
runOp _ _ win = swapRef win $ \winPtr -> do
counterDestroy' winPtr
return nullPtr
lstep' :: (Ptr ()) -> (Double) -> IO ()
lstep' a1 a2 =
let {a1' = id a1} in
let {a2' = realToFrac a2} in
lstep''_ a1' a2' >>
return ()
{-# LINE 80 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (Double -> IO ())) => Op (SetLstep ()) CounterBase orig impl where
runOp _ _ counter lstep = withRef counter $ \counterPtr -> lstep' counterPtr lstep
setTextfont' :: (Ptr ()) -> (Font) -> IO ()
setTextfont' a1 a2 =
let {a1' = id a1} in
let {a2' = cFromFont a2} in
setTextfont''_ a1' a2' >>
return ()
{-# LINE 83 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (Font -> IO ())) => Op (SetTextfont ()) CounterBase orig impl where
runOp _ _ counter text = withRef counter $ \counterPtr -> setTextfont' counterPtr text
textfont' :: (Ptr ()) -> IO ((Font))
textfont' a1 =
let {a1' = id a1} in
textfont''_ a1' >>= \res ->
let {res' = cToFont res} in
return (res')
{-# LINE 86 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ ( IO (Font))) => Op (GetTextfont ()) CounterBase orig impl where
runOp _ _ counter = withRef counter $ \counterPtr -> textfont' counterPtr
setTextsize' :: (Ptr ()) -> (CInt) -> IO ()
setTextsize' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
setTextsize''_ a1' a2' >>
return ()
{-# LINE 89 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (FontSize -> IO ())) => Op (SetTextsize ()) CounterBase orig impl where
runOp _ _ counter (FontSize text) = withRef counter $ \counterPtr -> setTextsize' counterPtr text
textsize' :: (Ptr ()) -> IO ((CInt))
textsize' a1 =
let {a1' = id a1} in
textsize''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 92 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ ( IO (FontSize))) => Op (GetTextsize ()) CounterBase orig impl where
runOp _ _ counter = withRef counter $ \counterPtr -> textsize' counterPtr >>= return . FontSize
setTextcolor' :: (Ptr ()) -> (Color) -> IO ()
setTextcolor' a1 a2 =
let {a1' = id a1} in
let {a2' = cFromColor a2} in
setTextcolor''_ a1' a2' >>
return ()
{-# LINE 95 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (Color -> IO ())) => Op (SetTextcolor ()) CounterBase orig impl where
runOp _ _ counter text = withRef counter $ \counterPtr -> setTextcolor' counterPtr text
textcolor' :: (Ptr ()) -> IO ((Color))
textcolor' a1 =
let {a1' = id a1} in
textcolor''_ a1' >>= \res ->
let {res' = cToColor res} in
return (res')
{-# LINE 98 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ ( IO (Color))) => Op (GetTextcolor ()) CounterBase orig impl where
runOp _ _ counter = withRef counter $ \counterPtr -> textcolor' counterPtr
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 101 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (CounterType -> IO ())) => Op (SetType ()) CounterBase orig impl where
runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (fromInteger $ toInteger $ fromEnum t)
type' :: (Ptr ()) -> IO ((Word8))
type' a1 =
let {a1' = id a1} in
type''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 104 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ IO (CounterType)) => Op (GetType_ ()) CounterBase orig impl where
runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger
drawSuper' :: (Ptr ()) -> IO ((()))
drawSuper' a1 =
let {a1' = id a1} in
drawSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 107 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
drawCounterBase :: Ref CounterBase -> IO ()
drawCounterBase adjuster = withRef adjuster $ \adjusterPtr -> drawSuper' adjusterPtr
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 110 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
handleCounterBase :: Ref CounterBase -> Event -> IO (Either UnknownEvent ())
handleCounterBase adjuster event = withRef adjuster $ \adjusterPtr -> handleSuper' adjusterPtr (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 113 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
resizeCounterBase :: Ref CounterBase -> Rectangle -> IO ()
resizeCounterBase adjuster rectangle =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in withRef adjuster $ \adjusterPtr -> resizeSuper' adjusterPtr 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 118 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
hideCounterBase :: Ref CounterBase -> IO ()
hideCounterBase adjuster = withRef adjuster $ \adjusterPtr -> hideSuper' adjusterPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
let {a1' = id a1} in
showSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 121 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
showWidgetCounterBase :: Ref CounterBase -> IO ()
showWidgetCounterBase adjuster = withRef adjuster $ \adjusterPtr -> showSuper' adjusterPtr
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
let {a1' = id a1} in
draw'''_ a1' >>
return ()
{-# LINE 125 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ ( IO ())) => Op (Draw ()) CounterBase orig impl where
runOp _ _ counter = withRef counter $ \counterPtr -> draw'' counterPtr
counterHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
counterHandle' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
counterHandle''_ a1' a2' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 128 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) CounterBase orig impl where
runOp _ _ counter event = withRef counter (\p -> counterHandle' 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 131 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) CounterBase orig impl where
runOp _ _ counter rectangle = withRef counter $ \counterPtr -> do
let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
resize' counterPtr x_pos y_pos w_pos h_pos
hide' :: (Ptr ()) -> IO ()
hide' a1 =
let {a1' = id a1} in
hide''_ a1' >>
return ()
{-# LINE 136 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ ( IO ())) => Op (Hide ()) CounterBase orig impl where
runOp _ _ counter = withRef counter $ \counterPtr -> hide' counterPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
let {a1' = id a1} in
show''_ a1' >>
return ()
{-# LINE 139 "src/Graphics/UI/FLTK/LowLevel/Base/Counter.chs" #-}
instance (impl ~ ( IO ())) => Op (ShowWidget ()) CounterBase orig impl where
runOp _ _ counter = withRef counter $ \counterPtr -> show' counterPtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_OverriddenCounter_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/Counter.chs.h Fl_OverriddenCounter_New"
overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_New"
counterNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_New_WithLabel"
counterNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_Destroy"
counterDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_lstep"
lstep''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CDouble -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_set_textfont"
setTextfont''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_textfont"
textfont''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_set_textsize"
setTextsize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_textsize"
textsize''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_set_textcolor"
setTextcolor''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_textcolor"
textcolor''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Widget_set_type"
setType''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUChar -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Widget_type"
type''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUChar))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_draw_super"
drawSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_handle_super"
handleSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_resize_super"
resizeSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_hide_super"
hideSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_show_super"
showSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_draw"
draw'''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_handle"
counterHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_resize"
resize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_hide"
hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Counter.chs.h Fl_Counter_show"
show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))