{-# LINE 1 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
{-# LANGUAGE CPP, ExistentialQuantification, TypeSynonymInstances, FlexibleInstances, MultiParamTypeClasses, FlexibleContexts, UndecidableInstances #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Graphics.UI.FLTK.LowLevel.MenuItem
(
menuItemNew,
addMenuItem,
MenuItemIndex(..),
MenuItemName(..),
MenuItemPointer(..),
MenuItemReference(..),
MenuItemLocator(..)
)
where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.Marshal.Utils as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import C2HS hiding (cFromEnum, cFromBool, cToBool,cToEnum)
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.Hierarchy
import Graphics.UI.FLTK.LowLevel.Dispatch
newtype MenuItemIndex = MenuItemIndex Int
data MenuItemPointer = forall a. (Parent a MenuItem) => MenuItemPointer (Ref a)
newtype MenuItemName = MenuItemName String
data MenuItemReference = MenuItemByIndex MenuItemIndex | MenuItemByPointer MenuItemPointer
data MenuItemLocator = MenuItemPointerLocator MenuItemPointer | MenuItemNameLocator MenuItemName
new' :: IO ((Ptr ()))
new' =
new''_ >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 38 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
menuItemNew :: IO (Ref MenuItem)
menuItemNew = new' >>= toRef
destroy' :: (Ptr ()) -> IO ((()))
destroy' a1 =
let {a1' = id a1} in
destroy''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 42 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Destroy ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> destroy' menu_itemPtr
nextWithStep' :: (Ptr ()) -> (Int) -> IO ((Ptr ()))
nextWithStep' a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
nextWithStep''_ a1' a2' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 46 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuItem, impl ~ (Int -> IO (Maybe (Ref a)))) => Op (NextWithStep ()) MenuItem orig impl where
runOp _ _ menu_item step =
withRef menu_item $ \menu_itemPtr -> nextWithStep' menu_itemPtr step >>= toMaybeRef
next' :: (Ptr ()) -> IO ((Ptr ()))
next' a1 =
let {a1' = id a1} in
next''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 51 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Maybe (Ref MenuItem))) => Op (Next ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> next' menu_itemPtr >>= toMaybeRef
first' :: (Ptr ()) -> IO ((Ptr ()))
first' a1 =
let {a1' = id a1} in
first''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 55 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Maybe (Ref MenuItem))) => Op (GetFirst ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> first' menu_itemPtr >>=toMaybeRef
label' :: (Ptr ()) -> IO ((String))
label' a1 =
let {a1' = id a1} in
label''_ a1' >>= \res ->
let {res' = unsafeFromCString res} in
return (res')
{-# LINE 59 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (String)) => Op (GetLabel ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> label' menu_itemPtr
setLabel' :: (Ptr ()) -> (String) -> IO ()
setLabel' a1 a2 =
let {a1' = id a1} in
let {a2' = unsafeToCString a2} in
setLabel''_ a1' a2' >>
return ()
{-# LINE 63 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (String -> IO ())) => Op (SetLabel ()) MenuItem orig impl where
runOp _ _ menu_item a = withRef menu_item $ \menu_itemPtr -> setLabel' menu_itemPtr a
setLabelWithLabeltype' :: (Ptr ()) -> (Labeltype) -> (String) -> IO ()
setLabelWithLabeltype' a1 a2 a3 =
let {a1' = id a1} in
let {a2' = cFromEnum a2} in
let {a3' = unsafeToCString a3} in
setLabelWithLabeltype''_ a1' a2' a3' >>
return ()
{-# LINE 67 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (Labeltype -> String -> IO ())) => Op (SetLabelWithLabeltype ()) MenuItem orig impl where
runOp _ _ menu_item labeltype b = withRef menu_item $ \menu_itemPtr -> setLabelWithLabeltype' menu_itemPtr labeltype b
labeltype' :: (Ptr ()) -> IO ((Labeltype))
labeltype' a1 =
let {a1' = id a1} in
labeltype''_ a1' >>= \res ->
let {res' = cToEnum res} in
return (res')
{-# LINE 71 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Labeltype)) => Op (GetLabeltype ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> labeltype' menu_itemPtr
setLabeltype' :: (Ptr ()) -> (Labeltype) -> IO ()
setLabeltype' a1 a2 =
let {a1' = id a1} in
let {a2' = cFromEnum a2} in
setLabeltype''_ a1' a2' >>
return ()
{-# LINE 75 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (Labeltype -> IO ())) => Op (SetLabeltype ()) MenuItem orig impl where
runOp _ _ menu_item a = withRef menu_item $ \menu_itemPtr -> setLabeltype' menu_itemPtr a
labelcolor' :: (Ptr ()) -> IO ((Color))
labelcolor' a1 =
let {a1' = id a1} in
labelcolor''_ a1' >>= \res ->
let {res' = cToColor res} in
return (res')
{-# LINE 79 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Color)) => Op (GetLabelcolor ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> labelcolor' menu_itemPtr
setLabelcolor' :: (Ptr ()) -> (Color) -> IO ()
setLabelcolor' a1 a2 =
let {a1' = id a1} in
let {a2' = cFromColor a2} in
setLabelcolor''_ a1' a2' >>
return ()
{-# LINE 83 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (Color -> IO ())) => Op (SetLabelcolor ()) MenuItem orig impl where
runOp _ _ menu_item a = withRef menu_item $ \menu_itemPtr -> setLabelcolor' menu_itemPtr a
labelfont' :: (Ptr ()) -> IO ((Font))
labelfont' a1 =
let {a1' = id a1} in
labelfont''_ a1' >>= \res ->
let {res' = cToFont res} in
return (res')
{-# LINE 87 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Font)) => Op (GetLabelfont ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> labelfont' menu_itemPtr
setLabelfont' :: (Ptr ()) -> (Font) -> IO ()
setLabelfont' a1 a2 =
let {a1' = id a1} in
let {a2' = cFromFont a2} in
setLabelfont''_ a1' a2' >>
return ()
{-# LINE 91 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (Font -> IO ())) => Op (SetLabelfont ()) MenuItem orig impl where
runOp _ _ menu_item a = withRef menu_item $ \menu_itemPtr -> setLabelfont' menu_itemPtr a
labelsize' :: (Ptr ()) -> IO ((CInt))
labelsize' a1 =
let {a1' = id a1} in
labelsize''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 95 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (FontSize)) => Op (GetLabelsize ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> labelsize' menu_itemPtr >>= return . FontSize
setLabelsize' :: (Ptr ()) -> (CInt) -> IO ()
setLabelsize' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
setLabelsize''_ a1' a2' >>
return ()
{-# LINE 99 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (FontSize -> IO ())) => Op (SetLabelsize ()) MenuItem orig impl where
runOp _ _ menu_item (FontSize pix) = withRef menu_item $ \menu_itemPtr -> setLabelsize' menu_itemPtr pix
setCallback' :: (Ptr ()) -> (FunPtr CallbackWithUserDataPrim) -> IO ()
setCallback' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
setCallback''_ a1' a2' >>
return ()
{-# LINE 103 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ ((Ref orig -> IO ()) -> IO ()) ) => Op (SetCallback ()) MenuItem orig impl where
runOp _ _ menu_item c = withRef menu_item $ \menu_itemPtr -> do
ptr <- toCallbackPrim c
setCallback' menu_itemPtr (castFunPtr ptr)
shortcut' :: (Ptr ()) -> IO ((CInt))
shortcut' a1 =
let {a1' = id a1} in
shortcut''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 109 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Maybe ShortcutKeySequence)) => Op (GetShortcut ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> shortcut' menu_itemPtr >>= return . cIntToKeySequence
setShortcut' :: (Ptr ()) -> (CInt) -> IO ()
setShortcut' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
setShortcut''_ a1' a2' >>
return ()
{-# LINE 113 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (ShortcutKeySequence -> IO ())) => Op (SetShortcut ()) MenuItem orig impl where
runOp _ _ input (ShortcutKeySequence modifiers char) =
withRef input $ \inputPtr -> setShortcut' inputPtr (keySequenceToCInt modifiers char)
submenu' :: (Ptr ()) -> IO ((Bool))
submenu' a1 =
let {a1' = id a1} in
submenu''_ a1' >>= \res ->
let {res' = cToBool res} in
return (res')
{-# LINE 118 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Bool)) => Op (Submenu ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> submenu' menu_itemPtr
checkbox' :: (Ptr ()) -> IO ((Bool))
checkbox' a1 =
let {a1' = id a1} in
checkbox''_ a1' >>= \res ->
let {res' = cToBool res} in
return (res')
{-# LINE 122 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Bool)) => Op (Checkbox ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> checkbox' menu_itemPtr
radio' :: (Ptr ()) -> IO ((Bool))
radio' a1 =
let {a1' = id a1} in
radio''_ a1' >>= \res ->
let {res' = cToBool res} in
return (res')
{-# LINE 126 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Bool)) => Op (Radio ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> radio' menu_itemPtr
value' :: (Ptr ()) -> IO ((Int))
value' a1 =
let {a1' = id a1} in
value''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 130 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Int)) => Op (GetValue ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> value' menu_itemPtr
set' :: (Ptr ()) -> IO ()
set' a1 =
let {a1' = id a1} in
set''_ a1' >>
return ()
{-# LINE 134 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Set ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> set' menu_itemPtr
clear' :: (Ptr ()) -> IO ()
clear' a1 =
let {a1' = id a1} in
clear''_ a1' >>
return ()
{-# LINE 138 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Clear ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> clear' menu_itemPtr
setonly' :: (Ptr ()) -> IO ()
setonly' a1 =
let {a1' = id a1} in
setonly''_ a1' >>
return ()
{-# LINE 142 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Setonly ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> setonly' menu_itemPtr
visible' :: (Ptr ()) -> IO ((Bool))
visible' a1 =
let {a1' = id a1} in
visible''_ a1' >>= \res ->
let {res' = cToBool res} in
return (res')
{-# LINE 146 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Bool)) => Op (Visible ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> visible' menu_itemPtr
show' :: (Ptr ()) -> IO ()
show' a1 =
let {a1' = id a1} in
show''_ a1' >>
return ()
{-# LINE 150 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (ShowWidget ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> show' menu_itemPtr
hide' :: (Ptr ()) -> IO ()
hide' a1 =
let {a1' = id a1} in
hide''_ a1' >>
return ()
{-# LINE 154 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Hide ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> hide' menu_itemPtr
active' :: (Ptr ()) -> IO ((Bool))
active' a1 =
let {a1' = id a1} in
active''_ a1' >>= \res ->
let {res' = cToBool res} in
return (res')
{-# LINE 158 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Bool)) => Op (Active ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> active' menu_itemPtr
activate' :: (Ptr ()) -> IO ()
activate' a1 =
let {a1' = id a1} in
activate''_ a1' >>
return ()
{-# LINE 162 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Activate ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> activate' menu_itemPtr
deactivate' :: (Ptr ()) -> IO ()
deactivate' a1 =
let {a1' = id a1} in
deactivate''_ a1' >>
return ()
{-# LINE 166 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO ()) => Op (Deactivate ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> deactivate' menu_itemPtr
activevisible' :: (Ptr ()) -> IO ((Bool))
activevisible' a1 =
let {a1' = id a1} in
activevisible''_ a1' >>= \res ->
let {res' = cToBool res} in
return (res')
{-# LINE 170 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Bool)) => Op (Activevisible ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> activevisible' menu_itemPtr
measure' :: (Ptr ()) -> (Ptr ()) -> IO ((Int), (Int))
measure' a1 a3 =
let {a1' = id a1} in
alloca $ \a2' ->
let {a3' = id a3} in
measure''_ a1' a2' a3' >>= \res ->
let {res' = fromIntegral res} in
peekIntConv a2'>>= \a2'' ->
return (res', a2'')
{-# LINE 174 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuPrim, impl ~ (Ref a -> IO (Size))) => Op (Measure ()) MenuItem orig impl where
runOp _ _ menu_item menu' = withRef menu_item $ \menu_itemPtr -> withRef menu' $ \menuPtr -> measure' menu_itemPtr menuPtr >>= \(h', w') -> return (Size (Width w') (Height h'))
drawWithT' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> (Ptr ()) -> (Int) -> IO ()
drawWithT' a1 a2 a3 a4 a5 a6 a7 =
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
let {a6' = id a6} in
let {a7' = fromIntegral a7} in
drawWithT''_ a1' a2' a3' a4' a5' a6' a7' >>
return ()
{-# LINE 178 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuPrim, impl ~ (Rectangle -> Ref a -> Int -> IO ())) => Op (DrawWithT ()) MenuItem orig impl where
runOp _ _ menu_item rectangle menu' t =
let (x_pos', y_pos', width', height') = fromRectangle rectangle in
withRef menu_item $ \menu_itemPtr -> withRef menu' $ \menuPtr -> drawWithT' menu_itemPtr x_pos' y_pos' width' height' menuPtr t
draw' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> (Ptr ()) -> IO ()
draw' a1 a2 a3 a4 a5 a6 =
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
let {a6' = id a6} in
draw''_ a1' a2' a3' a4' a5' a6' >>
return ()
{-# LINE 184 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuPrim, impl ~ (Rectangle -> Ref a -> IO ())) => Op (Draw ()) MenuItem orig impl where
runOp _ _ menu_item rectangle menu' =
let (x_pos', y_pos', width', height') = fromRectangle rectangle in
withRef menu_item $ \menu_itemPtr ->
withRef menu' $ \menuPtr -> draw' menu_itemPtr x_pos' y_pos' width' height' menuPtr
flags' :: (Ptr ()) -> IO ((Int))
flags' a1 =
let {a1' = id a1} in
flags''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 191 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ IO (Maybe MenuItemFlags)) => Op (GetFlags ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> flags' menu_itemPtr >>= return . intToMenuItemFlags
setFlags' :: (Ptr ()) -> (Int) -> IO ()
setFlags' a1 a2 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
setFlags''_ a1' a2' >>
return ()
{-# LINE 195 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (MenuItemFlags -> IO ())) => Op (SetFlags ()) MenuItem orig impl where
runOp _ _ menu_item flags = withRef menu_item $ \menu_itemPtr -> setFlags' menu_itemPtr (menuItemFlagsToInt flags)
text' :: (Ptr ()) -> IO ((String))
text' a1 =
let {a1' = id a1} in
text''_ a1' >>= \res ->
let {res' = unsafeFromCString res} in
return (res')
{-# LINE 199 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ ( IO (String))) => Op (GetText ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> text' menu_itemPtr
pulldownWithArgs' :: (Ptr ()) -> (Int) -> (Int) -> (Int) -> (Int) -> (Ptr ()) -> (Ptr ()) -> (Ptr ()) -> (Bool) -> IO ((Ptr ()))
pulldownWithArgs' a1 a2 a3 a4 a5 a6 a7 a8 a9 =
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
let {a6' = id a6} in
let {a7' = id a7} in
let {a8' = id a8} in
let {a9' = fromBool a9} in
pulldownWithArgs''_ a1' a2' a3' a4' a5' a6' a7' a8' a9' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 203 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuPrim, Parent b MenuItem, Parent c MenuItem, impl ~ (Rectangle -> Maybe (Ref a) -> Maybe (Ref b) -> Maybe (Ref c) -> Maybe Bool -> IO (Maybe (Ref MenuItem)))) => Op (Pulldown ()) MenuItem orig impl where
runOp _ _ menu_item rectangle picked' template_menu title menu_barFlag =
let (x_pos, y_pos, width, height) = fromRectangle rectangle
menu_bar = maybe False id menu_barFlag
in
withRef menu_item $ \menu_itemPtr ->
withMaybeRef picked' $ \pickedPtr ->
withMaybeRef template_menu $ \template_menuPtr ->
withMaybeRef title $ \titlePtr ->
pulldownWithArgs' menu_itemPtr x_pos y_pos width height pickedPtr template_menuPtr titlePtr menu_bar >>= toMaybeRef
popupWithArgs' :: (Ptr ()) -> (Int) -> (Int) -> (Ptr CChar) -> (Ptr ()) -> (Ptr ()) -> IO ((Ptr ()))
popupWithArgs' a1 a2 a3 a4 a5 a6 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
let {a3' = fromIntegral a3} in
let {a4' = id a4} in
let {a5' = id a5} in
let {a6' = id a6} in
popupWithArgs''_ a1' a2' a3' a4' a5' a6' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 215 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuItem, Parent b MenuPrim, Parent c MenuItem, impl ~ (Position -> Maybe String -> Maybe (Ref a) -> Maybe (Ref b) -> IO (Maybe (Ref c)))) => Op (Popup ()) MenuItem orig impl where
runOp _ _ menu_item (Position (X x_pos) (Y y_pos)) title picked' template_menu =
withRef menu_item $ \menu_itemPtr ->
withMaybeRef picked' $ \pickedPtr ->
withMaybeRef template_menu $ \template_menuPtr ->
maybeNew newCString title >>= \titlePtr ->
popupWithArgs' menu_itemPtr x_pos y_pos titlePtr pickedPtr template_menuPtr >>= toMaybeRef
testShortcut' :: (Ptr ()) -> IO ((Ptr ()))
testShortcut' a1 =
let {a1' = id a1} in
testShortcut''_ a1' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 224 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuItem, impl ~ ( IO (Maybe (Ref a)))) => Op (TestShortcut ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> testShortcut' menu_itemPtr >>= toMaybeRef
findShortcutWithIpRequireAlt' :: (Ptr ()) -> (Ptr CInt) -> (Bool) -> IO ((Ptr ()))
findShortcutWithIpRequireAlt' a1 a2 a3 =
let {a1' = id a1} in
let {a2' = id a2} in
let {a3' = C2HSImp.fromBool a3} in
findShortcutWithIpRequireAlt''_ a1' a2' a3' >>= \res ->
let {res' = id res} in
return (res')
{-# LINE 228 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuItem, impl ~ (Maybe Int -> Bool -> IO (Maybe (Ref a)))) => Op (FindShortcut ()) MenuItem orig impl where
runOp _ _ menu_item index' require_alt =
withRef menu_item $ \menu_itemPtr ->
maybeNew (new . fromIntegral) index' >>= \index_Ptr ->
findShortcutWithIpRequireAlt' menu_itemPtr index_Ptr require_alt >>= toMaybeRef
doCallback' :: (Ptr ()) -> (Ptr ()) -> IO ()
doCallback' a1 a2 =
let {a1' = id a1} in
let {a2' = id a2} in
doCallback''_ a1' a2' >>
return ()
{-# LINE 235 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ (Ref Widget -> IO ())) => Op (DoCallback ()) MenuItem orig impl where
runOp _ _ menu_item o = withRef menu_item $ \menu_itemPtr -> withRef o $ \oPtr -> doCallback' menu_itemPtr oPtr
addMenuItem ::
(Parent menuItem MenuItem) =>
Either (Ref MenuPrim) (Ref MenuItem) ->
String ->
Maybe Shortcut ->
Maybe (Ref menuItem -> IO ()) ->
MenuItemFlags ->
(Ptr () -> String -> CInt -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
(Ptr () -> String -> String -> FunPtr CallbackWithUserDataPrim -> Int -> IO Int) ->
IO (MenuItemIndex)
addMenuItem refMenuOrMenuItem name shortcut cb flags addWithFlags addWithShortcutnameFlags =
either
(\menu -> withRef menu (go "Menu_.add: Shortcut format string cannot be empty" ))
(\menuItem -> withRef menuItem (go "MenuItem.add: Shortcut format string cannot be empty"))
refMenuOrMenuItem
where
go :: String -> Ptr () -> IO MenuItemIndex
go errorMsg menu_Ptr = do
let combinedFlags = menuItemFlagsToInt flags
ptr <- maybe (return (castPtrToFunPtr nullPtr)) toCallbackPrim cb
idx' <- case shortcut of
Just s' -> case s' of
KeySequence (ShortcutKeySequence modifiers char) ->
addWithFlags
menu_Ptr
name
(keySequenceToCInt modifiers char)
(castFunPtr ptr)
combinedFlags
KeyFormat format' ->
if (not $ null format') then
addWithShortcutnameFlags
menu_Ptr
name
format'
(castFunPtr ptr)
combinedFlags
else error errorMsg
Nothing ->
addWithFlags
menu_Ptr
name
0
(castFunPtr ptr)
combinedFlags
return (MenuItemIndex idx')
insertWithFlags' :: (Ptr ()) -> (Int) -> (String) -> (CInt) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
insertWithFlags' a1 a2 a3 a4 a5 a6 =
let {a1' = id a1} in
let {a2' = fromIntegral a2} in
let {a3' = unsafeToCString a3} in
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 286 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
addWithFlags' :: (Ptr ()) -> (String) -> (CInt) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
addWithFlags' a1 a2 a3 a4 a5 =
let {a1' = id a1} in
let {a2' = unsafeToCString a2} in
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 287 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
addWithShortcutnameFlags' :: (Ptr ()) -> (String) -> (String) -> (FunPtr CallbackWithUserDataPrim) -> (Int) -> IO ((Int))
addWithShortcutnameFlags' a1 a2 a3 a4 a5 =
let {a1' = id a1} in
let {a2' = unsafeToCString a2} in
let {a3' = unsafeToCString a3} in
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 288 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (Parent a MenuItem, impl ~ (String -> Maybe Shortcut -> Maybe (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Add ()) MenuItem orig impl where
runOp _ _ menu_item name shortcut cb flags =
addMenuItem (Right menu_item) name shortcut cb flags addWithFlags' addWithShortcutnameFlags'
instance (Parent a MenuItem, impl ~ (Int -> String -> Maybe ShortcutKeySequence -> (Ref a -> IO ()) -> MenuItemFlags -> IO (MenuItemIndex))) => Op (Insert ()) MenuItem orig impl where
runOp _ _ menu_item index' name ks cb flags =
withRef menu_item $ \menu_itemPtr ->
let combinedFlags = menuItemFlagsToInt flags
shortcutCode = maybe 0 (\(ShortcutKeySequence modifiers char) -> keySequenceToCInt modifiers char ) ks
in do
ptr <- toCallbackPrim cb
idx' <- insertWithFlags'
menu_itemPtr
index'
name
shortcutCode
(castFunPtr ptr)
combinedFlags
return (MenuItemIndex idx')
size' :: (Ptr ()) -> IO ((Int))
size' a1 =
let {a1' = id a1} in
size''_ a1' >>= \res ->
let {res' = fromIntegral res} in
return (res')
{-# LINE 309 "src/Graphics/UI/FLTK/LowLevel/MenuItem.chs" #-}
instance (impl ~ ( IO (Int))) => Op (GetSize ()) MenuItem orig impl where
runOp _ _ menu_item = withRef menu_item $ \menu_itemPtr -> size' menu_itemPtr
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_New"
new''_ :: (IO (C2HSImp.Ptr ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_Destroy"
destroy''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_next_with_step"
nextWithStep''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ()))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_next"
next''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_first"
first''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_label"
label''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_label"
setLabel''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_label_with_labeltype"
setLabelWithLabeltype''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> (IO ()))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_labeltype"
labeltype''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_labeltype"
setLabeltype''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_labelcolor"
labelcolor''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CUInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_labelcolor"
setLabelcolor''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CUInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_labelfont"
labelfont''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_labelfont"
setLabelfont''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_labelsize"
labelsize''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_labelsize"
setLabelsize''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_callback"
setCallback''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.FunPtr ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))) -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_shortcut"
shortcut''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_shortcut"
setShortcut''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_submenu"
submenu''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_checkbox"
checkbox''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_radio"
radio''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_value"
value''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set"
set''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_clear"
clear''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_setonly"
setonly''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_visible"
visible''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_show"
show''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_hide"
hide''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_active"
active''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_activate"
activate''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_deactivate"
deactivate''_ :: ((C2HSImp.Ptr ()) -> (IO ()))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_activevisible"
activevisible''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_measure"
measure''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_draw_with_t"
drawWithT''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ()))))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_draw"
draw''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> (IO ())))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_flags"
flags''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_set_flags"
setFlags''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_text"
text''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr C2HSImp.CChar)))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_pulldown_with_args"
pulldownWithArgs''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_popup_with_args"
popupWithArgs''_ :: ((C2HSImp.Ptr ()) -> (C2HSImp.CInt -> (C2HSImp.CInt -> ((C2HSImp.Ptr C2HSImp.CChar) -> ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ()))))))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_test_shortcut"
testShortcut''_ :: ((C2HSImp.Ptr ()) -> (IO (C2HSImp.Ptr ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_find_shortcut_with_ip_require_alt"
findShortcutWithIpRequireAlt''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr C2HSImp.CInt) -> (C2HSImp.CInt -> (IO (C2HSImp.Ptr ())))))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_do_callback"
doCallback''_ :: ((C2HSImp.Ptr ()) -> ((C2HSImp.Ptr ()) -> (IO ())))
foreign import ccall safe "Graphics/UI/FLTK/LowLevel/MenuItem.chs.h Fl_Menu_Item_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/MenuItem.chs.h Fl_Menu_Item_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/MenuItem.chs.h Fl_Menu_Item_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/MenuItem.chs.h Fl_Menu_Item_size"
size''_ :: ((C2HSImp.Ptr ()) -> (IO C2HSImp.CInt))