-- 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/MenuPrim.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, ScopedTypeVariables, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.MenuPrim
    (
     menu_New,
     menu_Custom,
     insertMenuItem
     -- * 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.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.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 34 "src/Graphics/UI/FLTK/LowLevel/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 35 "src/Graphics/UI/FLTK/LowLevel/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 36 "src/Graphics/UI/FLTK/LowLevel/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 37 "src/Graphics/UI/FLTK/LowLevel/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 59 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (IO ())) => Op (Destroy ()) MenuPrim 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 65 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Event ->  IO (Either UnknownEvent ()))) => Op (HandleSuper ()) MenuPrim orig impl where
  runOp _ _ menu_ event = withRef menu_ $ \menu_Ptr -> handleSuper' menu_Ptr (fromIntegral (fromEnum event)) >>= return . successOrUnknownEvent
menu_Handle' :: (Ptr ()) -> (CInt) -> IO ((Int))
menu_Handle' a1 a2 =
  let {a1' = id a1} in
  let {a2' = id a2} in
  menu_Handle''_ a1' a2' >>= \res ->
  let {res' = fromIntegral res} in
  return (res')

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

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

instance (impl ~ (Rectangle -> IO ())) => Op (ResizeSuper ()) MenuPrim orig impl where
  runOp _ _ menu_ rectangle =
    let (x_pos, y_pos, width, height) = fromRectangle rectangle
    in withRef menu_ $ \menu_Ptr -> resizeSuper' menu_Ptr x_pos y_pos width height
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 76 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Rectangle -> IO ())) => Op (Resize ()) MenuPrim orig impl where
  runOp _ _ menu_ rectangle = withRef menu_ $ \menu_Ptr -> do
                                 let (x_pos,y_pos,w_pos,h_pos) = fromRectangle rectangle
                                 resize' menu_Ptr x_pos y_pos w_pos h_pos
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/MenuPrim.chs" #-}

instance (impl ~ ( IO ())) => Op (HideSuper ()) MenuPrim orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> hideSuper' menu_Ptr
hide' :: (Ptr ()) -> IO ((()))
hide' a1 =
  let {a1' = id a1} in
  hide''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

instance (impl ~ ( IO ())) => Op (Hide ()) MenuPrim orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> hide' menu_Ptr
showSuper' :: (Ptr ()) -> IO ((()))
showSuper' a1 =
  let {a1' = id a1} in
  showSuper''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

instance (impl ~ ( IO ())) => Op (ShowWidgetSuper ()) MenuPrim orig impl where
  runOp _ _ menu_ = withRef menu_ $ \menu_Ptr -> showSuper' menu_Ptr
menu_Show' :: (Ptr ()) -> IO ((()))
menu_Show' a1 =
  let {a1' = id a1} in
  menu_Show''_ a1' >>= \res ->
  let {res' = supressWarningAboutRes res} in
  return (res')

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

instance (impl ~ (IO ())) => Op (ShowWidget ()) MenuPrim orig impl where
  runOp _ _ menu_ = withRef menu_ $ (\p -> menu_Show' p)

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

instance (Parent a MenuItem, impl ~ (Ref a -> IO (Maybe T.Text))) => Op (ItemPathname ()) MenuPrim 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 ()) MenuPrim 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 118 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (Parent a MenuItem, Parent b MenuItem, impl ~ (Ref a -> IO (Maybe (Ref b)))) => Op (Picked ()) MenuPrim 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 121 "src/Graphics/UI/FLTK/LowLevel/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 122 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (MenuItemLocator -> IO (Maybe Int))) => Op (FindIndex ()) MenuPrim 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 130 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (Parent a MenuItem, impl ~ ( IO (Maybe (Ref a)))) => Op (TestShortcut ()) MenuPrim 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 133 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO ())) => Op (Global ()) MenuPrim 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 136 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO [(Maybe (Ref MenuItem))])) => Op (GetMenu ()) MenuPrim 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 152 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (Parent a MenuItem, impl ~ ([Ref a] -> IO ())) => Op (SetMenu ()) MenuPrim 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 158 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

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

insertMenuItem ::
  (Parent a MenuPrim) =>
  Ref MenuPrim ->
  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 211 "src/Graphics/UI/FLTK/LowLevel/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 212 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (Parent a MenuPrim, impl ~ ( AtIndex -> T.Text -> Maybe Shortcut -> (Ref a -> IO ()) -> MenuItemFlags -> IO (AtIndex))) => Op (Insert ()) MenuPrim 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 217 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (T.Text -> IO ())) => Op (AddName ()) MenuPrim 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 220 "src/Graphics/UI/FLTK/LowLevel/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 221 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

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

instance (Parent a MenuItem, impl ~ ( T.Text -> Maybe Shortcut -> Maybe (Ref a-> IO ()) -> MenuItemFlags -> IO (Ref MenuItem))) => Op (AddAndGetMenuItem ()) MenuPrim 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 235 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (Int))) => Op (GetSize ()) MenuPrim 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 238 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Size ->  IO ())) => Op (SetSize ()) MenuPrim 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 241 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO ())) => Op (Clear ()) MenuPrim 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 244 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO (Either OutOfRange ()))) => Op (ClearSubmenu ()) MenuPrim 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 247 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex -> T.Text ->  IO ())) => Op (Replace ()) MenuPrim 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 250 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO ())) => Op (Remove ()) MenuPrim 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 253 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex -> ShortcutKeySequence ->  IO ())) => Op (SetShortcut ()) MenuPrim 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 258 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex -> MenuItemFlags ->  IO ())) => Op (SetMode ()) MenuPrim 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 261 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO (Maybe MenuItemFlags))) => Op (GetMode ()) MenuPrim 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 264 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (IO (Maybe (Ref MenuItem)))) => Op (Mvalue ()) MenuPrim 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 267 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (Maybe AtIndex))) => Op (GetValue ()) MenuPrim 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 272 "src/Graphics/UI/FLTK/LowLevel/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 273 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (MenuItemReference -> IO (Either NoChange ()))) => Op (SetValue ()) MenuPrim 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 282 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO T.Text)) => Op (GetText ()) MenuPrim 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 285 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (AtIndex ->  IO T.Text)) => Op (GetTextWithIndex ()) MenuPrim 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 288 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (Font))) => Op (GetTextfont ()) MenuPrim 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 291 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Font ->  IO ())) => Op (SetTextfont ()) MenuPrim 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 294 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (FontSize))) => Op (GetTextsize ()) MenuPrim 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 297 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (FontSize ->  IO ())) => Op (SetTextsize ()) MenuPrim 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 300 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (Color))) => Op (GetTextcolor ()) MenuPrim 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 303 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Color ->  IO ())) => Op (SetTextcolor ()) MenuPrim 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 306 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (Boxtype))) => Op (GetDownBox ()) MenuPrim 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 309 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Boxtype ->  IO ())) => Op (SetDownBox ()) MenuPrim 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 312 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ ( IO (Color))) => Op (GetDownColor ()) MenuPrim 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 315 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

instance (impl ~ (Color ->  IO ())) => Op (SetDownColor ()) MenuPrim 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 318 "src/Graphics/UI/FLTK/LowLevel/MenuPrim.chs" #-}

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

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


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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/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/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/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/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/MenuPrim.chs.h Fl_Menu__Destroy"
  widgetDestroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))

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

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

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

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

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

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

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

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/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/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/MenuPrim.chs.h Fl_Menu__picked"
  picked''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ()))))

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/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/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/MenuPrim.chs.h Fl_Menu__test_shortcut"
  testShortcut''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))

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

foreign import ccall safe "Graphics/UI/FLTK/LowLevel/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/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/MenuPrim.chs.h Fl_Menu__copy"
  copy''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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