module Graphics.UI.Gtk.MenuComboToolbar.MenuItem (
MenuItem,
MenuItemClass,
castToMenuItem, gTypeMenuItem,
toMenuItem,
menuItemNew,
menuItemNewWithLabel,
menuItemNewWithMnemonic,
menuItemSetLabel,
menuItemGetLabel,
menuItemSetUseUnderline,
menuItemGetUseUnderline,
menuItemSetSubmenu,
menuItemGetSubmenu,
menuItemRemoveSubmenu,
menuItemEmitSelect,
menuItemEmitDeselect,
menuItemEmitActivate,
menuItemSetRightJustified,
menuItemGetRightJustified,
menuItemSetAccelPath,
menuItemSubmenu,
menuItemRightJustified,
menuItemLabel,
menuItemUseUnderline,
menuItemActivatedItem,
menuItemActivated,
menuItemActivateItem,
menuItemActivate,
menuItemSelect,
menuItemDeselect,
menuItemToggle,
onActivateItem,
afterActivateItem,
onActivateLeaf,
afterActivateLeaf,
onSelect,
afterSelect,
onDeselect,
afterDeselect,
onToggle,
afterToggle
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Signals
menuItemNew :: IO MenuItem
menuItemNew =
makeNewObject mkMenuItem $
liftM (castPtr :: Ptr Widget -> Ptr MenuItem) $
gtk_menu_item_new
menuItemNewWithLabel :: GlibString string
=> string
-> IO MenuItem
menuItemNewWithLabel label =
makeNewObject mkMenuItem $
liftM (castPtr :: Ptr Widget -> Ptr MenuItem) $
withUTFString label $ \labelPtr ->
gtk_menu_item_new_with_label
labelPtr
menuItemNewWithMnemonic :: GlibString string
=> string
-> IO MenuItem
menuItemNewWithMnemonic label =
makeNewObject mkMenuItem $
liftM (castPtr :: Ptr Widget -> Ptr MenuItem) $
withUTFString label $ \labelPtr ->
gtk_menu_item_new_with_mnemonic
labelPtr
menuItemSetLabel :: (MenuItemClass self, GlibString string) => self -> string -> IO ()
menuItemSetLabel self label =
withUTFString label $ (\(MenuItem arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_set_label argPtr1 arg2) (toMenuItem self)
menuItemGetLabel :: (MenuItemClass self, GlibString string) => self -> IO string
menuItemGetLabel self =
(\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_get_label argPtr1)
(toMenuItem self)
>>= \strPtr -> if strPtr == nullPtr
then return ""
else peekUTFString strPtr
menuItemSetUseUnderline :: (MenuItemClass self) => self -> Bool -> IO ()
menuItemSetUseUnderline self =
(\(MenuItem arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_set_use_underline argPtr1 arg2) (toMenuItem self) . fromBool
menuItemGetUseUnderline :: (MenuItemClass self) => self -> IO Bool
menuItemGetUseUnderline self =
liftM toBool $ (\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_get_use_underline argPtr1)
(toMenuItem self)
menuItemSetSubmenu :: (MenuItemClass self, MenuClass submenu) => self -> submenu -> IO ()
menuItemSetSubmenu self submenu =
(\(MenuItem arg1) (Widget arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_item_set_submenu argPtr1 argPtr2)
(toMenuItem self)
(toWidget submenu)
menuItemGetSubmenu :: MenuItemClass self => self
-> IO (Maybe Widget)
menuItemGetSubmenu self =
maybeNull (makeNewObject mkWidget) $
(\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_get_submenu argPtr1)
(toMenuItem self)
menuItemRemoveSubmenu :: MenuItemClass self => self -> IO ()
menuItemRemoveSubmenu self =
(\(MenuItem arg1) (Widget arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_item_set_submenu argPtr1 argPtr2)
(toMenuItem self)
(Widget $ unsafePerformIO $ newForeignPtr_ nullPtr)
menuItemEmitSelect :: MenuItemClass self => self -> IO ()
menuItemEmitSelect self =
(\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_select argPtr1)
(toMenuItem self)
menuItemEmitDeselect :: MenuItemClass self => self -> IO ()
menuItemEmitDeselect self =
(\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_deselect argPtr1)
(toMenuItem self)
menuItemEmitActivate :: MenuItemClass self => self -> IO ()
menuItemEmitActivate self =
(\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_activate argPtr1)
(toMenuItem self)
menuItemSetRightJustified :: MenuItemClass self => self
-> Bool
-> IO ()
menuItemSetRightJustified self rightJustified =
(\(MenuItem arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_set_right_justified argPtr1 arg2)
(toMenuItem self)
(fromBool rightJustified)
menuItemGetRightJustified :: MenuItemClass self => self -> IO Bool
menuItemGetRightJustified self =
liftM toBool $
(\(MenuItem arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_get_right_justified argPtr1)
(toMenuItem self)
menuItemSetAccelPath :: (MenuItemClass self, GlibString string) => self
-> Maybe string
-> IO ()
menuItemSetAccelPath self accelPath =
maybeWith withUTFString accelPath $ \accelPathPtr ->
(\(MenuItem arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_set_accel_path argPtr1 arg2)
(toMenuItem self)
accelPathPtr
menuItemSubmenu :: (MenuItemClass self, MenuClass submenu) => ReadWriteAttr self (Maybe Widget) submenu
menuItemSubmenu = newAttr
menuItemGetSubmenu
menuItemSetSubmenu
menuItemRightJustified :: MenuItemClass self => Attr self Bool
menuItemRightJustified = newAttr
menuItemGetRightJustified
menuItemSetRightJustified
menuItemLabel :: (MenuItemClass self, GlibString string) => Attr self string
menuItemLabel = newAttr
menuItemGetLabel
menuItemSetLabel
menuItemUseUnderline :: MenuItemClass self => Attr self Bool
menuItemUseUnderline = newAttr
menuItemGetUseUnderline
menuItemSetUseUnderline
menuItemActivated :: MenuItemClass self => Signal self (IO ())
menuItemActivated = Signal (connect_NONE__NONE "activate")
menuItemActivate :: MenuItemClass self => Signal self (IO ())
menuItemActivate = menuItemActivated
menuItemActivatedItem :: MenuItemClass self => Signal self (IO ())
menuItemActivatedItem = Signal (connect_NONE__NONE "activate-item")
menuItemActivateItem :: MenuItemClass self => Signal self (IO ())
menuItemActivateItem = menuItemActivatedItem
menuItemSelect :: MenuItemClass i => Signal i (IO ())
menuItemSelect = Signal (connect_NONE__NONE "select")
menuItemDeselect :: MenuItemClass i => Signal i (IO ())
menuItemDeselect = Signal (connect_NONE__NONE "deselect")
menuItemToggle :: MenuItemClass i => Signal i (IO ())
menuItemToggle = Signal (connect_NONE__NONE "toggle")
onActivateLeaf, afterActivateLeaf :: MenuItemClass self => self
-> IO ()
-> IO (ConnectId self)
onActivateLeaf = connect_NONE__NONE "activate" False
afterActivateLeaf = connect_NONE__NONE "activate" True
onActivateItem, afterActivateItem :: MenuItemClass self => self
-> IO ()
-> IO (ConnectId self)
onActivateItem = connect_NONE__NONE "activate-item" False
afterActivateItem = connect_NONE__NONE "activate-item" True
onSelect, afterSelect :: ItemClass i => i
-> IO ()
-> IO (ConnectId i)
onSelect = connect_NONE__NONE "select" False
afterSelect = connect_NONE__NONE "select" True
onDeselect, afterDeselect :: ItemClass i => i
-> IO ()
-> IO (ConnectId i)
onDeselect = connect_NONE__NONE "deselect" False
afterDeselect = connect_NONE__NONE "deselect" True
onToggle, afterToggle :: ItemClass i => i
-> IO ()
-> IO (ConnectId i)
onToggle = connect_NONE__NONE "toggle" False
afterToggle = connect_NONE__NONE "toggle" True
foreign import ccall unsafe "gtk_menu_item_new"
gtk_menu_item_new :: (IO (Ptr Widget))
foreign import ccall unsafe "gtk_menu_item_new_with_label"
gtk_menu_item_new_with_label :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall unsafe "gtk_menu_item_new_with_mnemonic"
gtk_menu_item_new_with_mnemonic :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_menu_item_set_label"
gtk_menu_item_set_label :: ((Ptr MenuItem) -> ((Ptr CChar) -> (IO ())))
foreign import ccall safe "gtk_menu_item_get_label"
gtk_menu_item_get_label :: ((Ptr MenuItem) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_menu_item_set_use_underline"
gtk_menu_item_set_use_underline :: ((Ptr MenuItem) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_menu_item_get_use_underline"
gtk_menu_item_get_use_underline :: ((Ptr MenuItem) -> (IO CInt))
foreign import ccall safe "gtk_menu_item_set_submenu"
gtk_menu_item_set_submenu :: ((Ptr MenuItem) -> ((Ptr Widget) -> (IO ())))
foreign import ccall unsafe "gtk_menu_item_get_submenu"
gtk_menu_item_get_submenu :: ((Ptr MenuItem) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_menu_item_select"
gtk_menu_item_select :: ((Ptr MenuItem) -> (IO ()))
foreign import ccall safe "gtk_menu_item_deselect"
gtk_menu_item_deselect :: ((Ptr MenuItem) -> (IO ()))
foreign import ccall safe "gtk_menu_item_activate"
gtk_menu_item_activate :: ((Ptr MenuItem) -> (IO ()))
foreign import ccall safe "gtk_menu_item_set_right_justified"
gtk_menu_item_set_right_justified :: ((Ptr MenuItem) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_menu_item_get_right_justified"
gtk_menu_item_get_right_justified :: ((Ptr MenuItem) -> (IO CInt))
foreign import ccall safe "gtk_menu_item_set_accel_path"
gtk_menu_item_set_accel_path :: ((Ptr MenuItem) -> ((Ptr CChar) -> (IO ())))