{-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
module Graphics.UI.Gtk.MenuComboToolbar.MenuToolButton (
MenuToolButton,
MenuToolButtonClass,
castToMenuToolButton, gTypeMenuToolButton,
toMenuToolButton,
menuToolButtonNew,
menuToolButtonNewFromStock,
menuToolButtonSetMenu,
menuToolButtonGetMenu,
menuToolButtonSetArrowTooltip,
menuToolButtonSetArrowTooltipText,
menuToolButtonSetArrowTooltipMarkup,
menuToolButtonMenu,
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" #-}
menuToolButtonNew :: (WidgetClass iconWidget, GlibString string) =>
Maybe iconWidget
-> Maybe string
-> IO MenuToolButton
Maybe iconWidget
iconWidget Maybe string
label =
(ForeignPtr MenuToolButton -> MenuToolButton,
FinalizerPtr MenuToolButton)
-> IO (Ptr MenuToolButton) -> IO MenuToolButton
forall obj.
ObjectClass 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
menuToolButtonNewFromStock ::
StockId
-> IO MenuToolButton
StockId
stockId =
(ForeignPtr MenuToolButton -> MenuToolButton,
FinalizerPtr MenuToolButton)
-> IO (Ptr MenuToolButton) -> IO MenuToolButton
forall obj.
ObjectClass 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 a. StockId -> (Ptr CChar -> IO a) -> IO a
forall s a. GlibString s => s -> (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
menuToolButtonSetMenu :: (MenuToolButtonClass self, MenuClass menu) => self
-> Maybe menu
-> IO ()
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)
menuToolButtonGetMenu :: MenuToolButtonClass self => self -> IO (Maybe Menu)
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.
ObjectClass 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)
menuToolButtonSetArrowTooltip :: (MenuToolButtonClass self, GlibString string) => self
-> Tooltips
-> string
-> string
-> IO ()
self
self Tooltips
tooltips string
tipText string
tipPrivate =
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
tipPrivate ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
tipPrivatePtr ->
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
tipText ((Ptr CChar -> IO ()) -> IO ()) -> (Ptr CChar -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr CChar
tipTextPtr ->
(\(MenuToolButton ForeignPtr MenuToolButton
arg1) (Tooltips ForeignPtr Tooltips
arg2) Ptr CChar
arg3 Ptr CChar
arg4 -> 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 Tooltips -> (Ptr Tooltips -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Tooltips
arg2 ((Ptr Tooltips -> IO ()) -> IO ())
-> (Ptr Tooltips -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Tooltips
argPtr2 ->Ptr MenuToolButton
-> Ptr Tooltips -> Ptr CChar -> Ptr CChar -> IO ()
gtk_menu_tool_button_set_arrow_tooltip Ptr MenuToolButton
argPtr1 Ptr Tooltips
argPtr2 Ptr CChar
arg3 Ptr CChar
arg4)
{-# LINE 168 "./Graphics/UI/Gtk/MenuComboToolbar/MenuToolButton.chs" #-}
(toMenuToolButton self)
Tooltips
tooltips
Ptr CChar
tipTextPtr
Ptr CChar
tipPrivatePtr
menuToolButtonSetArrowTooltipText :: (MenuToolButtonClass self, GlibString string) => self
-> string
-> IO ()
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
menuToolButtonSetArrowTooltipMarkup :: (MenuToolButtonClass self, GlibString markup) => self
-> markup
-> IO ()
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
menuToolButtonMenu :: (MenuToolButtonClass self, MenuClass menu) => ReadWriteAttr self (Maybe Menu) (Maybe menu)
= (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
onShowMenu, afterShowMenu :: MenuToolButtonClass self => self
-> IO ()
-> IO (ConnectId self)
= 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
= 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"
:: ((Ptr Widget) -> ((Ptr CChar) -> (IO (Ptr ToolItem))))
foreign import ccall safe "gtk_menu_tool_button_new_from_stock"
:: ((Ptr CChar) -> (IO (Ptr ToolItem)))
foreign import ccall safe "gtk_menu_tool_button_set_menu"
:: ((Ptr MenuToolButton) -> ((Ptr Widget) -> (IO ())))
foreign import ccall safe "gtk_menu_tool_button_get_menu"
:: ((Ptr MenuToolButton) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_menu_tool_button_set_arrow_tooltip"
:: ((Ptr MenuToolButton) -> ((Ptr Tooltips) -> ((Ptr CChar) -> ((Ptr CChar) -> (IO ())))))
foreign import ccall safe "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"
:: ((Ptr MenuToolButton) -> ((Ptr CChar) -> (IO ())))