    {-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget MenuToolButton
    --
    -- 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 button with an additional dropdown menu
    --
    -- * Module available since Gtk+ version 2.6
    --
    module Graphics.UI.Gtk.MenuComboToolbar.MenuToolButton (
    -- * Detail
    --
    -- | A 'MenuToolButton' is a 'ToolItem' that contains a button and a small
    -- additional button with an arrow. When clicked, the arrow button pops up a
    -- dropdown menu.
    --
    -- Use 'menuToolButtonNew' to create a new 'MenuToolButton'. Use
    -- 'menuToolButtonNewFromStock' to create a new 'MenuToolButton' containing a
    -- stock item.

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

    -- * Types
      MenuToolButton,
      MenuToolButtonClass,
      castToMenuToolButton, gTypeMenuToolButton,
      toMenuToolButton,

    -- * Constructors
      menuToolButtonNew,
      menuToolButtonNewFromStock,

    -- * Methods
      menuToolButtonSetMenu,
      menuToolButtonGetMenu,

      menuToolButtonSetArrowTooltipText,
      menuToolButtonSetArrowTooltipMarkup,

    -- * Attributes
      menuToolButtonMenu,

    -- * Signals
      onShowMenu,
      afterShowMenu,

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

    {-# LINE 96 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}

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

    -- | Creates a new 'MenuToolButton' using @iconWidget@ as icon and @label@ as
    -- label.
    --
    menuToolButtonNew :: (WidgetClass iconWidget, GlibString string) =>
        Maybe iconWidget -- ^ @iconWidget@ - a widget that will be used as icon
                          -- widget, or @Nothing@
     -> Maybe string -- ^ @label@ - a string that will be used as label, or
                          -- @Nothing@
     -> IO MenuToolButton
    menuToolButtonNew :: forall iconWidget string.
    (WidgetClass iconWidget, GlibString string) =>
    Maybe iconWidget -> Maybe string -> IO MenuToolButton
    menuToolButtonNew Maybe iconWidget
    iconWidget Maybe string
    label =
      (ForeignPtr MenuToolButton -> MenuToolButton,
     FinalizerPtr MenuToolButton)
    -> IO (Ptr MenuToolButton) -> IO MenuToolButton
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr MenuToolButton -> MenuToolButton,
     FinalizerPtr MenuToolButton)
    forall {a}.
    (ForeignPtr MenuToolButton -> MenuToolButton, FinalizerPtr a)
    mkMenuToolButton (IO (Ptr MenuToolButton) -> IO MenuToolButton)
    -> IO (Ptr MenuToolButton) -> IO MenuToolButton
    forall a b. (a -> b) -> a -> b
    $
      (Ptr ToolItem -> Ptr MenuToolButton)
    -> IO (Ptr ToolItem) -> IO (Ptr MenuToolButton)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr ToolItem -> Ptr MenuToolButton
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr ToolItem -> Ptr MenuToolButton) (IO (Ptr ToolItem) -> IO (Ptr MenuToolButton))
    -> IO (Ptr ToolItem) -> IO (Ptr MenuToolButton)
    forall a b. (a -> b) -> a -> b
    $
      (string -> (Ptr CChar -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem))
    -> Maybe string
    -> (Ptr CChar -> IO (Ptr ToolItem))
    -> IO (Ptr ToolItem)
    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 ToolItem)) -> IO (Ptr ToolItem)
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString Maybe string
    label ((Ptr CChar -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem))
    -> (Ptr CChar -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    labelPtr ->
      (\(Widget ForeignPtr Widget
    arg1) Ptr CChar
    arg2 -> ForeignPtr Widget
    -> (Ptr Widget -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Widget
    arg1 ((Ptr Widget -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem))
    -> (Ptr Widget -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall a b. (a -> b) -> a -> b
    $ \Ptr Widget
    argPtr1 ->Ptr Widget -> Ptr CChar -> IO (Ptr ToolItem)
    gtk_menu_tool_button_new Ptr Widget
    argPtr1 Ptr CChar
    arg2)
    {-# LINE 115 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
        (maybe (Widget nullForeignPtr) toWidget iconWidget)
        Ptr CChar
    labelPtr

    -- | Creates a new 'MenuToolButton'. The new 'MenuToolButton' will contain an
    -- icon and label from the stock item indicated by @stockId@.
    --
    menuToolButtonNewFromStock ::
        StockId -- ^ @stockId@ - the name of a stock item
     -> IO MenuToolButton
    menuToolButtonNewFromStock :: StockId -> IO MenuToolButton
    menuToolButtonNewFromStock StockId
    stockId =
      (ForeignPtr MenuToolButton -> MenuToolButton,
     FinalizerPtr MenuToolButton)
    -> IO (Ptr MenuToolButton) -> IO MenuToolButton
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr MenuToolButton -> MenuToolButton,
     FinalizerPtr MenuToolButton)
    forall {a}.
    (ForeignPtr MenuToolButton -> MenuToolButton, FinalizerPtr a)
    mkMenuToolButton (IO (Ptr MenuToolButton) -> IO MenuToolButton)
    -> IO (Ptr MenuToolButton) -> IO MenuToolButton
    forall a b. (a -> b) -> a -> b
    $
      (Ptr ToolItem -> Ptr MenuToolButton)
    -> IO (Ptr ToolItem) -> IO (Ptr MenuToolButton)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr ToolItem -> Ptr MenuToolButton
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr ToolItem -> Ptr MenuToolButton) (IO (Ptr ToolItem) -> IO (Ptr MenuToolButton))
    -> IO (Ptr ToolItem) -> IO (Ptr MenuToolButton)
    forall a b. (a -> b) -> a -> b
    $
      StockId -> (Ptr CChar -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    forall a. StockId -> (Ptr CChar -> IO a) -> IO a
    withUTFString StockId
    stockId ((Ptr CChar -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem))
    -> (Ptr CChar -> IO (Ptr ToolItem)) -> IO (Ptr ToolItem)
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    stockIdPtr ->
      Ptr CChar -> IO (Ptr ToolItem)
    gtk_menu_tool_button_new_from_stock
    {-# LINE 129 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
        stockIdPtr

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

    -- | Sets the 'Menu' that is popped up when the user clicks on the arrow. If
    -- @menu@ is @Nothing@, the arrow button becomes insensitive.
    --
    menuToolButtonSetMenu :: (MenuToolButtonClass self, MenuClass menu) => self
     -> Maybe menu -- ^ @menu@ - the 'Menu' associated with 'MenuToolButton'
     -> IO ()
    menuToolButtonSetMenu :: forall self menu.
    (MenuToolButtonClass self, MenuClass menu) =>
    self -> Maybe menu -> IO ()
    menuToolButtonSetMenu self
    self Maybe menu
    menu =
      (\(MenuToolButton ForeignPtr MenuToolButton
    arg1) (Widget ForeignPtr Widget
    arg2) -> ForeignPtr MenuToolButton -> (Ptr MenuToolButton -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr MenuToolButton
    arg1 ((Ptr MenuToolButton -> IO ()) -> IO ())
    -> (Ptr MenuToolButton -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr MenuToolButton
    argPtr1 ->ForeignPtr Widget -> (Ptr Widget -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr Widget
    arg2 ((Ptr Widget -> IO ()) -> IO ()) -> (Ptr Widget -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr Widget
    argPtr2 ->Ptr MenuToolButton -> Ptr Widget -> IO ()
    gtk_menu_tool_button_set_menu Ptr MenuToolButton
    argPtr1 Ptr Widget
    argPtr2)
    {-# LINE 142 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
        (toMenuToolButton self)
        (Widget -> (menu -> Widget) -> Maybe menu -> Widget
    forall b a. b -> (a -> b) -> Maybe a -> b
    maybe (ForeignPtr Widget -> Widget
    Widget ForeignPtr Widget
    forall a. ForeignPtr a
    nullForeignPtr) menu -> Widget
    forall o. WidgetClass o => o -> Widget
    toWidget Maybe menu
    menu)

    -- | Gets the 'Menu' associated with 'MenuToolButton'.
    --
    menuToolButtonGetMenu :: MenuToolButtonClass self => self -> IO (Maybe Menu)
    menuToolButtonGetMenu :: forall self. MenuToolButtonClass self => self -> IO (Maybe Menu)
    menuToolButtonGetMenu self
    self =
      (IO (Ptr Menu) -> IO Menu) -> IO (Ptr Menu) -> IO (Maybe Menu)
    forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
    maybeNull ((ForeignPtr Menu -> Menu, FinalizerPtr Menu)
    -> IO (Ptr Menu) -> IO Menu
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr Menu -> Menu, FinalizerPtr Menu)
    forall {a}. (ForeignPtr Menu -> Menu, FinalizerPtr a)
    mkMenu) (IO (Ptr Menu) -> IO (Maybe Menu))
    -> IO (Ptr Menu) -> IO (Maybe Menu)
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr Menu) -> IO (Ptr Widget) -> IO (Ptr Menu)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr Menu
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr Menu) (IO (Ptr Widget) -> IO (Ptr Menu))
    -> IO (Ptr Widget) -> IO (Ptr Menu)
    forall a b. (a -> b) -> a -> b
    $
      (\(MenuToolButton ForeignPtr MenuToolButton
    arg1) -> ForeignPtr MenuToolButton
    -> (Ptr MenuToolButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr MenuToolButton
    arg1 ((Ptr MenuToolButton -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (Ptr MenuToolButton -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \Ptr MenuToolButton
    argPtr1 ->Ptr MenuToolButton -> IO (Ptr Widget)
    gtk_menu_tool_button_get_menu Ptr MenuToolButton
    argPtr1)
    {-# LINE 152 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
        (toMenuToolButton self)
    {-# LINE 175 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
    -- | Sets the tooltip text to be used as tooltip for the arrow button which
    -- pops up the menu. See 'toolItemSetTooltip' for setting a tooltip on the
    -- whole 'MenuToolButton'.
    --
    -- * Available since Gtk+ version 2.12
    --
    menuToolButtonSetArrowTooltipText :: (MenuToolButtonClass self, GlibString string) => self
     -> string -- ^ @text@ - text to be used as tooltip text for button's arrow
               -- button
     -> IO ()
    menuToolButtonSetArrowTooltipText :: forall self string.
    (MenuToolButtonClass self, GlibString string) =>
    self -> string -> IO ()
    menuToolButtonSetArrowTooltipText self
    self string
    text =
      string -> (Ptr CChar -> IO ()) -> IO ()
    forall a. string -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString string
    text ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    textPtr ->
      (\(MenuToolButton ForeignPtr MenuToolButton
    arg1) Ptr CChar
    arg2 -> ForeignPtr MenuToolButton -> (Ptr MenuToolButton -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr MenuToolButton
    arg1 ((Ptr MenuToolButton -> IO ()) -> IO ())
    -> (Ptr MenuToolButton -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr MenuToolButton
    argPtr1 ->Ptr MenuToolButton -> Ptr CChar -> IO ()
    gtk_menu_tool_button_set_arrow_tooltip_text Ptr MenuToolButton
    argPtr1 Ptr CChar
    arg2)
    {-# LINE 188 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
        (toMenuToolButton self)
        Ptr CChar
    textPtr

    -- | Sets the tooltip markup text to be used as tooltip for the arrow button
    -- which pops up the menu. See 'toolItemSetTooltip' for setting a tooltip on
    -- the whole 'MenuToolButton'.
    --
    -- * Available since Gtk+ version 2.12
    --
    menuToolButtonSetArrowTooltipMarkup :: (MenuToolButtonClass self, GlibString markup) => self
     -> markup -- ^ @markup@ - markup text to be used as tooltip text for button's
               -- arrow button
     -> IO ()
    menuToolButtonSetArrowTooltipMarkup :: forall self string.
    (MenuToolButtonClass self, GlibString string) =>
    self -> string -> IO ()
    menuToolButtonSetArrowTooltipMarkup self
    self markup
    markup =
      markup -> (Ptr CChar -> IO ()) -> IO ()
    forall a. markup -> (Ptr CChar -> IO a) -> IO a
    forall s a. GlibString s => s -> (Ptr CChar -> IO a) -> IO a
    withUTFString markup
    markup ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr CChar
    markupPtr ->
      (\(MenuToolButton ForeignPtr MenuToolButton
    arg1) Ptr CChar
    arg2 -> ForeignPtr MenuToolButton -> (Ptr MenuToolButton -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr MenuToolButton
    arg1 ((Ptr MenuToolButton -> IO ()) -> IO ())
    -> (Ptr MenuToolButton -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr MenuToolButton
    argPtr1 ->Ptr MenuToolButton -> Ptr CChar -> IO ()
    gtk_menu_tool_button_set_arrow_tooltip_markup Ptr MenuToolButton
    argPtr1 Ptr CChar
    arg2)
    {-# LINE 204 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
        (toMenuToolButton self)
        Ptr CChar
    markupPtr

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

    -- | The dropdown menu.
    --
    menuToolButtonMenu :: (MenuToolButtonClass self, MenuClass menu) => ReadWriteAttr self (Maybe Menu) (Maybe menu)
    menuToolButtonMenu :: forall self menu.
    (MenuToolButtonClass self, MenuClass menu) =>
    ReadWriteAttr self (Maybe Menu) (Maybe menu)
    menuToolButtonMenu = (self -> IO (Maybe Menu))
    -> (self -> Maybe menu -> IO ())
    -> ReadWriteAttr self (Maybe Menu) (Maybe menu)
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      self -> IO (Maybe Menu)
    forall self. MenuToolButtonClass self => self -> IO (Maybe Menu)
    menuToolButtonGetMenu
      self -> Maybe menu -> IO ()
    forall self menu.
    (MenuToolButtonClass self, MenuClass menu) =>
    self -> Maybe menu -> IO ()
    menuToolButtonSetMenu

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

    -- |
    --
    onShowMenu, afterShowMenu :: MenuToolButtonClass self => self
     -> IO ()
     -> IO (ConnectId self)
    onShowMenu :: forall self.
    MenuToolButtonClass self =>
    self -> IO () -> IO (ConnectId self)
    onShowMenu = SignalName -> ConnectAfter -> self -> IO () -> IO (ConnectId self)
    forall obj.
    GObjectClass obj =>
    SignalName -> ConnectAfter -> obj -> IO () -> IO (ConnectId obj)
    connect_NONE__NONE SignalName
    "show-menu" ConnectAfter
    False
    afterShowMenu :: forall self.
    MenuToolButtonClass self =>
    self -> IO () -> IO (ConnectId self)
    afterShowMenu = SignalName -> ConnectAfter -> self -> IO () -> IO (ConnectId self)
    forall obj.
    GObjectClass obj =>
    SignalName -> ConnectAfter -> obj -> IO () -> IO (ConnectId obj)
    connect_NONE__NONE SignalName
    "show-menu" ConnectAfter
    True

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

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

    foreign import ccall safe "gtk_menu_tool_button_set_menu"
      gtk_menu_tool_button_set_menu :: ((Ptr MenuToolButton) -> ((Ptr Widget) -> (IO ())))

    foreign import ccall safe "gtk_menu_tool_button_get_menu"
      gtk_menu_tool_button_get_menu :: ((Ptr MenuToolButton) -> (IO (Ptr Widget)))

    foreign import ccall safe "gtk_menu_tool_button_set_arrow_tooltip_text"
      gtk_menu_tool_button_set_arrow_tooltip_text :: ((Ptr MenuToolButton) -> ((Ptr CChar) -> (IO ())))

    foreign import ccall safe "gtk_menu_tool_button_set_arrow_tooltip_markup"
      gtk_menu_tool_button_set_arrow_tooltip_markup :: ((Ptr MenuToolButton) -> ((Ptr CChar) -> (IO ())))