module Graphics.UI.FLTK.LowLevel.Pack
(
PackType(..),
packNew,
)
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
import Foreign.C.Types
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
packNew' :: (Int) -> (Int) -> (Int) -> (Int) -> IO ((Ptr ()))
packNew' a1 a2 a3 a4 =
let {a1' = fromIntegral a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = fromIntegral a4} in
packNew''_ a1' a2' a3' a4' >>= \res ->
let {res' = id res} in
return (res')
packNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (String) -> IO ((Ptr ()))
packNewWithLabel' 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
packNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = id res} in
return (res')
packNew :: Rectangle -> Maybe String -> IO (Ref Pack)
packNew rectangle l' =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in case l' of
Nothing -> packNew' x_pos y_pos width height >>=
toRef
Just l -> packNewWithLabel' x_pos y_pos width height l >>=
toRef
getSpacing' :: (Ptr ()) -> IO ((Int))
getSpacing' a1 =
let {a1' = id a1} in
getSpacing''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
instance (impl ~ (IO (Int))) => Op (GetSpacing ()) Pack orig impl where
runOp _ _ p = withRef p $ \pPtr -> getSpacing' pPtr
setSpacing' :: (Ptr ()) -> (Int) -> IO ()
setSpacing' a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
setSpacing''_ a1' a2' >>
return ()
instance (impl ~ (Int -> IO ())) => Op (SetSpacing ()) Pack orig impl where
runOp _ _ p pixels = withRef p $ \pPtr -> setSpacing' pPtr pixels
horizontal' :: (Ptr ()) -> IO ((Word8))
horizontal' a1 =
let {a1' = id a1} in
horizontal''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
instance (impl ~ ( IO Bool)) => Op (IsHorizontal ()) Pack orig impl where
runOp _ _ p = withRef p $ \pPtr -> do
orientation <- horizontal' pPtr >>= return . cToEnum
case orientation of
PackHorizontal -> return True
_ -> return False
type' :: (Ptr ()) -> IO ((Word8))
type' a1 =
let {a1' = id a1} in
type''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
instance (impl ~ ( IO (PackType))) => Op (GetType_ ()) Pack orig impl where
runOp _ _ widget = withRef widget $ \widgetPtr -> type' widgetPtr >>= return . cToEnum
setType' :: (Ptr ()) -> (Word8) -> IO ()
setType' a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
setType''_ a1' a2' >>
return ()
instance (impl ~ (PackType -> IO ())) => Op (SetType ()) Pack orig impl where
runOp _ _ widget t = withRef widget $ \widgetPtr -> setType' widgetPtr (cFromEnum t)
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_New"
packNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_New_WithLabel"
packNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_get_spacing"
getSpacing''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_set_spacing"
setSpacing''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_horizontal"
horizontal''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUChar))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_type"
type''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUChar))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Pack.chs.h Fl_Pack_set_type"
setType''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUChar -> (IO ())))