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,
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 ::
String
-> IO MenuItem
menuItemNewWithLabel label =
makeNewObject mkMenuItem $
liftM (castPtr :: Ptr Widget -> Ptr MenuItem) $
withUTFString label $ \labelPtr ->
gtk_menu_item_new_with_label
labelPtr
menuItemNewWithMnemonic ::
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) => 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) => 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) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_item_remove_submenu argPtr1)
(toMenuItem self)
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 => 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 => Attr self String
menuItemLabel = newAttr
menuItemGetLabel
menuItemSetLabel
menuItemUseUnderline :: MenuItemClass self => Attr self Bool
menuItemUseUnderline = newAttr
menuItemGetUseUnderline
menuItemSetUseUnderline
menuItemActivate :: MenuItemClass self => Signal self (IO ())
menuItemActivate = Signal (connect_NONE__NONE "activate")
menuItemActivateItem :: MenuItemClass self => Signal self (IO ())
menuItemActivateItem = Signal (connect_NONE__NONE "activate-item")
menuItemSelect :: ItemClass i => Signal i (IO ())
menuItemSelect = Signal (connect_NONE__NONE "select")
menuItemDeselect :: ItemClass i => Signal i (IO ())
menuItemDeselect = Signal (connect_NONE__NONE "deselect")
menuItemToggle :: ItemClass 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_remove_submenu"
gtk_menu_item_remove_submenu :: ((Ptr MenuItem) -> (IO ()))
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 ())))