-- 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/Base/MenuBar.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.MenuBar
    (
     menuBarNew,
     menuBarCustom
   , drawMenuBarBase
   , handleMenuBarBase
   , resizeMenuBarBase
   , hideMenuBarBase
   , showWidgetMenuBarBase
     -- * Hierarchy
     --
     -- $hierarchy

     -- * 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_Types
import Graphics.UI.FLTK.LowLevel.Utils
import Graphics.UI.FLTK.LowLevel.Dispatch
import qualified Data.Text as T
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Fl_Enumerations
import Graphics.UI.FLTK.LowLevel.Base.Widget

overriddenWidgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNewWithLabel' 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 
  overriddenWidgetNewWithLabel''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = id res} in
  return (res')

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

overriddenWidgetNew' :: (Int) -> (Int) -> (Int) -> (Int) -> (Ptr ()) -> IO ((Ptr ()))
overriddenWidgetNew' 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 
  overriddenWidgetNew''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

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

menuBarCustom ::
       Rectangle                         -- ^ The bounds of this MenuBar
    -> Maybe T.Text                      -- ^ The MenuBar label
    -> Maybe (Ref MenuBar -> IO ())           -- ^ Optional custom drawing function
    -> Maybe (CustomWidgetFuncs MenuBar)      -- ^ Optional custom widget functions
    -> IO (Ref MenuBar)
menuBarCustom rectangle l' draw' funcs' =
  widgetMaker
    rectangle
    l'
    draw'
    funcs'
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'


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

{-# LINE 51 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

widgetNewWithLabel' :: (Int) -> (Int) -> (Int) -> (Int) -> (CString) -> IO ((Ptr ()))
widgetNewWithLabel' 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 
  (flip ($)) a5 $ \a5' -> 
  widgetNewWithLabel''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 52 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

menuBarNew :: Rectangle -> Maybe T.Text -> IO (Ref MenuBar)
menuBarNew rectangle l' =
  widgetMaker
    rectangle
    l'
    Nothing
    Nothing
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'

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 63 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) MenuBarBase orig impl where
  runOp _ _ menuBar = swapRef menuBar $
                          \menuBarPtr ->
                             widgetDestroy' menuBarPtr >>
                             return nullPtr

drawSuper' :: (Ptr ()) -> IO ((()))
drawSuper' :: Ptr () -> IO ()
drawSuper' a1 :: Ptr ()
a1 =
  let {a1' :: Ptr ()
a1' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a1} in 
  Ptr () -> IO ()
drawSuper''_ 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 70 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

drawMenuBarBase ::  Ref MenuBarBase -> IO ()
drawMenuBarBase menuBar = withRef menuBar $ \menuBarPtr -> drawSuper' menuBarPtr
handleSuper' :: (Ptr ()) -> (Int) -> IO ((Int))
handleSuper' :: Ptr () -> Int -> IO Int
handleSuper' a1 :: Ptr ()
a1 a2 :: Int
a2 =
  let {a1' :: Ptr ()
a1' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a1} in 
  let {a2' :: CInt
a2' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2} in 
  Ptr () -> CInt -> IO CInt
handleSuper''_ 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 73 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

handleMenuBarBase :: Ref MenuBarBase -> Event ->  IO (Either UnknownEvent ())
handleMenuBarBase menuBar event = withRef menuBar $ \menuBarPtr -> handleSuper' menuBarPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
resizeSuper' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((()))
resizeSuper' :: Ptr () -> Int -> Int -> Int -> Int -> IO ()
resizeSuper' a1 :: Ptr ()
a1 a2 :: Int
a2 a3 :: Int
a3 a4 :: Int
a4 a5 :: Int
a5 =
  let {a1' :: Ptr ()
a1' = Ptr () -> Ptr ()
forall a. a -> a
id Ptr ()
a1} in 
  let {a2' :: CInt
a2' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a2} in 
  let {a3' :: CInt
a3' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a3} in 
  let {a4' :: CInt
a4' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a4} in 
  let {a5' :: CInt
a5' = Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
a5} in 
  Ptr () -> CInt -> CInt -> CInt -> CInt -> IO ()
resizeSuper''_ Ptr ()
a1' CInt
a2' CInt
a3' CInt
a4' CInt
a5' 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 76 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

resizeMenuBarBase :: Ref MenuBarBase -> Rectangle -> IO ()
resizeMenuBarBase menuBar rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef menuBar $ \menuBarPtr -> resizeSuper' menuBarPtr x_pos y_pos width height
hideSuper' :: (Ptr ()) -> IO ((()))
hideSuper' a1 =
  let {a1' = id a1} in 
  hideSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 81 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

hideMenuBarBase ::  Ref MenuBarBase -> IO ()
hideMenuBarBase menuBar = withRef menuBar $ \menuBarPtr -> hideSuper' menuBarPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in 
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 84 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

showWidgetMenuBarBase ::  Ref MenuBarBase -> IO ()
showWidgetMenuBarBase menuBar = withRef menuBar $ \menuBarPtr -> showSuper' menuBarPtr

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

{-# LINE 88 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

instance (impl ~ (  IO ())) => Op (Draw ()) MenuBarBase orig impl where
  runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> draw'' menuBarPtr
menuBarHandle' :: (Ptr ()) -> (CInt) -> IO ((Int))
menuBarHandle' a1 a2 =
  let {a1' = id a1} in 
  let {a2' = id a2} in 
  menuBarHandle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 91 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

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

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) MenuBarBase orig impl where
  runOp _ _ menuBar rectangle = withRef menuBar $ \menuBarPtr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' menuBarPtr x_pos y_pos w_pos h_pos
hide' :: (Ptr ()) -> IO ()
hide' a1 =
  let {a1' = id a1} in 
  hide''_ a1' >>
  return ()

{-# LINE 99 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

instance (impl ~ (  IO ())) => Op (Hide ()) MenuBarBase orig impl where
  runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> hide' menuBarPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
  let {a1' = id a1} in 
  show''_ a1' >>
  return ()

{-# LINE 102 "src/Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs" #-}

instance (impl ~ (  IO ())) => Op (ShowWidget ()) MenuBarBase orig impl where
  runOp _ _ menuBar = withRef menuBar $ \menuBarPtr -> show' menuBarPtr


-- $hierarchy
-- @
-- "Graphics.UI.FLTK.LowLevel.Base.Widget"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.MenuPrim"
--  |
--  v
-- "Graphics.UI.FLTK.LowLevel.Base.MenuBar"
-- @

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_OverriddenMenu_Bar_New_WithLabel"
  overriddenWidgetNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ()))))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_OverriddenMenu_Bar_New"
  overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_New"
  widgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_New_WithLabel"
  widgetNewWithLabel''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO (C2HSImp.Ptr ())))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_Destroy"
  widgetDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_draw_super"
  drawSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_handle_super"
  handleSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_resize_super"
  resizeSuper''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ()))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_hide_super"
  hideSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_show_super"
  showSuper''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_handle"
  menuBarHandle''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuBar.chs.h Fl_Menu_Bar_show"
  show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))