-- 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/SingleWindow.chs" #-}
{-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.SingleWindow
  (
    -- * Hierarchy
    --
    -- $hierarchy
  )
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Ptr as C2HSImp




import Foreign
import Foreign.C
import Graphics.UI.FLTK.LowLevel.Fl_Types
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Dispatch
import Graphics.UI.FLTK.LowLevel.Hierarchy

windowDestroy' :: (Ptr ()) -> IO ((()))
windowDestroy' :: Ptr () -> IO ()
windowDestroy' a1 =
  let {a1' = id a1} in 
  Ptr () -> IO ()
windowDestroy''_ 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 20 "src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) SingleWindow orig impl where
  runOp _ _ win = withRef win $ \winPtr -> windowDestroy' winPtr

hide' :: (Ptr ()) -> IO ((()))
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 24 "src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs" #-}

instance (impl ~ ( IO ())) => Op (Hide ()) SingleWindow orig impl where
  runOp _ _ window = withRef window $ \windowPtr -> hide' windowPtr

windowShow' :: (Ptr ()) -> IO ((()))
windowShow' a1 =
  let {a1' = id a1} in 
  windowShow''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 28 "src/Graphics/UI/FLTK/LowLevel/SingleWindow.chs" #-}

instance (impl ~ (IO ())) => Op (ShowWidget ()) SingleWindow orig impl where
  runOp _ _ window = withRef window (\p -> windowShow' p)

windowHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
windowHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  windowHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

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

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) SingleWindow orig impl where
  runOp _ _ window rectangle = withRef window $ \windowPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' windowPtr x_pos y_pos w_pos h_pos

-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.Group"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.Window"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.SingleWindow"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.SingleWindow"
-- @

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/SingleWindow.chs.h Fl_DerivedSingle_Window_Destroy"
  windowDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/SingleWindow.chs.h Fl_DerivedSingle_Window_show"
  windowShow''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

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

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