    {-# LINE 2 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget ToggleAction
    --
    -- Author : Duncan Coutts
    --
    -- Created: 6 April 2005
    --
    -- Copyright (C) 2005 Duncan Coutts
    --
    -- This library is free software; you can redistribute it and/or
    -- modify it under the terms of the GNU Lesser General Public
    -- License as published by the Free Software Foundation; either
    -- version 2.1 of the License, or (at your option) any later version.
    --
    -- This library is distributed in the hope that it will be useful,
    -- but WITHOUT ANY WARRANTY; without even the implied warranty of
    -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    -- Lesser General Public License for more details.
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- An action which can be toggled between two states
    --
    -- * Module available since Gtk+ version 2.4
    --
    module Graphics.UI.Gtk.ActionMenuToolbar.ToggleAction (
    -- * Detail
    --
    -- | A 'ToggleAction' corresponds roughly to a 'CheckMenuItem'. It has an
    -- \"active\" state specifying whether the action has been checked or not.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Action'
    -- | +----ToggleAction
    -- | +----'RadioAction'
    -- @

    -- * Types
      ToggleAction,
      ToggleActionClass,
      castToToggleAction, gTypeToggleAction,
      toToggleAction,

    -- * Constructors
      toggleActionNew,

    -- * Methods
      toggleActionToggled,
      toggleActionSetActive,
      toggleActionGetActive,
      toggleActionSetDrawAsRadio,
      toggleActionGetDrawAsRadio,

    -- * Attributes
      toggleActionDrawAsRadio,

      toggleActionActive,

    -- * Signals
      actionToggled,

    -- * Deprecated

      ) where

    import Control.Monad (liftM)

    import System.Glib.FFI
    import System.Glib.UTFString
    import System.Glib.Attributes
    import System.Glib.Properties
    import Graphics.UI.Gtk.Types
    {-# LINE 87 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
    import Graphics.UI.Gtk.Signals
    {-# LINE 88 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
    import Graphics.UI.Gtk.General.StockItems

    {-# LINE 91 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}

    --------------------
    -- Constructors

    -- | Creates a new 'ToggleAction' object. To add the action to a 'ActionGroup'
    -- and set the accelerator for the action, call
    -- 'Graphics.UI.Gtk.ActionMenuToolbar.ActionGroup.actionGroupAddActionWithAccel'.
    --
    toggleActionNew :: GlibString string
     => string -- ^ @name@ - A unique name for the action
     -> string -- ^ @label@ - The label displayed in menu items and on
                        -- buttons
     -> Maybe string -- ^ @tooltip@ - A tooltip for the action
     -> Maybe StockId -- ^ @stockId@ - The stock icon to display in widgets
                        -- representing the action
     -> IO ToggleAction
    toggleActionNew :: forall string.
    GlibString string =>
    string
    -> string -> Maybe string -> Maybe StockId -> IO ToggleAction
    toggleActionNew string
    name string
    label Maybe string
    tooltip Maybe StockId
    stockId =
      (ForeignPtr ToggleAction -> ToggleAction,
     FinalizerPtr ToggleAction)
    -> IO (Ptr ToggleAction) -> IO ToggleAction
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    wrapNewGObject (ForeignPtr ToggleAction -> ToggleAction,
     FinalizerPtr ToggleAction)
    forall {a}.
    (ForeignPtr ToggleAction -> ToggleAction, FinalizerPtr a)
    mkToggleAction (IO (Ptr ToggleAction) -> IO ToggleAction)
    -> IO (Ptr ToggleAction) -> IO ToggleAction
    forall a b. (a -> b) -> a -> b
    $
      (StockId
     -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
    -> Maybe StockId
    -> (Ptr CChar -> IO (Ptr ToggleAction))
    -> IO (Ptr ToggleAction)
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith StockId
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    forall a. StockId -> (Ptr CChar -> IO a) -> IO a
    withUTFString Maybe StockId
    stockId ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    stockIdPtr ->
      (string
     -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
    -> Maybe string
    -> (Ptr CChar -> IO (Ptr ToggleAction))
    -> IO (Ptr ToggleAction)
    forall a b c.
    (a -> (Ptr b -> IO c) -> IO c)
    -> Maybe a -> (Ptr b -> IO c) -> IO c
    maybeWith string
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString Maybe string
    tooltip ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    tooltipPtr ->
      string
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString string
    label ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    labelPtr ->
      string
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString string
    name ((Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction))
    -> (Ptr CChar -> IO (Ptr ToggleAction)) -> IO (Ptr ToggleAction)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    namePtr ->
      Ptr CChar
    -> Ptr CChar -> Ptr CChar -> Ptr CChar -> IO (Ptr ToggleAction)
    gtk_toggle_action_new
    {-# LINE 115 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
        namePtr
        Ptr CChar
    labelPtr
        Ptr CChar
    tooltipPtr
        Ptr CChar
    stockIdPtr

    --------------------
    -- Methods

    -- | Emits the \"toggled\" signal on the toggle action.
    --
    toggleActionToggled :: ToggleActionClass self => self -> IO ()
    toggleActionToggled :: forall self. ToggleActionClass self => self -> IO ()
    toggleActionToggled self
    self =
      (\(ToggleAction ForeignPtr ToggleAction
    arg1) -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleAction
    arg1 ((Ptr ToggleAction -> IO ()) -> IO ())
    -> (Ptr ToggleAction -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleAction
    argPtr1 ->Ptr ToggleAction -> IO ()
    gtk_toggle_action_toggled Ptr ToggleAction
    argPtr1)
    {-# LINE 128 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
        (toToggleAction self)

    -- | Sets the checked state on the toggle action.
    --
    toggleActionSetActive :: ToggleActionClass self => self
     -> Bool -- ^ @isActive@ - whether the action should be checked or not
     -> IO ()
    toggleActionSetActive :: forall self. ToggleActionClass self => self -> Bool -> IO ()
    toggleActionSetActive self
    self Bool
    isActive =
      (\(ToggleAction ForeignPtr ToggleAction
    arg1) CInt
    arg2 -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleAction
    arg1 ((Ptr ToggleAction -> IO ()) -> IO ())
    -> (Ptr ToggleAction -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleAction
    argPtr1 ->Ptr ToggleAction -> CInt -> IO ()
    gtk_toggle_action_set_active Ptr ToggleAction
    argPtr1 CInt
    arg2)
    {-# LINE 137 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
        (toToggleAction self)
        (Bool -> CInt
    forall a. Num a => Bool -> a
    fromBool Bool
    isActive)

    -- | Returns the checked state of the toggle action.
    --
    toggleActionGetActive :: ToggleActionClass self => self -> IO Bool
    toggleActionGetActive :: forall self. ToggleActionClass self => self -> IO Bool
    toggleActionGetActive self
    self =
      (CInt -> Bool) -> IO CInt -> IO Bool
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CInt -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
    forall a b. (a -> b) -> a -> b
    $
      (\(ToggleAction ForeignPtr ToggleAction
    arg1) -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleAction
    arg1 ((Ptr ToggleAction -> IO CInt) -> IO CInt)
    -> (Ptr ToggleAction -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleAction
    argPtr1 ->Ptr ToggleAction -> IO CInt
    gtk_toggle_action_get_active Ptr ToggleAction
    argPtr1)
    {-# LINE 146 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
        (toToggleAction self)

    -- | Sets whether the action should have proxies like a radio action.
    --
    toggleActionSetDrawAsRadio :: ToggleActionClass self => self -> Bool -> IO ()
    toggleActionSetDrawAsRadio :: forall self. ToggleActionClass self => self -> Bool -> IO ()
    toggleActionSetDrawAsRadio self
    self Bool
    drawAsRadio =
      (\(ToggleAction ForeignPtr ToggleAction
    arg1) CInt
    arg2 -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleAction
    arg1 ((Ptr ToggleAction -> IO ()) -> IO ())
    -> (Ptr ToggleAction -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleAction
    argPtr1 ->Ptr ToggleAction -> CInt -> IO ()
    gtk_toggle_action_set_draw_as_radio Ptr ToggleAction
    argPtr1 CInt
    arg2)
    {-# LINE 153 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
        (toToggleAction self)
        (Bool -> CInt
    forall a. Num a => Bool -> a
    fromBool Bool
    drawAsRadio)

    -- | Returns whether the action should have proxies like a radio action.
    --
    toggleActionGetDrawAsRadio :: ToggleActionClass self => self -> IO Bool
    toggleActionGetDrawAsRadio :: forall self. ToggleActionClass self => self -> IO Bool
    toggleActionGetDrawAsRadio self
    self =
      (CInt -> Bool) -> IO CInt -> IO Bool
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM CInt -> Bool
    forall a. (Eq a, Num a) => a -> Bool
    toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
    forall a b. (a -> b) -> a -> b
    $
      (\(ToggleAction ForeignPtr ToggleAction
    arg1) -> ForeignPtr ToggleAction -> (Ptr ToggleAction -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleAction
    arg1 ((Ptr ToggleAction -> IO CInt) -> IO CInt)
    -> (Ptr ToggleAction -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleAction
    argPtr1 ->Ptr ToggleAction -> IO CInt
    gtk_toggle_action_get_draw_as_radio Ptr ToggleAction
    argPtr1)
    {-# LINE 162 "./Graphics/UI/Gtk/ActionMenuToolbar/ToggleAction.chs" #-}
        (toToggleAction self)

    --------------------
    -- Attributes

    -- | Whether the proxies for this action look like radio action proxies.
    --
    -- Default value: @False@
    --
    toggleActionDrawAsRadio :: ToggleActionClass self => Attr self Bool
    toggleActionDrawAsRadio :: forall self. ToggleActionClass self => Attr self Bool
    toggleActionDrawAsRadio = (self -> IO Bool)
    -> (self -> Bool -> IO ()) -> ReadWriteAttr self Bool Bool
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      self -> IO Bool
    forall self. ToggleActionClass self => self -> IO Bool
    toggleActionGetDrawAsRadio
      self -> Bool -> IO ()
    forall self. ToggleActionClass self => self -> Bool -> IO ()
    toggleActionSetDrawAsRadio

    -- %hash c:cd0e d:4024
    -- | If the toggle action should be active in or not.
    --
    -- Default value: @False@
    --
    -- * Available since Gtk+ version 2.10
    --
    toggleActionActive :: ToggleActionClass self => Attr self Bool
    toggleActionActive :: forall self. ToggleActionClass self => Attr self Bool
    toggleActionActive = String -> Attr self Bool
    forall gobj. GObjectClass gobj => String -> Attr gobj Bool
    newAttrFromBoolProperty String
    "active"

    --------------------
    -- Signals

    -- %hash c:3829 d:af3f
    -- |
    --
    actionToggled :: ToggleActionClass self => Signal self (IO ())
    actionToggled :: forall self. ToggleActionClass self => Signal self (IO ())
    actionToggled = (Bool -> self -> IO () -> IO (ConnectId self))
    -> Signal self (IO ())
    forall object handler.
    (Bool -> object -> handler -> IO (ConnectId object))
    -> Signal object handler
    Signal (String -> Bool -> self -> IO () -> IO (ConnectId self)
    forall obj.
    GObjectClass obj =>
    String -> Bool -> obj -> IO () -> IO (ConnectId obj)
    connect_NONE__NONE String
    "toggled")

    --------------------
    -- Deprecated Signals

    foreign import ccall safe "gtk_toggle_action_new"
      gtk_toggle_action_new :: ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO (Ptr ToggleAction))))))

    foreign import ccall safe "gtk_toggle_action_toggled"
      gtk_toggle_action_toggled :: ((Ptr ToggleAction) -> (IO ()))

    foreign import ccall safe "gtk_toggle_action_set_active"
      gtk_toggle_action_set_active :: ((Ptr ToggleAction) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_toggle_action_get_active"
      gtk_toggle_action_get_active :: ((Ptr ToggleAction) -> (IO CInt))

    foreign import ccall safe "gtk_toggle_action_set_draw_as_radio"
      gtk_toggle_action_set_draw_as_radio :: ((Ptr ToggleAction) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_toggle_action_get_draw_as_radio"
      gtk_toggle_action_get_draw_as_radio :: ((Ptr ToggleAction) -> (IO CInt))