-- 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/Window.chs" #-}
{-# LANGUAGE CPP, UndecidableInstances, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ExistentialQuantification #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Window
  (
    -- * Hierarchy
    --
    -- $hierarchy

    -- * Functions
    --
    -- $functions
  )
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

windowHandle' a3 :: Int
:: (Ptr ()) -> (CInt) -> IO ((Int))
windowHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  Ptr () -> CInt -> IO CInt
windowHandle''_ 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 26 "src/Graphics/UI/FLTK/LowLevel/Window.chs" #-}

instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) Window 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 29 "src/Graphics/UI/FLTK/LowLevel/Window.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) Window 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
windowShow' :: (Ptr ()) -> IO ((()))
windowShow' a1 =
  let {a1' = id a1} in 
  windowShow''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 34 "src/Graphics/UI/FLTK/LowLevel/Window.chs" #-}

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

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

{-# LINE 38 "src/Graphics/UI/FLTK/LowLevel/Window.chs" #-}

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

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

{-# LINE 42 "src/Graphics/UI/FLTK/LowLevel/Window.chs" #-}

instance (impl ~ ( IO ())) => Op (Flush ()) Window orig impl where
  runOp _ _ window = withRef window $ \windowPtr -> flush' windowPtr

-- $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.Window"
-- @

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

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Window.chs.h Fl_Window_flush"
  flush''_ :: ((C2HSImp.Ptr ()) -> (IO ()))