{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/ToggleButton.chs" #-}
{-# LANGUAGE CPP, EmptyDataDecls, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.ToggleButton
(
toggleButtonNew
)
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.Base.Widget
import Graphics.UI.FLTK.LowLevel.Dispatch
import qualified Data.Text as T
widgetNew' :: (Int) -> (Int) -> (Int) -> (Int) -> (FunPtr DestroyCallbacksPrim) -> IO ((Ptr ()))
widgetNew' 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
widgetNew''_ a1' a2' a3' a4' a5' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/Base/ToggleButton.chs" #-}
widgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (FunPtr DestroyCallbacksPrim) -> IO ((Ptr ()))
widgetNewWithLabel' 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
widgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 29 "src/Graphics/UI/FLTK/LowLevel/Base/ToggleButton.chs" #-}
toggleButtonNew :: Rectangle -> Maybe T.Text -> IO (Ref ToggleButton)
toggleButtonNew rectangle l' =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
in do
destroyFptr <- toDestroyCallbacksPrim (defaultDestroyCallbacks :: (Ref ToggleButton -> [Maybe (FunPtr (IO ()))] -> IO ()))
ref <- case l' of
Nothing -> widgetNew' x_pos y_pos width height destroyFptr >>= toRef
Just l -> copyTextToCString l >>= \l' -> widgetNewWithLabel' x_pos y_pos width height l' destroyFptr >>= toRef
setFlag (safeCast ref :: Ref WidgetBase ) WidgetFlagCopiedLabel
setFlag (safeCast ref :: Ref WidgetBase ) WidgetFlagCopiedTooltip
return ref
widgetDestroy' :: (Ptr ()) -> IO ((()))
widgetDestroy' :: Ptr () -> IO ()
widgetDestroy' a1 :: Ptr ()
a1 =
let {a1' :: Ptr ()
a1' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a1} in
Ptr () -> IO ()
widgetDestroy''_ Ptr ()
a1' IO () -> (() -> IO ()) -> IO ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: ()
res ->
let {res' :: ()
res' = () -> ()
forall a. a -> ()
supressWarningAboutRes ()
res} in
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return (()
res')
{-# LINE 43 "src/Graphics/UI/FLTK/LowLevel/Base/ToggleButton.chs" #-}
instance (impl ~ (IO ())) => Op (Destroy ()) ToggleButtonBase orig impl where
runOp _ _ button = swapRef button $
\buttonPtr ->
widgetDestroy' buttonPtr >>
return nullPtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/ToggleButton.chs.h Fl_Toggle_Button_New"
widgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (IO (C2HSImp.Ptr ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/ToggleButton.chs.h Fl_Toggle_Button_New_WithLabel"
widgetNewWithLabel''_ :: (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/ToggleButton.chs.h Fl_Toggle_Button_Destroy"
widgetDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))