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


{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.Base.MenuPrim
    (
     menu_New,
     menu_Custom,
     insertMenuItem
   , handleMenuPrimBase
   , resizeMenuPrimBase
   , hideMenuPrimBase
   , showWidgetMenuPrimBase
     -- * 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.Base.Widget
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 qualified Data.Text as T
import Graphics.UI.FLTK.LowLevel.Hierarchy
import Graphics.UI.FLTK.LowLevel.Base.MenuItem
import qualified Data.ByteString.Char8 as C
import Control.Exception

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

{-# LINE 38 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.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 39 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

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

menu_Custom :: Rectangle -> Maybe T.Text -> Maybe (CustomWidgetFuncs MenuPrim) -> IO (Ref MenuPrim)
menu_Custom rectangle l' funcs' =
  widgetMaker
    rectangle
    l'
    Nothing
    funcs'
    overriddenWidgetNew'
    overriddenWidgetNewWithLabel'

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


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

{-# LINE 63 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = swapRef menu_ $
                          \menu_Ptr ->
                             widgetDestroy' menu_Ptr >>
                             return nullPtr

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

{-# LINE 70 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

handleMenuPrimBase :: Ref MenuPrimBase -> Event ->  IO (Either UnknownEvent ())
handleMenuPrimBase menuPrim event = withRef menuPrim $ \menuPrimPtr -> handleSuper' menuPrimPtr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
resizeSuper' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> IO ((()))
resizeSuper' 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
  resizeSuper''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

{-# LINE 73 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

resizeMenuPrimBase :: Ref MenuPrimBase -> Rectangle -> IO ()
resizeMenuPrimBase menuPrim rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef menuPrim $ \menuPrimPtr -> resizeSuper' menuPrimPtr 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 78 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

hideMenuPrimBase ::  Ref MenuPrimBase -> IO ()
hideMenuPrimBase menuPrim = withRef menuPrim $ \menuPrimPtr -> hideSuper' menuPrimPtr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

showWidgetMenuPrimBase ::  Ref MenuPrimBase -> IO ()
showWidgetMenuPrimBase menuPrim = withRef menuPrim $ \menuPrimPtr -> showSuper' menuPrimPtr

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

{-# LINE 85 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (Event -> IO (Either UnknownEvent ()))) => Op (Handle ()) MenuPrimBase orig impl where
  runOp _ _ menuPrim event = withRef menuPrim (\p -> menuPrimHandle' p (fromIntegral . fromEnum $ event)) >>= return  . successOrUnknownEvent
show' :: (Ptr ()) -> IO ((()))
show' a1 =
  let {a1' = id a1} in
  show''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

instance (impl ~ (IO ())) => Op (ShowWidget ()) MenuPrimBase orig impl where
  runOp _ _ menuPrim = withRef menuPrim $ \menuPrimPtr -> show' menuPrimPtr
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 91 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

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

{-# LINE 96 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (IO ())) => Op (Hide ()) MenuPrimBase orig impl where
  runOp _ _ menuPrim = withRef menuPrim $ \menuPrimPtr -> hide' menuPrimPtr

itemPathnameWithFinditem' :: (Ptr ()) -> (Ptr CChar) -> (Int) -> (Ptr ()) -> IO ((Int))
itemPathnameWithFinditem' a1 a2 a3 a4 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  let {a3' = fromIntegral a3} in
  let {a4' = id a4} in
  itemPathnameWithFinditem''_ a1' a2' a3' a4' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 100 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

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

{-# LINE 101 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, impl ~ (Ref a -> IO (Maybe T.Text))) => Op (ItemPathname ()) MenuPrimBase orig impl where
  runOp _ _ menu_ menu_item' =
    withRef menu_ $
    \ menu_Ref ->
     allocaBytes oneKb $ \ptr -> do
       retVal' <- withRef menu_item' $ \ menu_item'Ref -> itemPathnameWithFinditem' menu_Ref (castPtr ptr) oneKb menu_item'Ref
       if (retVal' == -1)
         then return Nothing
         else do
           b' <- cStringToText ptr
           return $ Just b'
instance (impl ~ (IO (Maybe String))) => Op (ItemPathnameRecent ()) MenuPrimBase orig impl where
  runOp _ _ menu_ =
    withRef menu_ $ \menu_Ptr ->
    allocaBytes oneKb $ \pathPtr -> do
      retVal' <- itemPathname' menu_Ptr (castPtr pathPtr) oneKb
      if (retVal' == -1)
        then return Nothing
        else do
          b' <- C.packCString (castPtr pathPtr)
          return $ Just (C.unpack b')

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

{-# LINE 124 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, Parent b MenuItemBase, impl ~ (Ref a -> IO (Maybe (Ref b)))) => Op (Picked ()) MenuPrimBase orig impl where
  runOp _ _ menu_ item = withRef menu_ $ \menu_Ptr -> withRef item $ \itemPtr -> picked' menu_Ptr itemPtr >>= toMaybeRef
findIndexWithName' :: (Ptr ()) -> (CString) -> IO ((Int))
findIndexWithName' a1 a2 =
  let {a1' = id a1} in
  (flip ($)) a2 $ \a2' ->
  findIndexWithName''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 127 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

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

{-# LINE 128 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (MenuItemLocator -> IO (Maybe Int))) => Op (FindIndex ()) MenuPrimBase orig impl where
  runOp _ _ menu_ menu_item_referene =
    withRef menu_ $ \menu_Ptr ->
        case menu_item_referene of
          MenuItemNameLocator (MenuItemName name) -> withText name (\n -> findIndexWithName' menu_Ptr n >>= \r -> if (r == -1) then (return Nothing) else (return $ Just r))
          MenuItemPointerLocator (MenuItemPointer menu_item) ->
              withRef menu_item $ \menu_itemPtr -> findIndexWithItem' menu_Ptr menu_itemPtr >>= \r -> if (r == -1) then (return Nothing) else (return $ Just r)
testShortcut' :: (Ptr ()) -> IO ((Ptr ()))
testShortcut' a1 =
  let {a1' = id a1} in
  testShortcut''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 136 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, impl ~ ( IO (Maybe (Ref a)))) => Op (TestShortcut ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> testShortcut' menu_Ptr >>= toMaybeRef
global' :: (Ptr ()) -> IO ()
global' a1 =
  let {a1' = id a1} in
  global''_ a1' >>
  return ()

{-# LINE 139 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO ())) => Op (Global ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> global' menu_Ptr
getMenuItemByIndex' :: (Ptr ()) -> (CInt) -> IO ((Ptr ()))
getMenuItemByIndex' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  getMenuItemByIndex''_ a1' a2' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 142 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO [(Maybe (Ref MenuItemBase))])) => Op (GetMenu ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> do
    n <- getSize menu_
    if (n == 0)
     then return []
     else go menu_Ptr 0 (n-1) []
      where
        go _ _ 0 accum = return accum
        go ptr offset left accum = do
          ref <- getMenuItemByIndex' ptr offset >>= toMaybeRef
          go ptr
             (offset + 1)
             (left - 1)
             (accum ++ [ref])

menuWithM' :: (Ptr ()) -> (Ptr (Ptr ())) -> (Int) -> IO ()
menuWithM' a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  let {a3' = fromIntegral a3} in
  menuWithM''_ a1' a2' a3' >>
  return ()

{-# LINE 158 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, impl ~ ([Ref a] -> IO ())) => Op (SetMenu ()) MenuPrimBase orig impl where
  runOp _ _ menu_ items =
    withRef menu_ $ \menu_Ptr ->
        withRefs items $ \menu_itemsPtr ->
            menuWithM' menu_Ptr menu_itemsPtr (length items)
copy' :: (Ptr ()) -> (Ptr ()) -> IO ()
copy' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  copy''_ a1' a2' >>
  return ()

{-# LINE 164 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, impl ~ (Ref a->  IO ())) => Op (Copy ()) MenuPrimBase orig impl where
  runOp _ _ menu_ m = withRef menu_ $ \menu_Ptr -> withRef m $ \mPtr -> copy' menu_Ptr mPtr

insertMenuItem ::
  (Parent a MenuPrimBase) =>
  Ref MenuPrimBase ->
  Int ->
  T.Text ->
  Maybe Shortcut ->
  (Ref a -> IO ()) ->
  MenuItemFlags ->
  (Ptr () -> Int -> CString -> CInt -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
  (Ptr () -> Int -> CString -> CString -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
  IO (AtIndex)
insertMenuItem menu_ index' name shortcut cb flags insertWithFlags'' insertWithShortcutnameFlags'' =
  withRef menu_ $ \menu_Ptr -> do
    let combinedFlags = menuItemFlagsToInt flags
    ptr <- toCallbackPrim cb
    idx' <- case shortcut of
              Just s' -> case s' of
                KeySequence (ShortcutKeySequence modifiers char) -> do
                  n <- copyTextToCString name
                  insertWithFlags''
                    menu_Ptr
                    index'
                    n
                    (keySequenceToCInt modifiers char)
                    (castFunPtr ptr)
                    combinedFlags
                KeyFormat format' -> do
                  f <- copyTextToCString format'
                  n <- copyTextToCString name
                  if (not $ T.null format') then
                    insertWithShortcutnameFlags''
                      menu_Ptr
                      index'
                      n
                      f
                      (castFunPtr ptr)
                      combinedFlags
                  else error "Fl_Menu_.menu_insert: shortcut format string cannot be empty"
              Nothing -> do
                n <- copyTextToCString name
                insertWithFlags''
                  menu_Ptr
                  index'
                  n
                  0
                  (castFunPtr ptr)
                  combinedFlags
    return (AtIndex idx')

insertWithFlags' :: (Ptr ()) -> (Int) -> (CString) -> (CInt) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
insertWithFlags' a1 a2 a3 a4 a5 a6 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  (flip ($)) a3 $ \a3' ->
  let {a4' = id a4} in
  let {a5' = id a5} in
  let {a6' = fromIntegral a6} in
  insertWithFlags''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 217 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

insertWithShortcutnameFlags' :: (Ptr ()) -> (Int) -> (CString) -> (CString) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
insertWithShortcutnameFlags' a1 a2 a3 a4 a5 a6 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  (flip ($)) a3 $ \a3' ->
  (flip ($)) a4 $ \a4' ->
  let {a5' = id a5} in
  let {a6' = fromIntegral a6} in
  insertWithShortcutnameFlags''_ a1' a2' a3' a4' a5' a6' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 218 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuPrimBase, impl ~ ( AtIndex -> T.Text -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (AtIndex))) => Op (Insert ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex index') name shortcut cb flags =
    insertMenuItem menu_ index' name shortcut cb flags insertWithFlags' insertWithShortcutnameFlags'

add' :: (Ptr ()) -> (CString) -> IO ()
add' a1 a2 =
  let {a1' = id a1} in
  (flip ($)) a2 $ \a2' ->
  add''_ a1' a2' >>
  return ()

{-# LINE 223 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (T.Text -> IO ())) => Op (AddName ()) MenuPrimBase orig impl where
  runOp _ _ menu_ name' = withRef menu_ $ \menu_Ptr -> copyTextToCString name' >>= add' menu_Ptr
addWithFlags' :: (Ptr ()) -> (CString) -> (CInt) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
addWithFlags' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in
  (flip ($)) a2 $ \a2' ->
  let {a3' = id a3} in
  let {a4' = id a4} in
  let {a5' = fromIntegral a5} in
  addWithFlags''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 226 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

addWithShortcutnameFlags' :: (Ptr ()) -> (CString) -> (CString) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
addWithShortcutnameFlags' a1 a2 a3 a4 a5 =
  let {a1' = id a1} in
  (flip ($)) a2 $ \a2' ->
  (flip ($)) a3 $ \a3' ->
  let {a4' = id a4} in
  let {a5' = fromIntegral a5} in
  addWithShortcutnameFlags''_ a1' a2' a3' a4' a5' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 227 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, impl ~ ( T.Text -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (AtIndex))) => Op (Add ()) MenuPrimBase orig (impl) where
  runOp _ _ menu_ name shortcut cb flags =
    addMenuItem (Left menu_) name shortcut cb flags addWithFlags' addWithShortcutnameFlags'

instance (Parent a MenuItemBase, impl ~ ( T.Text -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (Ref MenuItemBase))) => Op (AddAndGetMenuItem ()) MenuPrimBase orig (impl) where
  runOp _ _ menu_ name shortcut cb flags = do
    (AtIndex i) <- add menu_ name shortcut cb flags
    items <- getMenu menu_
    let mi = items !! i
    case mi of
      Just mi' -> return mi'
      Nothing -> throwIO (userError ("FLTK claims the menu item " ++ (T.unpack name) ++ " was added successfully at index " ++ (show i) ++ " , but no MenuItem at that index could be retrieved."))

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

{-# LINE 241 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetSize ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> size' menu_Ptr
setSize' :: (Ptr ()) -> (Int) -> (Int) -> IO ()
setSize' a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  let {a3' = fromIntegral a3} in
  setSize''_ a1' a2' a3' >>
  return ()

{-# LINE 244 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (Size ->  IO ())) => Op (SetSize ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (Size (Width w) (Height h)) = withRef menu_ $ \menu_Ptr -> setSize' menu_Ptr w h
clear' :: (Ptr ()) -> IO ()
clear' a1 =
  let {a1' = id a1} in
  clear''_ a1' >>
  return ()

{-# LINE 247 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO ())) => Op (Clear ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> clear' menu_Ptr
clearSubmenu' :: (Ptr ()) -> (Int) -> IO ((Int))
clearSubmenu' a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  clearSubmenu''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 250 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO (Either OutOfRange ()))) => Op (ClearSubmenu ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex index') = withRef menu_ $ \menu_Ptr -> clearSubmenu' menu_Ptr index' >>= \ret' -> if ret' == -1 then return (Left OutOfRange) else return (Right ())
replace' :: (Ptr ()) -> (Int) -> (CString) -> IO ()
replace' a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  (flip ($)) a3 $ \a3' ->
  replace''_ a1' a2' a3' >>
  return ()

{-# LINE 253 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex -> T.Text ->  IO ())) => Op (Replace ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex index') name = withRef menu_ $ \menu_Ptr -> copyTextToCString name >>= replace' menu_Ptr index'
remove' :: (Ptr ()) -> (Int) -> IO ()
remove' a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  remove''_ a1' a2' >>
  return ()

{-# LINE 256 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO ())) => Op (Remove ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex index') = withRef menu_ $ \menu_Ptr -> remove' menu_Ptr index'
shortcut' :: (Ptr ()) -> (Int) -> (CInt) -> IO ()
shortcut' a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  let {a3' = id a3} in
  shortcut''_ a1' a2' a3' >>
  return ()

{-# LINE 259 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex -> ShortcutKeySequence ->  IO ())) => Op (SetShortcut ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex index') (ShortcutKeySequence modifiers char) =
    withRef menu_ $ \menu_Ptr ->
        shortcut' menu_Ptr index' (keySequenceToCInt modifiers char)
setMode' :: (Ptr ()) -> (Int) -> (Int) -> IO ()
setMode' a1 a2 a3 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  let {a3' = fromIntegral a3} in
  setMode''_ a1' a2' a3' >>
  return ()

{-# LINE 264 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex -> MenuItemFlags ->  IO ())) => Op (SetMode ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex i) fl = withRef menu_ $ \menu_Ptr -> setMode' menu_Ptr i (menuItemFlagsToInt fl)
mode' :: (Ptr ()) -> (Int) -> IO ((Int))
mode' a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  mode''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 267 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO (Maybe MenuItemFlags))) => Op (GetMode ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex i) = withRef menu_ $ \menu_Ptr -> mode' menu_Ptr i >>= return . intToMenuItemFlags
mvalue' :: (Ptr ()) -> IO ((Ptr ()))
mvalue' a1 =
  let {a1' = id a1} in
  mvalue''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 270 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (IO (Maybe (Ref MenuItemBase)))) => Op (Mvalue ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> mvalue' menu_Ptr >>= toMaybeRef
value' :: (Ptr ()) -> IO ((Int))
value' a1 =
  let {a1' = id a1} in
  value''_ a1' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 273 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (Maybe AtIndex))) => Op (GetValue ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> do
    res <- value' menu_Ptr
    return (if (res == -1) then Nothing else Just (AtIndex res))
valueWithItem' :: (Ptr ()) -> (Ptr ()) -> IO ((Int))
valueWithItem' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  valueWithItem''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

{-# LINE 278 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

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

{-# LINE 279 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (MenuItemReference -> IO (Either NoChange ()))) => Op (SetValue ()) MenuPrimBase orig impl where
  runOp _ _ menu_ menu_item_reference =
    withRef menu_ $ \menu_Ptr ->
        case menu_item_reference of
          (MenuItemByIndex (AtIndex index')) -> valueWithIndex' menu_Ptr index' >>= return . successOrNoChange
          (MenuItemByPointer (MenuItemPointer menu_item)) ->
              withRef menu_item $ \menu_itemPtr ->
                  valueWithItem' menu_Ptr menu_itemPtr >>= return . successOrNoChange
text' :: (Ptr ()) -> IO ((CString))
text' a1 =
  let {a1' = id a1} in
  text''_ a1' >>= \res ->
  return res >>= \res' ->
  return (res')

{-# LINE 288 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO T.Text)) => Op (GetText ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> text' menu_Ptr >>= cStringToText
textWithIndex' :: (Ptr ()) -> (Int) -> IO ((CString))
textWithIndex' a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  textWithIndex''_ a1' a2' >>= \res ->
  return res >>= \res' ->
  return (res')

{-# LINE 291 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO T.Text)) => Op (GetTextWithIndex ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (AtIndex i) = withRef menu_ $ \menu_Ptr -> textWithIndex' menu_Ptr i >>= cStringToText
textfont' :: (Ptr ()) -> IO ((Font))
textfont' a1 =
  let {a1' = id a1} in
  textfont''_ a1' >>= \res ->
  let {res' = cToFont res} in
  return (res')

{-# LINE 294 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (Font))) => Op (GetTextfont ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> textfont' menu_Ptr
setTextfont' :: (Ptr ()) -> (Font) -> IO ()
setTextfont' a1 a2 =
  let {a1' = id a1} in
  let {a2' = cFromFont a2} in
  setTextfont''_ a1' a2' >>
  return ()

{-# LINE 297 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (Font ->  IO ())) => Op (SetTextfont ()) MenuPrimBase orig impl where
  runOp _ _ menu_ c = withRef menu_ $ \menu_Ptr -> setTextfont' menu_Ptr c
textsize' :: (Ptr ()) -> IO ((CInt))
textsize' a1 =
  let {a1' = id a1} in
  textsize''_ a1' >>= \res ->
  let {res' = id res} in
  return (res')

{-# LINE 300 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (FontSize))) => Op (GetTextsize ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> textsize' menu_Ptr >>= return . FontSize
setTextsize' :: (Ptr ()) -> (CInt) -> IO ()
setTextsize' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  setTextsize''_ a1' a2' >>
  return ()

{-# LINE 303 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (FontSize ->  IO ())) => Op (SetTextsize ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (FontSize c) = withRef menu_ $ \menu_Ptr -> setTextsize' menu_Ptr c
textcolor' :: (Ptr ()) -> IO ((Color))
textcolor' a1 =
  let {a1' = id a1} in
  textcolor''_ a1' >>= \res ->
  let {res' = cToColor res} in
  return (res')

{-# LINE 306 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (Color))) => Op (GetTextcolor ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> textcolor' menu_Ptr
setTextcolor' :: (Ptr ()) -> (Color) -> IO ()
setTextcolor' a1 a2 =
  let {a1' = id a1} in
  let {a2' = cFromColor a2} in
  setTextcolor''_ a1' a2' >>
  return ()

{-# LINE 309 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (Color ->  IO ())) => Op (SetTextcolor ()) MenuPrimBase orig impl where
  runOp _ _ menu_ c = withRef menu_ $ \menu_Ptr -> setTextcolor' menu_Ptr c
downBox' :: (Ptr ()) -> IO ((Boxtype))
downBox' a1 =
  let {a1' = id a1} in
  downBox''_ a1' >>= \res ->
  let {res' = cToEnum res} in
  return (res')

{-# LINE 312 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (Boxtype))) => Op (GetDownBox ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> downBox' menu_Ptr
setDownBox' :: (Ptr ()) -> (Boxtype) -> IO ()
setDownBox' a1 a2 =
  let {a1' = id a1} in
  let {a2' = cFromEnum a2} in
  setDownBox''_ a1' a2' >>
  return ()

{-# LINE 315 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (Boxtype ->  IO ())) => Op (SetDownBox ()) MenuPrimBase orig impl where
  runOp _ _ menu_ b = withRef menu_ $ \menu_Ptr -> setDownBox' menu_Ptr b
downColor' :: (Ptr ()) -> IO ((Color))
downColor' a1 =
  let {a1' = id a1} in
  downColor''_ a1' >>= \res ->
  let {res' = cToColor res} in
  return (res')

{-# LINE 318 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ ( IO (Color))) => Op (GetDownColor ()) MenuPrimBase orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> downColor' menu_Ptr
setDownColor' :: (Ptr ()) -> (CUInt) -> IO ()
setDownColor' a1 a2 =
  let {a1' = id a1} in
  let {a2' = fromIntegral a2} in
  setDownColor''_ a1' a2' >>
  return ()

{-# LINE 321 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (impl ~ (Color ->  IO ())) => Op (SetDownColor ()) MenuPrimBase orig impl where
  runOp _ _ menu_ (Color c) = withRef menu_ $ \menu_Ptr -> setDownColor' menu_Ptr c
setonly' :: (Ptr ()) -> (Ptr ()) -> IO ()
setonly' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  setonly''_ a1' a2' >>
  return ()

{-# LINE 324 "src/Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs" #-}

instance (Parent a MenuItemBase, impl ~ (Ref a -> IO ())) => Op (Setonly ()) MenuPrimBase orig impl where
  runOp _ _ menu_ item = withRef menu_ $ \menu_Ptr ->
                            withRef item $ \item_Ptr -> setonly' menu_Ptr item_Ptr


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

-- $functions
-- @
-- add:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'T.Text' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('AtIndex')
--
-- addAndGetMenuItem:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'T.Text' -> 'Maybe' 'Shortcut' -> 'Maybe' ('Ref' a-> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('Ref' 'MenuItemBase')
--
-- addName :: 'Ref' 'MenuPrimBase' -> 'T.Text' -> 'IO' ()
--
-- clear :: 'Ref' 'MenuPrimBase' -> 'IO' ()
--
-- clearSubmenu :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'IO' ('Either' 'OutOfRange' ())
--
-- copy:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'Ref' a-> 'IO' ()
--
-- destroy :: 'Ref' 'MenuPrimBase' -> 'IO' ()
--
-- findIndex :: 'Ref' 'MenuPrimBase' -> 'MenuItemLocator' -> 'IO' ('Maybe' 'Int')
--
-- getDownBox :: 'Ref' 'MenuPrimBase' -> 'IO' ('Boxtype')
--
-- getDownColor :: 'Ref' 'MenuPrimBase' -> 'IO' ('Color')
--
-- getMenu :: 'Ref' 'MenuPrimBase' -> 'IO' [('Maybe' ('Ref' 'MenuItemBase']))
--
-- getMode :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'IO' ('Maybe' 'MenuItemFlags')
--
-- getSize :: 'Ref' 'MenuPrimBase' -> 'IO' ('Int')
--
-- getText :: 'Ref' 'MenuPrimBase' -> 'IO' 'T.Text'
--
-- getTextWithIndex :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'IO' 'T.Text'
--
-- getTextcolor :: 'Ref' 'MenuPrimBase' -> 'IO' ('Color')
--
-- getTextfont :: 'Ref' 'MenuPrimBase' -> 'IO' ('Font')
--
-- getTextsize :: 'Ref' 'MenuPrimBase' -> 'IO' ('FontSize')
--
-- getValue :: 'Ref' 'MenuPrimBase' -> 'IO' ('Maybe' 'AtIndex')
--
-- global :: 'Ref' 'MenuPrimBase' -> 'IO' ()
--
-- handle :: 'Ref' 'MenuPrimBase' -> 'Event' -> 'IO' ('Either' 'UnknownEvent' ())
--
-- hide :: 'Ref' 'MenuPrimBase' -> 'IO' ()
--
-- insert:: ('Parent' a 'MenuPrimBase') => 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'T.Text' -> 'Maybe' 'Shortcut' -> ('Ref' a -> 'IO' ()) -> 'MenuItemFlags' -> 'IO' ('AtIndex')
--
-- itemPathname:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'Ref' a -> 'IO' ('Maybe' 'T.Text')
--
-- itemPathnameRecent :: 'Ref' 'MenuPrimBase' -> 'IO' ('Maybe' 'String')
--
-- mvalue :: 'Ref' 'MenuPrimBase' -> 'IO' ('Maybe' ('Ref' 'MenuItemBase'))
--
-- picked:: ('Parent' a 'MenuItemBase', 'Parent' b 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'Ref' a -> 'IO' ('Maybe' ('Ref' b))
--
-- remove :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'IO' ()
--
-- replace :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'T.Text' -> 'IO' ()
--
-- resize :: 'Ref' 'MenuPrimBase' -> 'Rectangle' -> 'IO' ()
--
-- setDownBox :: 'Ref' 'MenuPrimBase' -> 'Boxtype' -> 'IO' ()
--
-- setDownColor :: 'Ref' 'MenuPrimBase' -> 'Color' -> 'IO' ()
--
-- setMenu:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> ['Ref' a] -> 'IO' ()
--
-- setMode :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'MenuItemFlags' -> 'IO' ()
--
-- setShortcut :: 'Ref' 'MenuPrimBase' -> 'AtIndex' -> 'ShortcutKeySequence' -> 'IO' ()
--
-- setSize :: 'Ref' 'MenuPrimBase' -> 'Size' -> 'IO' ()
--
-- setTextcolor :: 'Ref' 'MenuPrimBase' -> 'Color' -> 'IO' ()
--
-- setTextfont :: 'Ref' 'MenuPrimBase' -> 'Font' -> 'IO' ()
--
-- setTextsize :: 'Ref' 'MenuPrimBase' -> 'FontSize' -> 'IO' ()
--
-- setValue :: 'Ref' 'MenuPrimBase' -> 'MenuItemReference' -> 'IO' ('Either' 'NoChange' ())
--
-- setonly:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'Ref' a -> 'IO' ()
--
-- showWidget :: 'Ref' 'MenuPrimBase' -> 'IO' ()
--
-- testShortcut:: ('Parent' a 'MenuItemBase') => 'Ref' 'MenuPrimBase' -> 'IO' ('Maybe' ('Ref' a))
-- @

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__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/MenuPrim.chs.h Fl_OverriddenMenu__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/MenuPrim.chs.h Fl_OverriddenMenu__New"
  overriddenWidgetNew''_ :: (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))))))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__insert_with_flags"
  insertWithFlags''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__insert_with_shortcutname_flags"
  insertWithShortcutnameFlags''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (C2HSImp.CInt -> (IO C2HSImp.CInt)))))))

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__add_with_flags"
  addWithFlags''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CChar) -> (C2HSImp.CInt -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (C2HSImp.CInt -> (IO C2HSImp.CInt))))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__add_with_shortcutname_flags"
  addWithShortcutnameFlags''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (C2HSImp.CInt -> (IO C2HSImp.CInt))))))

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

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

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

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

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

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

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

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

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

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__text"
  text''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))

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

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__textcolor"
  textcolor''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__set_textcolor"
  setTextcolor''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (IO ())))

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__down_color"
  downColor''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUInt))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/Base/MenuPrim.chs.h Fl_Menu__set_down_color"
  setDownColor''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (IO ())))

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