    {-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
    -- -*-haskell-*-
    -- GIMP Toolkit (GTK) Widget ImageMenuItem
    --
    -- Author : Jonas Svensson
    --
    -- Created: 12 Aug 2002
    --
    -- Copyright (C) 2002 Jonas Svensson
    --
    -- 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.
    --
    -- TODO
    --
    -- imageMenuItemNewFromSock should also have a AccelGroup argument
    --
    -- |
    -- Maintainer : gtk2hs-users@lists.sourceforge.net
    -- Stability : provisional
    -- Portability : portable (depends on GHC)
    --
    -- A menu item with an icon
    --
    module Graphics.UI.Gtk.MenuComboToolbar.ImageMenuItem (
    -- * Detail
    --
    -- | A 'ImageMenuItem' is a menu item which has an icon next to the text
    -- label.
    --
    -- Note that the user can disable display of menu icons, so make sure to
    -- still fill in the text label.

    -- * Class Hierarchy
    -- |
    -- @
    -- | 'GObject'
    -- | +----'Object'
    -- | +----'Widget'
    -- | +----'Container'
    -- | +----'Bin'
    -- | +----'Item'
    -- | +----'MenuItem'
    -- | +----ImageMenuItem
    -- @

    -- * Types
      ImageMenuItem,
      ImageMenuItemClass,
      castToImageMenuItem, gTypeImageMenuItem,
      toImageMenuItem,

    -- * Constructors
      imageMenuItemNew,
      imageMenuItemNewFromStock,
      imageMenuItemNewWithLabel,
      imageMenuItemNewWithMnemonic,

    -- * Methods
      imageMenuItemSetImage,
      imageMenuItemGetImage,

    -- * Attributes
      imageMenuItemImage,
      ) 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 81 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
    import Graphics.UI.Gtk.General.StockItems

    {-# LINE 84 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}

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

    -- | Creates a new 'ImageMenuItem' with an empty label.
    --
    imageMenuItemNew :: IO ImageMenuItem
    imageMenuItemNew :: IO ImageMenuItem
    imageMenuItemNew =
      (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    forall {a}.
    (ForeignPtr ImageMenuItem -> ImageMenuItem, FinalizerPtr a)
    mkImageMenuItem (IO (Ptr ImageMenuItem) -> IO ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr ImageMenuItem)
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr ImageMenuItem
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr ImageMenuItem) (IO (Ptr Widget) -> IO (Ptr ImageMenuItem))
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall a b. (a -> b) -> a -> b
    $
      IO (Ptr Widget)
    gtk_image_menu_item_new
    {-# LINE 95 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}

    -- | Creates a new 'ImageMenuItem' containing the image and text from a stock
    -- item.
    --
    imageMenuItemNewFromStock ::
        StockId -- ^ @stockId@ - the name of the stock item.
     -> IO ImageMenuItem
    imageMenuItemNewFromStock :: StockId -> IO ImageMenuItem
    imageMenuItemNewFromStock StockId
    stockId =
      (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    forall {a}.
    (ForeignPtr ImageMenuItem -> ImageMenuItem, FinalizerPtr a)
    mkImageMenuItem (IO (Ptr ImageMenuItem) -> IO ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr ImageMenuItem)
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr ImageMenuItem
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr ImageMenuItem) (IO (Ptr Widget) -> IO (Ptr ImageMenuItem))
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall a b. (a -> b) -> a -> b
    $
      StockId -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    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 Widget)) -> IO (Ptr Widget))
    -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \CString
    stockIdPtr ->
      (\CString
    arg1 (AccelGroup ForeignPtr AccelGroup
    arg2) -> ForeignPtr AccelGroup
    -> (Ptr AccelGroup -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr AccelGroup
    arg2 ((Ptr AccelGroup -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (Ptr AccelGroup -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \Ptr AccelGroup
    argPtr2 ->CString -> Ptr AccelGroup -> IO (Ptr Widget)
    gtk_image_menu_item_new_from_stock CString
    arg1 Ptr AccelGroup
    argPtr2)
    {-# LINE 107 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
        stockIdPtr
        (ForeignPtr AccelGroup -> AccelGroup
    AccelGroup ForeignPtr AccelGroup
    forall a. ForeignPtr a
    nullForeignPtr)

    -- | Creates a new 'ImageMenuItem' containing a label.
    --
    imageMenuItemNewWithLabel :: GlibString string
     => string -- ^ @label@ - the text of the menu item.
     -> IO ImageMenuItem
    imageMenuItemNewWithLabel :: forall string. GlibString string => string -> IO ImageMenuItem
    imageMenuItemNewWithLabel string
    label =
      (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    forall {a}.
    (ForeignPtr ImageMenuItem -> ImageMenuItem, FinalizerPtr a)
    mkImageMenuItem (IO (Ptr ImageMenuItem) -> IO ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr ImageMenuItem)
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr ImageMenuItem
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr ImageMenuItem) (IO (Ptr Widget) -> IO (Ptr ImageMenuItem))
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall a b. (a -> b) -> a -> b
    $
      string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    label ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \CString
    labelPtr ->
      CString -> IO (Ptr Widget)
    gtk_image_menu_item_new_with_label
    {-# LINE 120 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
        labelPtr

    -- | Creates a new 'ImageMenuItem' containing a label. The label will be
    -- created using 'Graphics.UI.Gtk.Display.Label.labelNewWithMnemonic', so
    -- underscores in @label@ indicate the mnemonic for the menu item.
    --
    imageMenuItemNewWithMnemonic :: GlibString string
     => string -- ^ @label@ - the text of the menu item, with an
                         -- underscore in front of the mnemonic character
     -> IO ImageMenuItem
    imageMenuItemNewWithMnemonic :: forall string. GlibString string => string -> IO ImageMenuItem
    imageMenuItemNewWithMnemonic string
    label =
      (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr ImageMenuItem -> ImageMenuItem,
     FinalizerPtr ImageMenuItem)
    forall {a}.
    (ForeignPtr ImageMenuItem -> ImageMenuItem, FinalizerPtr a)
    mkImageMenuItem (IO (Ptr ImageMenuItem) -> IO ImageMenuItem)
    -> IO (Ptr ImageMenuItem) -> IO ImageMenuItem
    forall a b. (a -> b) -> a -> b
    $
      (Ptr Widget -> Ptr ImageMenuItem)
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
    liftM (Ptr Widget -> Ptr ImageMenuItem
    forall a b. Ptr a -> Ptr b
    castPtr :: Ptr Widget -> Ptr ImageMenuItem) (IO (Ptr Widget) -> IO (Ptr ImageMenuItem))
    -> IO (Ptr Widget) -> IO (Ptr ImageMenuItem)
    forall a b. (a -> b) -> a -> b
    $
      string -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a. string -> (CString -> IO a) -> IO a
    forall s a. GlibString s => s -> (CString -> IO a) -> IO a
    withUTFString string
    label ((CString -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (CString -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \CString
    labelPtr ->
      CString -> IO (Ptr Widget)
    gtk_image_menu_item_new_with_mnemonic
    {-# LINE 135 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
        labelPtr

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

    -- | Sets the image of the image menu item to the given widget. Note that it
    -- depends on the \"show-menu-images\" setting whether the image will be
    -- displayed or not.
    --
    imageMenuItemSetImage :: (ImageMenuItemClass self, WidgetClass image) => self
     -> image -- ^ @image@ - a widget to set as the image for the menu item.
     -> IO ()
    imageMenuItemSetImage :: forall self image.
    (ImageMenuItemClass self, WidgetClass image) =>
    self -> image -> IO ()
    imageMenuItemSetImage self
    self image
    image =
      (\(ImageMenuItem ForeignPtr ImageMenuItem
    arg1) (Widget ForeignPtr Widget
    arg2) -> ForeignPtr ImageMenuItem -> (Ptr ImageMenuItem -> IO ()) -> IO ()
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ImageMenuItem
    arg1 ((Ptr ImageMenuItem -> IO ()) -> IO ())
    -> (Ptr ImageMenuItem -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \Ptr ImageMenuItem
    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 ImageMenuItem -> Ptr Widget -> IO ()
    gtk_image_menu_item_set_image Ptr ImageMenuItem
    argPtr1 Ptr Widget
    argPtr2)
    {-# LINE 149 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
        (toImageMenuItem self)
        (image -> Widget
    forall o. WidgetClass o => o -> Widget
    toWidget image
    image)

    -- | Gets the widget that is currently set as the image.
    -- See 'imageMenuItemSetImage'.
    --
    imageMenuItemGetImage :: ImageMenuItemClass self => self
     -> IO (Maybe Widget) -- ^ returns the widget set as image of or @Nothing@ if
                          -- none has been set.
    imageMenuItemGetImage :: forall self. ImageMenuItemClass self => self -> IO (Maybe Widget)
    imageMenuItemGetImage self
    self =
      (IO (Ptr Widget) -> IO Widget)
    -> IO (Ptr Widget) -> IO (Maybe Widget)
    forall a. (IO (Ptr a) -> IO a) -> IO (Ptr a) -> IO (Maybe a)
    maybeNull ((ForeignPtr Widget -> Widget, FinalizerPtr Widget)
    -> IO (Ptr Widget) -> IO Widget
    forall obj.
    GObjectClass obj =>
    (ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
    makeNewObject (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
    forall {a}. (ForeignPtr Widget -> Widget, FinalizerPtr a)
    mkWidget) (IO (Ptr Widget) -> IO (Maybe Widget))
    -> IO (Ptr Widget) -> IO (Maybe Widget)
    forall a b. (a -> b) -> a -> b
    $
      (\(ImageMenuItem ForeignPtr ImageMenuItem
    arg1) -> ForeignPtr ImageMenuItem
    -> (Ptr ImageMenuItem -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
    withForeignPtr ForeignPtr ImageMenuItem
    arg1 ((Ptr ImageMenuItem -> IO (Ptr Widget)) -> IO (Ptr Widget))
    -> (Ptr ImageMenuItem -> IO (Ptr Widget)) -> IO (Ptr Widget)
    forall a b. (a -> b) -> a -> b
    $ \Ptr ImageMenuItem
    argPtr1 ->Ptr ImageMenuItem -> IO (Ptr Widget)
    gtk_image_menu_item_get_image Ptr ImageMenuItem
    argPtr1)
    {-# LINE 161 "./Graphics/UI/Gtk/MenuComboToolbar/ImageMenuItem.chs" #-}
        (toImageMenuItem self)

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

    -- | Child widget to appear next to the menu text.
    --
    imageMenuItemImage :: (ImageMenuItemClass self, WidgetClass image) => ReadWriteAttr self (Maybe Widget) image
    imageMenuItemImage :: forall self image.
    (ImageMenuItemClass self, WidgetClass image) =>
    ReadWriteAttr self (Maybe Widget) image
    imageMenuItemImage = (self -> IO (Maybe Widget))
    -> (self -> image -> IO ())
    -> ReadWriteAttr self (Maybe Widget) image
    forall o a b.
    (o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
    newAttr
      self -> IO (Maybe Widget)
    forall self. ImageMenuItemClass self => self -> IO (Maybe Widget)
    imageMenuItemGetImage
      self -> image -> IO ()
    forall self image.
    (ImageMenuItemClass self, WidgetClass image) =>
    self -> image -> IO ()
    imageMenuItemSetImage

    foreign import ccall unsafe "gtk_image_menu_item_new"
      gtk_image_menu_item_new :: (IO (Ptr Widget))

    foreign import ccall unsafe "gtk_image_menu_item_new_from_stock"
      gtk_image_menu_item_new_from_stock :: ((Ptr CChar) -> ((Ptr AccelGroup) -> (IO (Ptr Widget))))

    foreign import ccall unsafe "gtk_image_menu_item_new_with_label"
      gtk_image_menu_item_new_with_label :: ((Ptr CChar) -> (IO (Ptr Widget)))

    foreign import ccall unsafe "gtk_image_menu_item_new_with_mnemonic"
      gtk_image_menu_item_new_with_mnemonic :: ((Ptr CChar) -> (IO (Ptr Widget)))

    foreign import ccall unsafe "gtk_image_menu_item_set_image"
      gtk_image_menu_item_set_image :: ((Ptr ImageMenuItem) -> ((Ptr Widget) -> (IO ())))

    foreign import ccall unsafe "gtk_image_menu_item_get_image"
      gtk_image_menu_item_get_image :: ((Ptr ImageMenuItem) -> (IO (Ptr Widget)))