{- |
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.RadioButton
    ( 

-- * Exported types
    RadioButton(..)                         ,
    RadioButtonK                            ,
    toRadioButton                           ,
    noRadioButton                           ,


 -- * Methods
-- ** radioButtonGetGroup
    radioButtonGetGroup                     ,


-- ** radioButtonJoinGroup
    radioButtonJoinGroup                    ,


-- ** radioButtonNew
    radioButtonNew                          ,


-- ** radioButtonNewFromWidget
    radioButtonNewFromWidget                ,


-- ** radioButtonNewWithLabel
    radioButtonNewWithLabel                 ,


-- ** radioButtonNewWithLabelFromWidget
    radioButtonNewWithLabelFromWidget       ,


-- ** radioButtonNewWithMnemonic
    radioButtonNewWithMnemonic              ,


-- ** radioButtonNewWithMnemonicFromWidget
    radioButtonNewWithMnemonicFromWidget    ,


-- ** radioButtonSetGroup
    radioButtonSetGroup                     ,




 -- * Properties
-- ** Group
    RadioButtonGroupPropertyInfo            ,
    constructRadioButtonGroup               ,
    setRadioButtonGroup                     ,




 -- * Signals
-- ** GroupChanged
    RadioButtonGroupChangedCallback         ,
    RadioButtonGroupChangedCallbackC        ,
    RadioButtonGroupChangedSignalInfo       ,
    afterRadioButtonGroupChanged            ,
    mkRadioButtonGroupChangedCallback       ,
    noRadioButtonGroupChangedCallback       ,
    onRadioButtonGroupChanged               ,
    radioButtonGroupChangedCallbackWrapper  ,
    radioButtonGroupChangedClosure          ,




    ) 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 RadioButton = RadioButton (ForeignPtr RadioButton)
foreign import ccall "gtk_radio_button_get_type"
    c_gtk_radio_button_get_type :: IO GType

type instance ParentTypes RadioButton = RadioButtonParentTypes
type RadioButtonParentTypes = '[CheckButton, ToggleButton, Button, Bin, Container, Widget, GObject.Object, Atk.ImplementorIface, Actionable, Activatable, Buildable]

instance GObject RadioButton where
    gobjectIsInitiallyUnowned _ = True
    gobjectType _ = c_gtk_radio_button_get_type
    

class GObject o => RadioButtonK o
instance (GObject o, IsDescendantOf RadioButton o) => RadioButtonK o

toRadioButton :: RadioButtonK o => o -> IO RadioButton
toRadioButton = unsafeCastTo RadioButton

noRadioButton :: Maybe RadioButton
noRadioButton = Nothing

-- signal RadioButton::group-changed
type RadioButtonGroupChangedCallback =
    IO ()

noRadioButtonGroupChangedCallback :: Maybe RadioButtonGroupChangedCallback
noRadioButtonGroupChangedCallback = Nothing

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

foreign import ccall "wrapper"
    mkRadioButtonGroupChangedCallback :: RadioButtonGroupChangedCallbackC -> IO (FunPtr RadioButtonGroupChangedCallbackC)

radioButtonGroupChangedClosure :: RadioButtonGroupChangedCallback -> IO Closure
radioButtonGroupChangedClosure cb = newCClosure =<< mkRadioButtonGroupChangedCallback wrapped
    where wrapped = radioButtonGroupChangedCallbackWrapper cb

radioButtonGroupChangedCallbackWrapper ::
    RadioButtonGroupChangedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
radioButtonGroupChangedCallbackWrapper _cb _ _ = do
    _cb 

onRadioButtonGroupChanged :: (GObject a, MonadIO m) => a -> RadioButtonGroupChangedCallback -> m SignalHandlerId
onRadioButtonGroupChanged obj cb = liftIO $ connectRadioButtonGroupChanged obj cb SignalConnectBefore
afterRadioButtonGroupChanged :: (GObject a, MonadIO m) => a -> RadioButtonGroupChangedCallback -> m SignalHandlerId
afterRadioButtonGroupChanged obj cb = connectRadioButtonGroupChanged obj cb SignalConnectAfter

connectRadioButtonGroupChanged :: (GObject a, MonadIO m) =>
                                  a -> RadioButtonGroupChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectRadioButtonGroupChanged obj cb after = liftIO $ do
    cb' <- mkRadioButtonGroupChangedCallback (radioButtonGroupChangedCallbackWrapper cb)
    connectSignalFunPtr obj "group-changed" cb' after

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

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

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

data RadioButtonGroupPropertyInfo
instance AttrInfo RadioButtonGroupPropertyInfo where
    type AttrAllowedOps RadioButtonGroupPropertyInfo = '[ 'AttrSet, 'AttrConstruct]
    type AttrSetTypeConstraint RadioButtonGroupPropertyInfo = RadioButtonK
    type AttrBaseTypeConstraint RadioButtonGroupPropertyInfo = RadioButtonK
    type AttrGetType RadioButtonGroupPropertyInfo = ()
    type AttrLabel RadioButtonGroupPropertyInfo = "RadioButton::group"
    attrGet _ = undefined
    attrSet _ = setRadioButtonGroup
    attrConstruct _ = constructRadioButtonGroup

type instance AttributeList RadioButton = RadioButtonAttributeList
type RadioButtonAttributeList = ('[ '("action-name", ActionableActionNamePropertyInfo), '("action-target", ActionableActionTargetPropertyInfo), '("active", ToggleButtonActivePropertyInfo), '("always-show-image", ButtonAlwaysShowImagePropertyInfo), '("app-paintable", WidgetAppPaintablePropertyInfo), '("border-width", ContainerBorderWidthPropertyInfo), '("can-default", WidgetCanDefaultPropertyInfo), '("can-focus", WidgetCanFocusPropertyInfo), '("child", ContainerChildPropertyInfo), '("composite-child", WidgetCompositeChildPropertyInfo), '("double-buffered", WidgetDoubleBufferedPropertyInfo), '("draw-indicator", ToggleButtonDrawIndicatorPropertyInfo), '("events", WidgetEventsPropertyInfo), '("expand", WidgetExpandPropertyInfo), '("focus-on-click", ButtonFocusOnClickPropertyInfo), '("group", RadioButtonGroupPropertyInfo), '("halign", WidgetHalignPropertyInfo), '("has-default", WidgetHasDefaultPropertyInfo), '("has-focus", WidgetHasFocusPropertyInfo), '("has-tooltip", WidgetHasTooltipPropertyInfo), '("height-request", WidgetHeightRequestPropertyInfo), '("hexpand", WidgetHexpandPropertyInfo), '("hexpand-set", WidgetHexpandSetPropertyInfo), '("image", ButtonImagePropertyInfo), '("image-position", ButtonImagePositionPropertyInfo), '("inconsistent", ToggleButtonInconsistentPropertyInfo), '("is-focus", WidgetIsFocusPropertyInfo), '("label", ButtonLabelPropertyInfo), '("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), '("relief", ButtonReliefPropertyInfo), '("resize-mode", ContainerResizeModePropertyInfo), '("scale-factor", WidgetScaleFactorPropertyInfo), '("sensitive", WidgetSensitivePropertyInfo), '("style", WidgetStylePropertyInfo), '("tooltip-markup", WidgetTooltipMarkupPropertyInfo), '("tooltip-text", WidgetTooltipTextPropertyInfo), '("use-action-appearance", ActivatableUseActionAppearancePropertyInfo), '("use-stock", ButtonUseStockPropertyInfo), '("use-underline", ButtonUseUnderlinePropertyInfo), '("valign", WidgetValignPropertyInfo), '("vexpand", WidgetVexpandPropertyInfo), '("vexpand-set", WidgetVexpandSetPropertyInfo), '("visible", WidgetVisiblePropertyInfo), '("width-request", WidgetWidthRequestPropertyInfo), '("window", WidgetWindowPropertyInfo), '("xalign", ButtonXalignPropertyInfo), '("yalign", ButtonYalignPropertyInfo)] :: [(Symbol, *)])

data RadioButtonGroupChangedSignalInfo
instance SignalInfo RadioButtonGroupChangedSignalInfo where
    type HaskellCallbackType RadioButtonGroupChangedSignalInfo = RadioButtonGroupChangedCallback
    connectSignal _ = connectRadioButtonGroupChanged

type instance SignalList RadioButton = RadioButtonSignalList
type RadioButtonSignalList = ('[ '("accel-closures-changed", WidgetAccelClosuresChangedSignalInfo), '("activate", ButtonActivateSignalInfo), '("add", ContainerAddSignalInfo), '("button-press-event", WidgetButtonPressEventSignalInfo), '("button-release-event", WidgetButtonReleaseEventSignalInfo), '("can-activate-accel", WidgetCanActivateAccelSignalInfo), '("check-resize", ContainerCheckResizeSignalInfo), '("child-notify", WidgetChildNotifySignalInfo), '("clicked", ButtonClickedSignalInfo), '("composited-changed", WidgetCompositedChangedSignalInfo), '("configure-event", WidgetConfigureEventSignalInfo), '("damage-event", WidgetDamageEventSignalInfo), '("delete-event", WidgetDeleteEventSignalInfo), '("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", ButtonEnterSignalInfo), '("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", RadioButtonGroupChangedSignalInfo), '("hide", WidgetHideSignalInfo), '("hierarchy-changed", WidgetHierarchyChangedSignalInfo), '("key-press-event", WidgetKeyPressEventSignalInfo), '("key-release-event", WidgetKeyReleaseEventSignalInfo), '("keynav-failed", WidgetKeynavFailedSignalInfo), '("leave", ButtonLeaveSignalInfo), '("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), '("pressed", ButtonPressedSignalInfo), '("property-notify-event", WidgetPropertyNotifyEventSignalInfo), '("proximity-in-event", WidgetProximityInEventSignalInfo), '("proximity-out-event", WidgetProximityOutEventSignalInfo), '("query-tooltip", WidgetQueryTooltipSignalInfo), '("realize", WidgetRealizeSignalInfo), '("released", ButtonReleasedSignalInfo), '("remove", ContainerRemoveSignalInfo), '("screen-changed", WidgetScreenChangedSignalInfo), '("scroll-event", WidgetScrollEventSignalInfo), '("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), '("toggled", ToggleButtonToggledSignalInfo), '("touch-event", WidgetTouchEventSignalInfo), '("unmap", WidgetUnmapSignalInfo), '("unmap-event", WidgetUnmapEventSignalInfo), '("unrealize", WidgetUnrealizeSignalInfo), '("visibility-notify-event", WidgetVisibilityNotifyEventSignalInfo), '("window-state-event", WidgetWindowStateEventSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

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

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


radioButtonNew ::
    (MonadIO m, RadioButtonK a) =>
    [a] ->                                  -- group
    m RadioButton
radioButtonNew group = liftIO $ do
    let group' = map unsafeManagedPtrCastPtr group
    group'' <- packGSList group'
    result <- gtk_radio_button_new group''
    checkUnexpectedReturnNULL "gtk_radio_button_new" result
    result' <- (newObject RadioButton) result
    mapM_ touchManagedPtr group
    g_slist_free group''
    return result'

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

foreign import ccall "gtk_radio_button_new_from_widget" gtk_radio_button_new_from_widget :: 
    Ptr RadioButton ->                      -- radio_group_member : TInterface "Gtk" "RadioButton"
    IO (Ptr RadioButton)


radioButtonNewFromWidget ::
    (MonadIO m, RadioButtonK a) =>
    Maybe (a) ->                            -- radio_group_member
    m RadioButton
radioButtonNewFromWidget radio_group_member = liftIO $ do
    maybeRadio_group_member <- case radio_group_member of
        Nothing -> return nullPtr
        Just jRadio_group_member -> do
            let jRadio_group_member' = unsafeManagedPtrCastPtr jRadio_group_member
            return jRadio_group_member'
    result <- gtk_radio_button_new_from_widget maybeRadio_group_member
    checkUnexpectedReturnNULL "gtk_radio_button_new_from_widget" result
    result' <- (newObject RadioButton) result
    whenJust radio_group_member touchManagedPtr
    return result'

-- method RadioButton::new_with_label
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioButton"), 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" "RadioButton"), 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" "RadioButton"
-- throws : False
-- Skip return : False

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


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

-- method RadioButton::new_with_label_from_widget
-- method type : Constructor
-- Args : [Arg {argName = "radio_group_member", argType = TInterface "Gtk" "RadioButton", 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 = "radio_group_member", argType = TInterface "Gtk" "RadioButton", 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" "RadioButton"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_button_new_with_label_from_widget" gtk_radio_button_new_with_label_from_widget :: 
    Ptr RadioButton ->                      -- radio_group_member : TInterface "Gtk" "RadioButton"
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr RadioButton)


radioButtonNewWithLabelFromWidget ::
    (MonadIO m, RadioButtonK a) =>
    Maybe (a) ->                            -- radio_group_member
    T.Text ->                               -- label
    m RadioButton
radioButtonNewWithLabelFromWidget radio_group_member label = liftIO $ do
    maybeRadio_group_member <- case radio_group_member of
        Nothing -> return nullPtr
        Just jRadio_group_member -> do
            let jRadio_group_member' = unsafeManagedPtrCastPtr jRadio_group_member
            return jRadio_group_member'
    label' <- textToCString label
    result <- gtk_radio_button_new_with_label_from_widget maybeRadio_group_member label'
    checkUnexpectedReturnNULL "gtk_radio_button_new_with_label_from_widget" result
    result' <- (newObject RadioButton) result
    whenJust radio_group_member touchManagedPtr
    freeMem label'
    return result'

-- method RadioButton::new_with_mnemonic
-- method type : Constructor
-- Args : [Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioButton"), 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" "RadioButton"), 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" "RadioButton"
-- throws : False
-- Skip return : False

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


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

-- method RadioButton::new_with_mnemonic_from_widget
-- method type : Constructor
-- Args : [Arg {argName = "radio_group_member", argType = TInterface "Gtk" "RadioButton", 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 = "radio_group_member", argType = TInterface "Gtk" "RadioButton", 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" "RadioButton"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_radio_button_new_with_mnemonic_from_widget" gtk_radio_button_new_with_mnemonic_from_widget :: 
    Ptr RadioButton ->                      -- radio_group_member : TInterface "Gtk" "RadioButton"
    CString ->                              -- label : TBasicType TUTF8
    IO (Ptr RadioButton)


radioButtonNewWithMnemonicFromWidget ::
    (MonadIO m, RadioButtonK a) =>
    Maybe (a) ->                            -- radio_group_member
    T.Text ->                               -- label
    m RadioButton
radioButtonNewWithMnemonicFromWidget radio_group_member label = liftIO $ do
    maybeRadio_group_member <- case radio_group_member of
        Nothing -> return nullPtr
        Just jRadio_group_member -> do
            let jRadio_group_member' = unsafeManagedPtrCastPtr jRadio_group_member
            return jRadio_group_member'
    label' <- textToCString label
    result <- gtk_radio_button_new_with_mnemonic_from_widget maybeRadio_group_member label'
    checkUnexpectedReturnNULL "gtk_radio_button_new_with_mnemonic_from_widget" result
    result' <- (newObject RadioButton) result
    whenJust radio_group_member touchManagedPtr
    freeMem label'
    return result'

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

foreign import ccall "gtk_radio_button_get_group" gtk_radio_button_get_group :: 
    Ptr RadioButton ->                      -- _obj : TInterface "Gtk" "RadioButton"
    IO (Ptr (GSList (Ptr RadioButton)))


radioButtonGetGroup ::
    (MonadIO m, RadioButtonK a) =>
    a ->                                    -- _obj
    m [RadioButton]
radioButtonGetGroup _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_radio_button_get_group _obj'
    checkUnexpectedReturnNULL "gtk_radio_button_get_group" result
    result' <- unpackGSList result
    result'' <- mapM (newObject RadioButton) result'
    touchManagedPtr _obj
    return result''

-- method RadioButton::join_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioButton", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group_source", argType = TInterface "Gtk" "RadioButton", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioButton", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group_source", argType = TInterface "Gtk" "RadioButton", 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_button_join_group" gtk_radio_button_join_group :: 
    Ptr RadioButton ->                      -- _obj : TInterface "Gtk" "RadioButton"
    Ptr RadioButton ->                      -- group_source : TInterface "Gtk" "RadioButton"
    IO ()


radioButtonJoinGroup ::
    (MonadIO m, RadioButtonK a, RadioButtonK b) =>
    a ->                                    -- _obj
    Maybe (b) ->                            -- group_source
    m ()
radioButtonJoinGroup _obj group_source = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeGroup_source <- case group_source of
        Nothing -> return nullPtr
        Just jGroup_source -> do
            let jGroup_source' = unsafeManagedPtrCastPtr jGroup_source
            return jGroup_source'
    gtk_radio_button_join_group _obj' maybeGroup_source
    touchManagedPtr _obj
    whenJust group_source touchManagedPtr
    return ()

-- method RadioButton::set_group
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioButton", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioButton"), direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "RadioButton", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "group", argType = TGSList (TInterface "Gtk" "RadioButton"), 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_button_set_group" gtk_radio_button_set_group :: 
    Ptr RadioButton ->                      -- _obj : TInterface "Gtk" "RadioButton"
    Ptr (GSList (Ptr RadioButton)) ->       -- group : TGSList (TInterface "Gtk" "RadioButton")
    IO ()


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