{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Gtk.Objects.RadioMenuItem
    ( 

-- * Exported types
    RadioMenuItem(..)                       ,
    RadioMenuItemK                          ,
    toRadioMenuItem                         ,
    noRadioMenuItem                         ,


 -- * Methods
-- ** radioMenuItemGetGroup
    radioMenuItemGetGroup                   ,


-- ** radioMenuItemNew
    radioMenuItemNew                        ,


-- ** radioMenuItemNewFromWidget
    radioMenuItemNewFromWidget              ,


-- ** radioMenuItemNewWithLabel
    radioMenuItemNewWithLabel               ,


-- ** radioMenuItemNewWithLabelFromWidget
    radioMenuItemNewWithLabelFromWidget     ,


-- ** radioMenuItemNewWithMnemonic
    radioMenuItemNewWithMnemonic            ,


-- ** radioMenuItemNewWithMnemonicFromWidget
    radioMenuItemNewWithMnemonicFromWidget  ,


-- ** radioMenuItemSetGroup
    radioMenuItemSetGroup                   ,




 -- * Properties
-- ** Group
    RadioMenuItemGroupPropertyInfo          ,
    constructRadioMenuItemGroup             ,
    setRadioMenuItemGroup                   ,




 -- * Signals
-- ** GroupChanged
    RadioMenuItemGroupChangedCallback       ,
    RadioMenuItemGroupChangedCallbackC      ,
    RadioMenuItemGroupChangedSignalInfo     ,
    afterRadioMenuItemGroupChanged          ,
    mkRadioMenuItemGroupChangedCallback     ,
    noRadioMenuItemGroupChangedCallback     ,
    onRadioMenuItemGroupChanged             ,
    radioMenuItemGroupChangedCallbackWrapper,
    radioMenuItemGroupChangedClosure        ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Gtk.Types
import GI.Gtk.Callbacks
import qualified GI.Atk as Atk
import qualified GI.GObject as GObject

newtype RadioMenuItem = RadioMenuItem (ForeignPtr RadioMenuItem)
foreign import ccall "gtk_radio_menu_item_get_type"
    c_gtk_radio_menu_item_get_type :: IO GType

type instance ParentTypes RadioMenuItem = RadioMenuItemParentTypes
type RadioMenuItemParentTypes = '[CheckMenuItem, MenuItem, Bin, Container, Widget, GObject.Object, Atk.ImplementorIface, Actionable, Activatable, Buildable]

instance GObject RadioMenuItem where
    gobjectIsInitiallyUnowned _ = True
    gobjectType _ = c_gtk_radio_menu_item_get_type
    

class GObject o => RadioMenuItemK o
instance (GObject o, IsDescendantOf RadioMenuItem o) => RadioMenuItemK o

toRadioMenuItem :: RadioMenuItemK o => o -> IO RadioMenuItem
toRadioMenuItem = unsafeCastTo RadioMenuItem

noRadioMenuItem :: Maybe RadioMenuItem
noRadioMenuItem = Nothing

-- signal RadioMenuItem::group-changed
type RadioMenuItemGroupChangedCallback =
    IO ()

noRadioMenuItemGroupChangedCallback :: Maybe RadioMenuItemGroupChangedCallback
noRadioMenuItemGroupChangedCallback = Nothing

type RadioMenuItemGroupChangedCallbackC =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkRadioMenuItemGroupChangedCallback :: RadioMenuItemGroupChangedCallbackC -> IO (FunPtr RadioMenuItemGroupChangedCallbackC)

radioMenuItemGroupChangedClosure :: RadioMenuItemGroupChangedCallback -> IO Closure
radioMenuItemGroupChangedClosure cb = newCClosure =<< mkRadioMenuItemGroupChangedCallback wrapped
    where wrapped = radioMenuItemGroupChangedCallbackWrapper cb

radioMenuItemGroupChangedCallbackWrapper ::
    RadioMenuItemGroupChangedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
radioMenuItemGroupChangedCallbackWrapper _cb _ _ = do
    _cb 

onRadioMenuItemGroupChanged :: (GObject a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId
onRadioMenuItemGroupChanged obj cb = liftIO $ connectRadioMenuItemGroupChanged obj cb SignalConnectBefore
afterRadioMenuItemGroupChanged :: (GObject a, MonadIO m) => a -> RadioMenuItemGroupChangedCallback -> m SignalHandlerId
afterRadioMenuItemGroupChanged obj cb = connectRadioMenuItemGroupChanged obj cb SignalConnectAfter

connectRadioMenuItemGroupChanged :: (GObject a, MonadIO m) =>
                                    a -> RadioMenuItemGroupChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectRadioMenuItemGroupChanged obj cb after = liftIO $ do
    cb' <- mkRadioMenuItemGroupChangedCallback (radioMenuItemGroupChangedCallbackWrapper cb)
    connectSignalFunPtr obj "group-changed" cb' after

-- VVV Prop "group"
   -- Type: TInterface "Gtk" "RadioMenuItem"
   -- Flags: [PropertyWritable]

setRadioMenuItemGroup :: (MonadIO m, RadioMenuItemK o, RadioMenuItemK a) => o -> a -> m ()
setRadioMenuItemGroup obj val = liftIO $ setObjectPropertyObject obj "group" val

constructRadioMenuItemGroup :: (RadioMenuItemK a) => a -> IO ([Char], GValue)
constructRadioMenuItemGroup val = constructObjectPropertyObject "group" val

data RadioMenuItemGroupPropertyInfo
instance AttrInfo RadioMenuItemGroupPropertyInfo where
    type AttrAllowedOps RadioMenuItemGroupPropertyInfo = '[ 'AttrSet, 'AttrConstruct]
    type AttrSetTypeConstraint RadioMenuItemGroupPropertyInfo = RadioMenuItemK
    type AttrBaseTypeConstraint RadioMenuItemGroupPropertyInfo = RadioMenuItemK
    type AttrGetType RadioMenuItemGroupPropertyInfo = ()
    type AttrLabel RadioMenuItemGroupPropertyInfo = "RadioMenuItem::group"
    attrGet _ = undefined
    attrSet _ = setRadioMenuItemGroup
    attrConstruct _ = constructRadioMenuItemGroup

type instance AttributeList RadioMenuItem = RadioMenuItemAttributeList
type RadioMenuItemAttributeList = ('[ '("accel-path", MenuItemAccelPathPropertyInfo), '("action-name", ActionableActionNamePropertyInfo), '("action-target", ActionableActionTargetPropertyInfo), '("active", CheckMenuItemActivePropertyInfo), '("app-paintable", WidgetAppPaintablePropertyInfo), '("border-width", ContainerBorderWidthPropertyInfo), '("can-default", WidgetCanDefaultPropertyInfo), '("can-focus", WidgetCanFocusPropertyInfo), '("child", ContainerChildPropertyInfo), '("composite-child", WidgetCompositeChildPropertyInfo), '("double-buffered", WidgetDoubleBufferedPropertyInfo), '("draw-as-radio", CheckMenuItemDrawAsRadioPropertyInfo), '("events", WidgetEventsPropertyInfo), '("expand", WidgetExpandPropertyInfo), '("group", RadioMenuItemGroupPropertyInfo), '("halign", WidgetHalignPropertyInfo), '("has-default", WidgetHasDefaultPropertyInfo), '("has-focus", WidgetHasFocusPropertyInfo), '("has-tooltip", WidgetHasTooltipPropertyInfo), '("height-request", WidgetHeightRequestPropertyInfo), '("hexpand", WidgetHexpandPropertyInfo), '("hexpand-set", WidgetHexpandSetPropertyInfo), '("inconsistent", CheckMenuItemInconsistentPropertyInfo), '("is-focus", WidgetIsFocusPropertyInfo), '("label", MenuItemLabelPropertyInfo), '("margin", WidgetMarginPropertyInfo), '("margin-bottom", WidgetMarginBottomPropertyInfo), '("margin-end", WidgetMarginEndPropertyInfo), '("margin-left", WidgetMarginLeftPropertyInfo), '("margin-right", WidgetMarginRightPropertyInfo), '("margin-start", WidgetMarginStartPropertyInfo), '("margin-top", WidgetMarginTopPropertyInfo), '("name", WidgetNamePropertyInfo), '("no-show-all", WidgetNoShowAllPropertyInfo), '("opacity", WidgetOpacityPropertyInfo), '("parent", WidgetParentPropertyInfo), '("receives-default", WidgetReceivesDefaultPropertyInfo), '("related-action", ActivatableRelatedActionPropertyInfo), '("resize-mode", ContainerResizeModePropertyInfo), '("right-justified", MenuItemRightJustifiedPropertyInfo), '("scale-factor", WidgetScaleFactorPropertyInfo), '("sensitive", WidgetSensitivePropertyInfo), '("style", WidgetStylePropertyInfo), '("submenu", MenuItemSubmenuPropertyInfo), '("tooltip-markup", WidgetTooltipMarkupPropertyInfo), '("tooltip-text", WidgetTooltipTextPropertyInfo), '("use-action-appearance", ActivatableUseActionAppearancePropertyInfo), '("use-underline", MenuItemUseUnderlinePropertyInfo), '("valign", WidgetValignPropertyInfo), '("vexpand", WidgetVexpandPropertyInfo), '("vexpand-set", WidgetVexpandSetPropertyInfo), '("visible", WidgetVisiblePropertyInfo), '("width-request", WidgetWidthRequestPropertyInfo), '("window", WidgetWindowPropertyInfo)] :: [(Symbol, *)])

data RadioMenuItemGroupChangedSignalInfo
instance SignalInfo RadioMenuItemGroupChangedSignalInfo where
    type HaskellCallbackType RadioMenuItemGroupChangedSignalInfo = RadioMenuItemGroupChangedCallback
    connectSignal _ = connectRadioMenuItemGroupChanged

type instance SignalList RadioMenuItem = RadioMenuItemSignalList
type RadioMenuItemSignalList = ('[ '("accel-closures-changed", WidgetAccelClosuresChangedSignalInfo), '("activate", MenuItemActivateSignalInfo), '("activate-item", MenuItemActivateItemSignalInfo), '("add", ContainerAddSignalInfo), '("button-press-event", WidgetButtonPressEventSignalInfo), '("button-release-event", WidgetButtonReleaseEventSignalInfo), '("can-activate-accel", WidgetCanActivateAccelSignalInfo), '("check-resize", ContainerCheckResizeSignalInfo), '("child-notify", WidgetChildNotifySignalInfo), '("composited-changed", WidgetCompositedChangedSignalInfo), '("configure-event", WidgetConfigureEventSignalInfo), '("damage-event", WidgetDamageEventSignalInfo), '("delete-event", WidgetDeleteEventSignalInfo), '("deselect", MenuItemDeselectSignalInfo), '("destroy", WidgetDestroySignalInfo), '("destroy-event", WidgetDestroyEventSignalInfo), '("direction-changed", WidgetDirectionChangedSignalInfo), '("drag-begin", WidgetDragBeginSignalInfo), '("drag-data-delete", WidgetDragDataDeleteSignalInfo), '("drag-data-get", WidgetDragDataGetSignalInfo), '("drag-data-received", WidgetDragDataReceivedSignalInfo), '("drag-drop", WidgetDragDropSignalInfo), '("drag-end", WidgetDragEndSignalInfo), '("drag-failed", WidgetDragFailedSignalInfo), '("drag-leave", WidgetDragLeaveSignalInfo), '("drag-motion", WidgetDragMotionSignalInfo), '("draw", WidgetDrawSignalInfo), '("enter-notify-event", WidgetEnterNotifyEventSignalInfo), '("event", WidgetEventSignalInfo), '("event-after", WidgetEventAfterSignalInfo), '("focus", WidgetFocusSignalInfo), '("focus-in-event", WidgetFocusInEventSignalInfo), '("focus-out-event", WidgetFocusOutEventSignalInfo), '("grab-broken-event", WidgetGrabBrokenEventSignalInfo), '("grab-focus", WidgetGrabFocusSignalInfo), '("grab-notify", WidgetGrabNotifySignalInfo), '("group-changed", RadioMenuItemGroupChangedSignalInfo), '("hide", WidgetHideSignalInfo), '("hierarchy-changed", WidgetHierarchyChangedSignalInfo), '("key-press-event", WidgetKeyPressEventSignalInfo), '("key-release-event", WidgetKeyReleaseEventSignalInfo), '("keynav-failed", WidgetKeynavFailedSignalInfo), '("leave-notify-event", WidgetLeaveNotifyEventSignalInfo), '("map", WidgetMapSignalInfo), '("map-event", WidgetMapEventSignalInfo), '("mnemonic-activate", WidgetMnemonicActivateSignalInfo), '("motion-notify-event", WidgetMotionNotifyEventSignalInfo), '("move-focus", WidgetMoveFocusSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("parent-set", WidgetParentSetSignalInfo), '("popup-menu", WidgetPopupMenuSignalInfo), '("property-notify-event", WidgetPropertyNotifyEventSignalInfo), '("proximity-in-event", WidgetProximityInEventSignalInfo), '("proximity-out-event", WidgetProximityOutEventSignalInfo), '("query-tooltip", WidgetQueryTooltipSignalInfo), '("realize", WidgetRealizeSignalInfo), '("remove", ContainerRemoveSignalInfo), '("screen-changed", WidgetScreenChangedSignalInfo), '("scroll-event", WidgetScrollEventSignalInfo), '("select", MenuItemSelectSignalInfo), '("selection-clear-event", WidgetSelectionClearEventSignalInfo), '("selection-get", WidgetSelectionGetSignalInfo), '("selection-notify-event", WidgetSelectionNotifyEventSignalInfo), '("selection-received", WidgetSelectionReceivedSignalInfo), '("selection-request-event", WidgetSelectionRequestEventSignalInfo), '("set-focus-child", ContainerSetFocusChildSignalInfo), '("show", WidgetShowSignalInfo), '("show-help", WidgetShowHelpSignalInfo), '("size-allocate", WidgetSizeAllocateSignalInfo), '("state-changed", WidgetStateChangedSignalInfo), '("state-flags-changed", WidgetStateFlagsChangedSignalInfo), '("style-set", WidgetStyleSetSignalInfo), '("style-updated", WidgetStyleUpdatedSignalInfo), '("toggle-size-allocate", MenuItemToggleSizeAllocateSignalInfo), '("toggle-size-request", MenuItemToggleSizeRequestSignalInfo), '("toggled", CheckMenuItemToggledSignalInfo), '("touch-event", WidgetTouchEventSignalInfo), '("unmap", WidgetUnmapSignalInfo), '("unmap-event", WidgetUnmapEventSignalInfo), '("unrealize", WidgetUnrealizeSignalInfo), '("visibility-notify-event", WidgetVisibilityNotifyEventSignalInfo), '("window-state-event", WidgetWindowStateEventSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method RadioMenuItem::new
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RadioMenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_new" gtk_radio_menu_item_new :: 
    Ptr (GSList (Ptr RadioMenuItem)) ->     -- group : TGSList (TInterface "Gtk" "RadioMenuItem")
    IO (Ptr RadioMenuItem)


radioMenuItemNew ::
    (MonadIO m, RadioMenuItemK a) =>
    [a] ->                                  -- group
    m RadioMenuItem
radioMenuItemNew group = liftIO $ do
    let group' = map unsafeManagedPtrCastPtr group
    group'' <- packGSList group'
    result <- gtk_radio_menu_item_new group''
    checkUnexpectedReturnNULL "gtk_radio_menu_item_new" result
    result' <- (newObject RadioMenuItem) result
    mapM_ touchManagedPtr group
    g_slist_free group''
    return result'

-- method RadioMenuItem::new_from_widget
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RadioMenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_new_from_widget" gtk_radio_menu_item_new_from_widget :: 
    Ptr RadioMenuItem ->                    -- group : TInterface "Gtk" "RadioMenuItem"
    IO (Ptr RadioMenuItem)


radioMenuItemNewFromWidget ::
    (MonadIO m, RadioMenuItemK a) =>
    Maybe (a) ->                            -- group
    m RadioMenuItem
radioMenuItemNewFromWidget group = liftIO $ do
    maybeGroup <- case group of
        Nothing -> return nullPtr
        Just jGroup -> do
            let jGroup' = unsafeManagedPtrCastPtr jGroup
            return jGroup'
    result <- gtk_radio_menu_item_new_from_widget maybeGroup
    checkUnexpectedReturnNULL "gtk_radio_menu_item_new_from_widget" result
    result' <- (newObject RadioMenuItem) result
    whenJust group touchManagedPtr
    return result'

-- method RadioMenuItem::new_with_label
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RadioMenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_new_with_label" gtk_radio_menu_item_new_with_label :: 
    Ptr (GSList (Ptr RadioMenuItem)) ->     -- group : TGSList (TInterface "Gtk" "RadioMenuItem")
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr RadioMenuItem)


radioMenuItemNewWithLabel ::
    (MonadIO m, RadioMenuItemK a) =>
    [a] ->                                  -- group
    T.Text ->                               -- label
    m RadioMenuItem
radioMenuItemNewWithLabel group label = liftIO $ do
    let group' = map unsafeManagedPtrCastPtr group
    group'' <- packGSList group'
    label' <- textToCString label
    result <- gtk_radio_menu_item_new_with_label group'' label'
    checkUnexpectedReturnNULL "gtk_radio_menu_item_new_with_label" result
    result' <- (newObject RadioMenuItem) result
    mapM_ touchManagedPtr group
    g_slist_free group''
    freeMem label'
    return result'

-- method RadioMenuItem::new_with_label_from_widget
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RadioMenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_new_with_label_from_widget" gtk_radio_menu_item_new_with_label_from_widget :: 
    Ptr RadioMenuItem ->                    -- group : TInterface "Gtk" "RadioMenuItem"
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr RadioMenuItem)


radioMenuItemNewWithLabelFromWidget ::
    (MonadIO m, RadioMenuItemK a) =>
    Maybe (a) ->                            -- group
    Maybe (T.Text) ->                       -- label
    m RadioMenuItem
radioMenuItemNewWithLabelFromWidget group label = liftIO $ do
    maybeGroup <- case group of
        Nothing -> return nullPtr
        Just jGroup -> do
            let jGroup' = unsafeManagedPtrCastPtr jGroup
            return jGroup'
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    result <- gtk_radio_menu_item_new_with_label_from_widget maybeGroup maybeLabel
    checkUnexpectedReturnNULL "gtk_radio_menu_item_new_with_label_from_widget" result
    result' <- (newObject RadioMenuItem) result
    whenJust group touchManagedPtr
    freeMem maybeLabel
    return result'

-- method RadioMenuItem::new_with_mnemonic
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RadioMenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_new_with_mnemonic" gtk_radio_menu_item_new_with_mnemonic :: 
    Ptr (GSList (Ptr RadioMenuItem)) ->     -- group : TGSList (TInterface "Gtk" "RadioMenuItem")
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr RadioMenuItem)


radioMenuItemNewWithMnemonic ::
    (MonadIO m, RadioMenuItemK a) =>
    [a] ->                                  -- group
    T.Text ->                               -- label
    m RadioMenuItem
radioMenuItemNewWithMnemonic group label = liftIO $ do
    let group' = map unsafeManagedPtrCastPtr group
    group'' <- packGSList group'
    label' <- textToCString label
    result <- gtk_radio_menu_item_new_with_mnemonic group'' label'
    checkUnexpectedReturnNULL "gtk_radio_menu_item_new_with_mnemonic" result
    result' <- (newObject RadioMenuItem) result
    mapM_ touchManagedPtr group
    g_slist_free group''
    freeMem label'
    return result'

-- method RadioMenuItem::new_with_mnemonic_from_widget
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "group", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "label", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "RadioMenuItem"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_new_with_mnemonic_from_widget" gtk_radio_menu_item_new_with_mnemonic_from_widget :: 
    Ptr RadioMenuItem ->                    -- group : TInterface "Gtk" "RadioMenuItem"
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr RadioMenuItem)


radioMenuItemNewWithMnemonicFromWidget ::
    (MonadIO m, RadioMenuItemK a) =>
    Maybe (a) ->                            -- group
    Maybe (T.Text) ->                       -- label
    m RadioMenuItem
radioMenuItemNewWithMnemonicFromWidget group label = liftIO $ do
    maybeGroup <- case group of
        Nothing -> return nullPtr
        Just jGroup -> do
            let jGroup' = unsafeManagedPtrCastPtr jGroup
            return jGroup'
    maybeLabel <- case label of
        Nothing -> return nullPtr
        Just jLabel -> do
            jLabel' <- textToCString jLabel
            return jLabel'
    result <- gtk_radio_menu_item_new_with_mnemonic_from_widget maybeGroup maybeLabel
    checkUnexpectedReturnNULL "gtk_radio_menu_item_new_with_mnemonic_from_widget" result
    result' <- (newObject RadioMenuItem) result
    whenJust group touchManagedPtr
    freeMem maybeLabel
    return result'

-- method RadioMenuItem::get_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGSList (TInterface "Gtk" "RadioMenuItem")
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_get_group" gtk_radio_menu_item_get_group :: 
    Ptr RadioMenuItem ->                    -- _obj : TInterface "Gtk" "RadioMenuItem"
    IO (Ptr (GSList (Ptr RadioMenuItem)))


radioMenuItemGetGroup ::
    (MonadIO m, RadioMenuItemK a) =>
    a ->                                    -- _obj
    m [RadioMenuItem]
radioMenuItemGetGroup _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_radio_menu_item_get_group _obj'
    checkUnexpectedReturnNULL "gtk_radio_menu_item_get_group" result
    result' <- unpackGSList result
    result'' <- mapM (newObject RadioMenuItem) result'
    touchManagedPtr _obj
    return result''

-- method RadioMenuItem::set_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioMenuItem", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioMenuItem"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_menu_item_set_group" gtk_radio_menu_item_set_group :: 
    Ptr RadioMenuItem ->                    -- _obj : TInterface "Gtk" "RadioMenuItem"
    Ptr (GSList (Ptr RadioMenuItem)) ->     -- group : TGSList (TInterface "Gtk" "RadioMenuItem")
    IO ()


radioMenuItemSetGroup ::
    (MonadIO m, RadioMenuItemK a, RadioMenuItemK b) =>
    a ->                                    -- _obj
    [b] ->                                  -- group
    m ()
radioMenuItemSetGroup _obj group = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let group' = map unsafeManagedPtrCastPtr group
    group'' <- packGSList group'
    gtk_radio_menu_item_set_group _obj' group''
    touchManagedPtr _obj
    mapM_ touchManagedPtr group
    g_slist_free group''
    return ()