-- GENERATED by C->Haskell Compiler, version 0.28.6 Switcheroo, 25 November 2017 (Haskell)
-- Edit the ORIGNAL .chs file instead!


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/LightButton.chs" #-}
{-# LANGUAGE CPP, RankNTypes, UndecidableInstances, GADTs, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.LightButton
    (
     -- * Hierarchy
     --
     -- $hierarchy

     -- * Widget Functions
     --
     -- $functions
    )
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.Dispatch
import Graphics.UI.FLTK.LowLevel.Hierarchy


buttonHandle' a3 :: Int
:: (Ptr ()) -> (CInt) -> IO ((Int))
buttonHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  Ptr () -> CInt -> IO CInt
buttonHandle''_ Ptr ()
a1' CInt
a2' IO CInt -> (CInt -> IO Int) -> IO Int
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= \res :: CInt
res ->
  let {res' :: Int
res' = CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral CInt
res} in
  Int -> IO Int
forall (m :: * -> *) a. Monad m => a -> m a
return (Int
res')

{-# LINE 25 "src/Graphics/UI/FLTK/LowLevel/LightButton.chs" #-}

instance (impl ~ ((Event -> IO (Either UnknownEvent ())))) => Op (Handle ()) LightButton orig impl where
  runOp _ _ button event = withRef button (\p -> buttonHandle' 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 28 "src/Graphics/UI/FLTK/LowLevel/LightButton.chs" #-}

instance (impl ~ ((Rectangle -> IO ()))) => Op (Resize ()) LightButton orig impl where
  runOp _ _ button rectangle = withRef button $ \buttonPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' buttonPtr x_pos y_pos w_pos h_pos
buttonShow' :: (Ptr ()) -> IO ((()))
buttonShow' a1 =
  let {a1' = id a1} in 
  buttonShow''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 33 "src/Graphics/UI/FLTK/LowLevel/LightButton.chs" #-}

instance (impl ~ ((IO ()))) => Op (ShowWidget ()) LightButton orig impl where
  runOp _ _ button = withRef button $ (\p -> buttonShow' p)
hide' :: (Ptr ()) -> IO ((()))
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 36 "src/Graphics/UI/FLTK/LowLevel/LightButton.chs" #-}

instance (impl ~ (( IO ()))) => Op (Hide ()) LightButton orig impl where
  runOp _ _ button = withRef button $ \buttonPtr -> hide' buttonPtr

draw'' :: (Ptr ()) -> IO ()
draw'' a1 =
  let {a1' = id a1} in 
  draw'''_ a1' >>
  return ()

{-# LINE 40 "src/Graphics/UI/FLTK/LowLevel/LightButton.chs" #-}

instance (impl ~ (  IO ())) => Op (Draw ()) LightButton orig impl where
  runOp _ _ lightButton = withRef lightButton $ \lightButtonPtr -> draw'' lightButtonPtr

-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.Button"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.LightButton"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.LightButton"
-- @

-- $functions
-- @
-- draw :: 'Ref' 'LightButton' -> 'IO' ()
--
-- handle :: 'Ref' 'LightButton' -> ('Event' -> 'IO' ('Either' 'UnknownEvent' ()))
--
-- hide :: 'Ref' 'LightButton' -> ( 'IO' ())
--
-- resize :: 'Ref' 'LightButton' -> ('Rectangle' -> 'IO' ())
--
-- showWidget :: 'Ref' 'LightButton' -> ('IO' ())
-- @

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/LightButton.chs.h Fl_DerivedLight_Button_handle"
  buttonHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/LightButton.chs.h Fl_DerivedLight_Button_resize"
  resize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/LightButton.chs.h Fl_DerivedLight_Button_show"
  buttonShow''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/LightButton.chs.h Fl_DerivedLight_Button_hide"
  hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/LightButton.chs.h Fl_Light_Button_draw"
  draw'''_ :: ((C2HSImp.Ptr ()) -> (IO ()))