{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
{-# LANGUAGE TypeFamilies,CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Dial
(
dialNew,
dialCustom,
DialType(..)
)
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.Widget
data DialType = NormalDialType
| LineDialType
| FillDialType
deriving (Show,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 37 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (T.Text) -> (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
let {a5' = unsafeToCString a5} in
let {a6' = id a6} in
overriddenWidgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 39 "src/Graphics/UI/FLTK/LowLevel/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 40 "src/Graphics/UI/FLTK/LowLevel/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 56 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
dialNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (T.Text) -> 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
let {a5' = unsafeToCString a5} in
dialNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 57 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
dialNew :: Rectangle -> Maybe T.Text -> IO (Ref Dial)
dialNew rectangle l'=
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in case l' of
Nothing -> dialNew' x_pos y_pos width height >>=
toRef
Just l -> dialNewWithLabel' x_pos y_pos width height l >>=
toRef
dialDestroy' :: (Ptr ()) -> IO ((()))
dialDestroy' a1 =
let {a1' = id a1} in
dialDestroy''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 67 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ (IO ())) => Op (Destroy ()) Dial 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 73 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( Angle -> IO ())) => Op (SetAngle1 ()) Dial 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 76 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( Angle -> IO ())) => Op (SetAngle2 ()) Dial 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 79 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO (Angle))) => Op (GetAngle1 ()) Dial 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 82 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO (Angle))) => Op (GetAngle2 ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> angle2' dialPtr >>= return . Angle
instance (impl ~ ( Angle -> Angle -> IO ())) => Op (SetAngles ()) Dial orig impl where
runOp _ _ dial a1' a2' = do
setAngle1 dial a1'
setAngle2 dial a2'
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 89 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ (DialType -> IO ())) => Op (SetType ()) Dial 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 92 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ IO (DialType)) => Op (GetType_ ()) Dial orig impl where
runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . toEnum . fromInteger . toInteger
draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
let {a1' = id a1} in
draw'''_ a1' >>
return ()
{-# LINE 95 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (Draw ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> draw'' dialPtr
drawSuper' :: (Ptr ()) -> IO ((()))
drawSuper' a1 =
let {a1' = id a1} in
drawSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 98 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (DrawSuper ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> drawSuper' 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 101 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Dial orig impl where
runOp _ _ dial event = withRef dial (\p -> dialHandle' p (fromIntegral . fromEnum $ event)) >>= return . successOrUnknownEvent
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/Dial.chs" #-}
instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (HandleSuper ()) Dial orig impl where
runOp _ _ dial event = withRef dial $ \dialPtr -> handleSuper' dialPtr (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/Dial.chs" #-}
instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Dial 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
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 112 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) Dial orig impl where
runOp _ _ dial rectangle =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in withRef dial $ \dialPtr -> resizeSuper' dialPtr x_pos y_pos width height
hide' :: (Ptr ()) -> IO ()
hide' a1 =
let {a1' = id a1} in
hide''_ a1' >>
return ()
{-# LINE 117 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (Hide ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> hide' dialPtr
hideSuper' :: (Ptr ()) -> IO ((()))
hideSuper' a1 =
let {a1' = id a1} in
hideSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 120 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (HideSuper ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> hideSuper' dialPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
let {a1' = id a1} in
show''_ a1' >>
return ()
{-# LINE 123 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (ShowWidget ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> show' dialPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
let {a1' = id a1} in
showSuper''_ a1' >>= \res ->
let {res' = supressWarningAboutRes res} in
return (res')
{-# LINE 126 "src/Graphics/UI/FLTK/LowLevel/Dial.chs" #-}
instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) Dial orig impl where
runOp _ _ dial = withRef dial $ \dialPtr -> showSuper' dialPtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/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/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/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/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/Dial.chs.h Fl_Dial_Destroy"
dialDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_set_angle1"
setAngle1''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CShort -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_set_angle2"
setAngle2''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CShort -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_angle1"
angle1''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CShort))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_angle2"
angle2''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CShort))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Widget_set_type"
setType''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUChar -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Widget_type"
type''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUChar))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_draw"
draw'''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_draw_super"
drawSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_handle"
dialHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_handle_super"
handleSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/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/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/Dial.chs.h Fl_Dial_hide"
hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_hide_super"
hideSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_show"
show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Dial.chs.h Fl_Dial_show_super"
showSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))