module Graphics.UI.Gtk.MenuComboToolbar.Menu (
Menu,
MenuClass,
castToMenu, gTypeMenu,
toMenu,
menuNew,
menuReorderChild,
menuPopup,
menuSetAccelGroup,
menuGetAccelGroup,
menuSetAccelPath,
menuSetTitle,
menuGetTitle,
menuPopdown,
menuReposition,
menuGetActive,
menuSetActive,
menuSetTearoffState,
menuGetTearoffState,
menuAttachToWidget,
menuDetach,
menuGetAttachWidget,
menuSetScreen,
menuSetMonitor,
menuAttach,
menuGetForAttachWidget,
menuTearoffState,
menuAccelGroup,
menuActive,
menuTitle,
menuChildLeftAttach,
menuChildRightAttach,
menuChildTopAttach,
menuChildBottomAttach,
) where
import Control.Monad (liftM)
import Data.Maybe (fromMaybe)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.GList
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
import Graphics.UI.Gtk.Abstract.ContainerChildProperties
import Graphics.UI.Gtk.Gdk.Events (MouseButton, TimeStamp)
menuNew :: IO Menu
menuNew =
makeNewObject mkMenu $
liftM (castPtr :: Ptr Widget -> Ptr Menu) $
gtk_menu_new
menuReorderChild :: (MenuClass self, MenuItemClass child) => self
-> child
-> Int
-> IO ()
menuReorderChild self child position =
(\(Menu arg1) (Widget arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_reorder_child argPtr1 argPtr2 arg3)
(toMenu self)
(toWidget child)
(fromIntegral position)
menuPopup :: MenuClass self => self
-> Maybe (MouseButton, TimeStamp)
-> IO ()
menuPopup self (Just (b,t)) =
(\(Menu arg1) (Widget arg2) (Widget arg3) arg4 arg5 arg6 arg7 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->withForeignPtr arg3 $ \argPtr3 ->gtk_menu_popup argPtr1 argPtr2 argPtr3 arg4 arg5 arg6 arg7)
(toMenu self)
(Widget nullForeignPtr)
(Widget nullForeignPtr)
nullFunPtr
nullPtr
((fromIntegral . fromEnum) b)
(fromIntegral t)
menuPopup self Nothing = do
t <- gtk_get_current_event_time
(\(Menu arg1) (Widget arg2) (Widget arg3) arg4 arg5 arg6 arg7 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->withForeignPtr arg3 $ \argPtr3 ->gtk_menu_popup argPtr1 argPtr2 argPtr3 arg4 arg5 arg6 arg7)
(toMenu self)
(Widget nullForeignPtr)
(Widget nullForeignPtr)
nullFunPtr nullPtr 0 t
menuSetAccelGroup :: MenuClass self => self
-> AccelGroup
-> IO ()
menuSetAccelGroup self accelGroup =
(\(Menu arg1) (AccelGroup arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_set_accel_group argPtr1 argPtr2)
(toMenu self)
accelGroup
menuGetAccelGroup :: MenuClass self => self
-> IO AccelGroup
menuGetAccelGroup self =
makeNewGObject mkAccelGroup $
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_get_accel_group argPtr1)
(toMenu self)
menuSetAccelPath :: (MenuClass self, GlibString string) => self
-> string
-> IO ()
menuSetAccelPath self accelPath =
withUTFString accelPath $ \accelPathPtr ->
(\(Menu arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_set_accel_path argPtr1 arg2)
(toMenu self)
accelPathPtr
menuSetTitle :: (MenuClass self, GlibString string) => self -> string -> IO ()
menuSetTitle self title =
withUTFString title $ \titlePtr ->
(\(Menu arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_set_title argPtr1 arg2)
(toMenu self)
titlePtr
menuGetTitle :: (MenuClass self, GlibString string) => self
-> IO (Maybe string)
menuGetTitle self =
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_get_title argPtr1)
(toMenu self)
>>= maybePeek peekUTFString
menuPopdown :: MenuClass self => self -> IO ()
menuPopdown self =
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_popdown argPtr1)
(toMenu self)
menuReposition :: MenuClass self => self -> IO ()
menuReposition self =
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_reposition argPtr1)
(toMenu self)
menuGetActive :: MenuClass self => self
-> IO MenuItem
menuGetActive self =
makeNewObject mkMenuItem $
throwIfNull "menuGetActive: menu contains no menu items." $
liftM castPtr $
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_get_active argPtr1)
(toMenu self)
menuSetActive :: MenuClass self => self
-> Int
-> IO ()
menuSetActive self index =
(\(Menu arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_set_active argPtr1 arg2)
(toMenu self)
(fromIntegral index)
menuSetTearoffState :: MenuClass self => self
-> Bool
-> IO ()
menuSetTearoffState self tornOff =
(\(Menu arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_set_tearoff_state argPtr1 arg2)
(toMenu self)
(fromBool tornOff)
menuGetTearoffState :: MenuClass self => self
-> IO Bool
menuGetTearoffState self =
liftM toBool $
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_get_tearoff_state argPtr1)
(toMenu self)
menuAttachToWidget :: (MenuClass self, WidgetClass attachWidget) => self -> attachWidget -> IO ()
menuAttachToWidget self attachWidget =
(\(Menu arg1) (Widget arg2) arg3 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_attach_to_widget argPtr1 argPtr2 arg3)
(toMenu self)
(toWidget attachWidget)
nullFunPtr
menuDetach :: MenuClass self => self -> IO ()
menuDetach self =
(\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_detach argPtr1)
(toMenu self)
menuGetAttachWidget :: MenuClass self => self -> IO (Maybe Widget)
menuGetAttachWidget self = do
wPtr <- (\(Menu arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_get_attach_widget argPtr1) (toMenu self)
if wPtr==nullPtr then return Nothing else liftM Just $
makeNewObject mkWidget (return wPtr)
menuSetScreen :: MenuClass self => self
-> Maybe Screen
-> IO ()
menuSetScreen self screen =
(\(Menu arg1) (Screen arg2) -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_set_screen argPtr1 argPtr2)
(toMenu self)
(fromMaybe (Screen nullForeignPtr) screen)
menuSetMonitor :: MenuClass self => self
-> Int
-> IO ()
menuSetMonitor self monitorNum =
(\(Menu arg1) arg2 -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_set_monitor argPtr1 arg2)
(toMenu self)
(fromIntegral monitorNum)
menuAttach :: (MenuClass self, MenuItemClass child) => self
-> child
-> Int
-> Int
-> Int
-> Int
-> IO ()
menuAttach self child leftAttach rightAttach topAttach bottomAttach =
(\(Menu arg1) (Widget arg2) arg3 arg4 arg5 arg6 -> withForeignPtr arg1 $ \argPtr1 ->withForeignPtr arg2 $ \argPtr2 ->gtk_menu_attach argPtr1 argPtr2 arg3 arg4 arg5 arg6)
(toMenu self)
(toWidget child)
(fromIntegral leftAttach)
(fromIntegral rightAttach)
(fromIntegral topAttach)
(fromIntegral bottomAttach)
menuGetForAttachWidget :: WidgetClass widget =>
widget
-> IO [Menu]
menuGetForAttachWidget widget =
(\(Widget arg1) -> withForeignPtr arg1 $ \argPtr1 ->gtk_menu_get_for_attach_widget argPtr1)
(toWidget widget)
>>= fromGList
>>= mapM (\elemPtr -> makeNewObject mkMenu (return elemPtr))
menuTitle :: (MenuClass self, GlibString string) => Attr self string
menuTitle = newAttrFromStringProperty "tearoff-title"
menuTearoffState :: MenuClass self => Attr self Bool
menuTearoffState = newAttr
menuGetTearoffState
menuSetTearoffState
menuAccelGroup :: MenuClass self => Attr self AccelGroup
menuAccelGroup = newAttr
menuGetAccelGroup
menuSetAccelGroup
menuActive :: MenuClass self => ReadWriteAttr self MenuItem Int
menuActive = newAttr
menuGetActive
menuSetActive
menuChildLeftAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
menuChildLeftAttach = newAttrFromContainerChildIntProperty "left-attach"
menuChildRightAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
menuChildRightAttach = newAttrFromContainerChildIntProperty "right-attach"
menuChildTopAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
menuChildTopAttach = newAttrFromContainerChildIntProperty "top-attach"
menuChildBottomAttach :: (MenuClass self, WidgetClass child) => child -> Attr self Int
menuChildBottomAttach = newAttrFromContainerChildIntProperty "bottom-attach"
foreign import ccall unsafe "gtk_menu_new"
gtk_menu_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_menu_reorder_child"
gtk_menu_reorder_child :: ((Ptr Menu) -> ((Ptr Widget) -> (CInt -> (IO ()))))
foreign import ccall safe "gtk_menu_popup"
gtk_menu_popup :: ((Ptr Menu) -> ((Ptr Widget) -> ((Ptr Widget) -> ((FunPtr ((Ptr Menu) -> ((Ptr CInt) -> ((Ptr CInt) -> ((Ptr CInt) -> ((Ptr ()) -> (IO ()))))))) -> ((Ptr ()) -> (CUInt -> (CUInt -> (IO ()))))))))
foreign import ccall unsafe "gtk_get_current_event_time"
gtk_get_current_event_time :: (IO CUInt)
foreign import ccall safe "gtk_menu_set_accel_group"
gtk_menu_set_accel_group :: ((Ptr Menu) -> ((Ptr AccelGroup) -> (IO ())))
foreign import ccall unsafe "gtk_menu_get_accel_group"
gtk_menu_get_accel_group :: ((Ptr Menu) -> (IO (Ptr AccelGroup)))
foreign import ccall safe "gtk_menu_set_accel_path"
gtk_menu_set_accel_path :: ((Ptr Menu) -> ((Ptr CChar) -> (IO ())))
foreign import ccall unsafe "gtk_menu_set_title"
gtk_menu_set_title :: ((Ptr Menu) -> ((Ptr CChar) -> (IO ())))
foreign import ccall unsafe "gtk_menu_get_title"
gtk_menu_get_title :: ((Ptr Menu) -> (IO (Ptr CChar)))
foreign import ccall safe "gtk_menu_popdown"
gtk_menu_popdown :: ((Ptr Menu) -> (IO ()))
foreign import ccall safe "gtk_menu_reposition"
gtk_menu_reposition :: ((Ptr Menu) -> (IO ()))
foreign import ccall safe "gtk_menu_get_active"
gtk_menu_get_active :: ((Ptr Menu) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_menu_set_active"
gtk_menu_set_active :: ((Ptr Menu) -> (CUInt -> (IO ())))
foreign import ccall safe "gtk_menu_set_tearoff_state"
gtk_menu_set_tearoff_state :: ((Ptr Menu) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_menu_get_tearoff_state"
gtk_menu_get_tearoff_state :: ((Ptr Menu) -> (IO CInt))
foreign import ccall safe "gtk_menu_attach_to_widget"
gtk_menu_attach_to_widget :: ((Ptr Menu) -> ((Ptr Widget) -> ((FunPtr ((Ptr Widget) -> ((Ptr Menu) -> (IO ())))) -> (IO ()))))
foreign import ccall safe "gtk_menu_detach"
gtk_menu_detach :: ((Ptr Menu) -> (IO ()))
foreign import ccall unsafe "gtk_menu_get_attach_widget"
gtk_menu_get_attach_widget :: ((Ptr Menu) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_menu_set_screen"
gtk_menu_set_screen :: ((Ptr Menu) -> ((Ptr Screen) -> (IO ())))
foreign import ccall safe "gtk_menu_set_monitor"
gtk_menu_set_monitor :: ((Ptr Menu) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_menu_attach"
gtk_menu_attach :: ((Ptr Menu) -> ((Ptr Widget) -> (CUInt -> (CUInt -> (CUInt -> (CUInt -> (IO ())))))))
foreign import ccall safe "gtk_menu_get_for_attach_widget"
gtk_menu_get_for_attach_widget :: ((Ptr Widget) -> (IO (Ptr ())))