{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
{-# LANGUAGE TypeFamilies,CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.Dial
(
dialNew,
dialCustom,
DialType(..)
, drawDialBase
, handleDialBase
, resizeDialBase
, hideDialBase
, showWidgetDialBase
)
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 DialType = NormalDialType
| LineDialType
| FillDialType
deriving (Int -> DialType -> ShowS
[DialType] -> ShowS
DialType -> String
(Int -> DialType -> ShowS)
-> (DialType -> String) -> ([DialType] -> ShowS) -> Show DialType
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DialType] -> ShowS
$cshowList :: [DialType] -> ShowS
show :: DialType -> String
$cshow :: DialType -> String
showsPrec :: Int -> DialType -> ShowS
$cshowsPrec :: Int -> DialType -> ShowS
Show,DialType -> DialType -> Bool
(DialType -> DialType -> Bool)
-> (DialType -> DialType -> Bool) -> Eq DialType
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DialType -> DialType -> Bool
$c/= :: DialType -> DialType -> Bool
== :: DialType -> DialType -> Bool
$c== :: DialType -> DialType -> Bool
Eq)
instance Enum DialType where
succ NormalDialType = LineDialType
succ LineDialType = FillDialType
succ FillDialType = error "DialType.succ: FillDialType has no successor"
pred LineDialType = NormalDialType
pred FillDialType = LineDialType
pred NormalDialType = error "DialType.pred: NormalDialType 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 from = enumFromTo from FillDialType
fromEnum NormalDialType = 0
fromEnum LineDialType = 1
fromEnum FillDialType = 2
toEnum 0 = NormalDialType
toEnum 1 = LineDialType
toEnum 2 = FillDialType
toEnum unmatched = error ("DialType.toEnum: Cannot match " ++ show unmatched)
{-# LINE 42 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.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/Dial.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/Dial.chs" #-}
dialCustom ::
Rectangle
-> Maybe T.Text
-> Maybe (Ref Dial -> IO ())
-> Maybe (CustomWidgetFuncs Dial)
-> IO (Ref Dial)
dialCustom rectangle l' draw' funcs' =
widgetMaker
rectangle
l'
draw'
funcs'
overriddenWidgetNew'
overriddenWidgetNewWithLabel'
dialNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
dialNew' a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
dialNew''_ a1' a2' a3' a4' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 61 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
dialNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> IO ((Ptr ()))
dialNewWithLabel' 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' ->
dialNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 62 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
dialNew :: Rectangle -> Maybe T.Text -> IO (Ref Dial)
dialNew rectangle l'=
widgetMaker
rectangle
l'
Nothing
Nothing
overriddenWidgetNew'
overriddenWidgetNewWithLabel'
dialDestroy' :: (Ptr ()) -> IO ((()))
dialDestroy' :: Ptr () -> IO ()
dialDestroy' a1 =
let {a1' = id a1} in
dialDestroy''_ a1' >>= \res ->
let {res' = () -> ()
forall a. a -> ()
supressWarningAboutRes ()
res} in
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')
{-# LINE 73 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ (IO ())) => Op (Destroy ()) DialBase orig impl where
runOp _ _ win = swapRef win $ \winPtr -> do
dialDestroy' winPtr
return nullPtr
setAngle1' :: (Ptr ()) -> (CShort) -> IO ()
setAngle1' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
setAngle1''_ a1' a2' >>
return ()
{-# LINE 79 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( Angle -> IO ())) => Op (SetAngle1 ()) DialBase orig impl where
runOp _ _ dial (Angle a) = withRef dial $ \dialPtr -> setAngle1' dialPtr a
setAngle2' :: (Ptr ()) -> (CShort) -> IO ()
setAngle2' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
setAngle2''_ a1' a2' >>
return ()
{-# LINE 82 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( Angle -> IO ())) => Op (SetAngle2 ()) DialBase orig impl where
runOp _ _ dial (Angle a) = withRef dial $ \dialPtr -> setAngle2' dialPtr a
angle1' :: (Ptr ()) -> IO ((CShort))
angle1' a1 =
let {a1' = id a1} in
angle1''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 85 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( IO (Angle))) => Op (GetAngle1 ()) DialBase orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> angle1' dialPtr >>= return . Angle
angle2' :: (Ptr ()) -> IO ((CShort))
angle2' a1 =
let {a1' = id a1} in
angle2''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 88 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( IO (Angle))) => Op (GetAngle2 ()) DialBase orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> angle2' dialPtr >>= return . Angle
instance (impl ~ ( Angle -> Angle -> IO ())) => Op (SetAngles ()) DialBase orig impl where
runOp _ _ dial a1' a2' = do
setAngle1 dial a1'
setAngle2 dial a2'
setType' :: (Ptr ()) -> (Word8) -> IO ((()))
setType' :: Ptr () -> Word8 -> IO ()
setType' a1 :: Ptr ()
a1 a2 :: Word8
a2 =
let {a1' = id a1} in
let {a2' :: CUChar
a2' = Word8 -> CUChar
forall a b. (Integral a, Num b) => a -> b
fromIntegral Word8
a2} in
Ptr () -> CUChar -> IO ()
setType''_ Ptr ()
a1' CUChar
a2' IO () -> (() -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: ()
res ->
let {res' = supressWarningAboutRes res} in
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')
{-# LINE 95 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ (DialType -> IO ())) => Op (SetType ()) DialBase 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 98 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ IO (DialType)) => Op (GetType_ ()) DialBase 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 101 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
drawDialBase :: Ref DialBase -> IO ()
drawDialBase 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 104 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
handleDialBase :: Ref DialBase -> Event -> IO (Either UnknownEvent ())
handleDialBase 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 107 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
resizeDialBase :: Ref DialBase -> Rectangle -> IO ()
resizeDialBase 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 112 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
hideDialBase :: Ref DialBase -> IO ()
hideDialBase 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 115 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
showWidgetDialBase :: Ref DialBase -> IO ()
showWidgetDialBase adjuster = withRef adjuster $ \adjusterPtr -> showSuper' adjusterPtr
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 119 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) DialBase orig impl where
runOp _ _ dial rectangle = withRef dial $ \dialPtr -> do
let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
resize' dialPtr x_pos y_pos w_pos h_pos
hide' :: (Ptr ()) -> IO ()
hide' a1 =
let {a1' = id a1} in
hide''_ a1' >>
return ()
{-# LINE 124 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (Hide ()) DialBase orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> hide' dialPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
let {a1' = id a1} in
show''_ a1' >>
return ()
{-# LINE 127 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (ShowWidget ()) DialBase orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> show' dialPtr
dialHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
dialHandle' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
dialHandle''_ a1' a2' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 130 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) DialBase orig impl where
runOp _ _ dial event = withRef dial (\p -> dialHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
let {a1' = id a1} in
draw'''_ a1' >>
return ()
{-# LINE 133 "src/Graphics/UI/FLTK/LowLevel/Base/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (Draw ()) DialBase orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> draw'' dialPtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_OverriddenDial_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/Dial.chs.h Fl_OverriddenDial_New"
overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_New"
dialNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_New_WithLabel"
dialNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_Destroy"
dialDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_set_angle1"
setAngle1''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CShort -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_set_angle2"
setAngle2''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CShort -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_angle1"
angle1''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CShort))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_angle2"
angle2''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CShort))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Widget_set_type"
setType''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUChar -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Widget_type"
type''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUChar))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_draw_super"
drawSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_handle_super"
handleSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_resize_super"
resizeSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_hide_super"
hideSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_show_super"
showSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_resize"
resize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_hide"
hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_show"
show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_handle"
dialHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/Dial.chs.h Fl_Dial_draw"
draw'''_ :: ((C2HSImp.Ptr ()) -> (IO ()))