    {-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget ToggleToolButton
    --
    -- Author : Duncan Coutts
    --
    -- Created: 7 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)
    --
    -- A 'ToolItem' containing a toggle button
    --
    -- * Module available since Gtk+ version 2.4
    --
    module Graphics.UI.Gtk.MenuComboToolbar.ToggleToolButton (
    -- * Detail
    --
    -- | A 'ToggleToolButton' is a 'ToolItem' that contains a toggle button.
    --
    -- Use 'toggleToolButtonNew' to create a new 'ToggleToolButton'. Use
    -- 'toggleToolButtonNewFromStock' to create a new 'ToggleToolButton' containing
    -- a stock item.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Object'
    -- | +----'Widget'
    -- | +----'Container'
    -- | +----'Bin'
    -- | +----'ToolItem'
    -- | +----'ToolButton'
    -- | +----ToggleToolButton
    -- | +----'RadioToolButton'
    -- @

    -- * Types
      ToggleToolButton,
      ToggleToolButtonClass,
      castToToggleToolButton, gTypeToggleToolButton,
      toToggleToolButton,

    -- * Constructors
      toggleToolButtonNew,
      toggleToolButtonNewFromStock,

    -- * Methods
      toggleToolButtonSetActive,
      toggleToolButtonGetActive,

    -- * Attributes

      toggleToolButtonActive,

    -- * Signals
      onToolButtonToggled,
      afterToolButtonToggled,

      ) 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
    {-# LINE 86 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}
    import Graphics.UI.Gtk.Signals
    {-# LINE 87 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}
    import Graphics.UI.Gtk.General.StockItems

    {-# LINE 90 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}

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

    -- | Returns a new 'ToggleToolButton'
    --
    toggleToolButtonNew :: IO ToggleToolButton
    toggleToolButtonNew :: IO ToggleToolButton
    toggleToolButtonNew =
      (ForeignPtr ToggleToolButton -> ToggleToolButton,
     FinalizerPtr ToggleToolButton)
    -> IO (Ptr ToggleToolButton) -> IO ToggleToolButton
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr ToggleToolButton -> ToggleToolButton,
     FinalizerPtr ToggleToolButton)
    forall {a}.
    (ForeignPtr ToggleToolButton -> ToggleToolButton, FinalizerPtr a)
    mkToggleToolButton (IO (Ptr ToggleToolButton) -> IO ToggleToolButton)
    -> IO (Ptr ToggleToolButton) -> IO ToggleToolButton
    forall a b. (a -> b) -> a -> b
    $
      (Ptr ToolItem -> Ptr ToggleToolButton)
    -> IO (Ptr ToolItem) -> IO (Ptr ToggleToolButton)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr ToolItem -> Ptr ToggleToolButton
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr ToolItem -> Ptr ToggleToolButton) (IO (Ptr ToolItem) -> IO (Ptr ToggleToolButton))
    -> IO (Ptr ToolItem) -> IO (Ptr ToggleToolButton)
    forall a b. (a -> b) -> a -> b
    $
      IO (Ptr ToolItem)
    gtk_toggle_tool_button_new
    {-# LINE 102 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}

    -- | Creates a new 'ToggleToolButton' containing the image and text from a
    -- stock item.
    --
    -- It is an error if @stockId@ is not a name of a stock item.
    --
    toggleToolButtonNewFromStock ::
        StockId -- ^ @stockId@ - the name of the stock item
     -> IO ToggleToolButton
    toggleToolButtonNewFromStock :: StockId -> IO ToggleToolButton
    toggleToolButtonNewFromStock StockId
    stockId =
      (ForeignPtr ToggleToolButton -> ToggleToolButton,
     FinalizerPtr ToggleToolButton)
    -> IO (Ptr ToggleToolButton) -> IO ToggleToolButton
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr ToggleToolButton -> ToggleToolButton,
     FinalizerPtr ToggleToolButton)
    forall {a}.
    (ForeignPtr ToggleToolButton -> ToggleToolButton, FinalizerPtr a)
    mkToggleToolButton (IO (Ptr ToggleToolButton) -> IO ToggleToolButton)
    -> IO (Ptr ToggleToolButton) -> IO ToggleToolButton
    forall a b. (a -> b) -> a -> b
    $
      (Ptr ToolItem -> Ptr ToggleToolButton)
    -> IO (Ptr ToolItem) -> IO (Ptr ToggleToolButton)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr ToolItem -> Ptr ToggleToolButton
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr ToolItem -> Ptr ToggleToolButton) (IO (Ptr ToolItem) -> IO (Ptr ToggleToolButton))
    -> IO (Ptr ToolItem) -> IO (Ptr ToggleToolButton)
    forall a b. (a -> b) -> a -> b
    $
      StockId -> (CString -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    forall a. StockId -> (CString -> IO a) -> IO a
    withUTFString StockId
    stockId ((CString -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem))
    -> (CString -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall a b. (a -> b) -> a -> b
    $ \CString
    stockIdPtr ->
      CString -> IO (Ptr ToolItem)
    gtk_toggle_tool_button_new_from_stock
    {-# LINE 116 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}
        stockIdPtr

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

    -- | Sets the status of the toggle tool button. Set to @True@ if you want the
    -- 'ToggleButton' to be \'pressed in\', and @False@ to raise it. This action
    -- causes the toggled signal to be emitted.
    --
    toggleToolButtonSetActive :: ToggleToolButtonClass self => self -> Bool -> IO ()
    toggleToolButtonSetActive :: forall self. ToggleToolButtonClass self => self -> Bool -> IO ()
    toggleToolButtonSetActive self
    self Bool
    isActive =
      (\(ToggleToolButton ForeignPtr ToggleToolButton
    arg1) CInt
    arg2 -> ForeignPtr ToggleToolButton
    -> (Ptr ToggleToolButton -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleToolButton
    arg1 ((Ptr ToggleToolButton -> IO ()) -> IO ())
    -> (Ptr ToggleToolButton -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleToolButton
    argPtr1 ->Ptr ToggleToolButton -> CInt -> IO ()
    gtk_toggle_tool_button_set_active Ptr ToggleToolButton
    argPtr1 CInt
    arg2)
    {-# LINE 128 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}
        (toToggleToolButton self)
        (Bool -> CInt
    forall a. Num a => Bool -> a
    fromBool Bool
    isActive)

    -- | Queries a 'ToggleToolButton' and returns its current state. Returns
    -- @True@ if the toggle button is pressed in and @False@ if it is raised.
    --
    toggleToolButtonGetActive :: ToggleToolButtonClass self => self -> IO Bool
    toggleToolButtonGetActive :: forall self. ToggleToolButtonClass self => self -> IO Bool
    toggleToolButtonGetActive 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
    $
      (\(ToggleToolButton ForeignPtr ToggleToolButton
    arg1) -> ForeignPtr ToggleToolButton
    -> (Ptr ToggleToolButton -> IO CInt) -> IO CInt
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ToggleToolButton
    arg1 ((Ptr ToggleToolButton -> IO CInt) -> IO CInt)
    -> (Ptr ToggleToolButton -> IO CInt) -> IO CInt
    forall a b. (a -> b) -> a -> b
    $ \Ptr ToggleToolButton
    argPtr1 ->Ptr ToggleToolButton -> IO CInt
    gtk_toggle_tool_button_get_active Ptr ToggleToolButton
    argPtr1)
    {-# LINE 138 "./Graphics/UI/Gtk/MenuComboToolbar/ToggleToolButton.chs" #-}
        (toToggleToolButton self)

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

    -- | If the toggle tool button should be pressed in or not.
    --
    -- Default value: @False@
    --
    toggleToolButtonActive :: ToggleToolButtonClass self => Attr self Bool
    toggleToolButtonActive :: forall self. ToggleToolButtonClass self => Attr self Bool
    toggleToolButtonActive = (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. ToggleToolButtonClass self => self -> IO Bool
    toggleToolButtonGetActive
      self -> Bool -> IO ()
    forall self. ToggleToolButtonClass self => self -> Bool -> IO ()
    toggleToolButtonSetActive

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

    -- | Emitted whenever the toggle tool button changes state.
    --
    onToolButtonToggled, afterToolButtonToggled :: ToggleToolButtonClass self => self
     -> IO ()
     -> IO (ConnectId self)
    onToolButtonToggled :: forall self.
    ToggleToolButtonClass self =>
    self -> IO () -> IO (ConnectId self)
    onToolButtonToggled = SignalName -> Bool -> self -> IO () -> IO (ConnectId self)
    forall obj.
    GObjectClass obj =>
    SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
    connect_NONE__NONE SignalName
    "toggled" Bool
    False
    afterToolButtonToggled :: forall self.
    ToggleToolButtonClass self =>
    self -> IO () -> IO (ConnectId self)
    afterToolButtonToggled = SignalName -> Bool -> self -> IO () -> IO (ConnectId self)
    forall obj.
    GObjectClass obj =>
    SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
    connect_NONE__NONE SignalName
    "toggled" Bool
    True

    foreign import ccall safe "gtk_toggle_tool_button_new"
      gtk_toggle_tool_button_new :: (IO (Ptr ToolItem))

    foreign import ccall safe "gtk_toggle_tool_button_new_from_stock"
      gtk_toggle_tool_button_new_from_stock :: ((Ptr CChar) -> (IO (Ptr ToolItem)))

    foreign import ccall safe "gtk_toggle_tool_button_set_active"
      gtk_toggle_tool_button_set_active :: ((Ptr ToggleToolButton) -> (CInt -> (IO ())))

    foreign import ccall safe "gtk_toggle_tool_button_get_active"
      gtk_toggle_tool_button_get_active :: ((Ptr ToggleToolButton) -> (IO CInt))