{-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
module Graphics.UI.Gtk.MenuComboToolbar.OptionMenu (
OptionMenu,
OptionMenuClass,
castToOptionMenu, gTypeOptionMenu,
toOptionMenu,
optionMenuNew,
optionMenuGetMenu,
optionMenuSetMenu,
optionMenuRemoveMenu,
optionMenuSetHistory,
optionMenuGetHistory,
optionMenuMenu,
onOMChanged,
afterOMChanged
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Types
{-# LINE 96 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 97 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
{-# LINE 99 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
optionMenuNew :: IO OptionMenu
=
(ForeignPtr OptionMenu -> OptionMenu, FinalizerPtr OptionMenu)
-> IO (Ptr OptionMenu) -> IO OptionMenu
forall obj.
ObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr OptionMenu -> OptionMenu, FinalizerPtr OptionMenu)
forall {a}. (ForeignPtr OptionMenu -> OptionMenu, FinalizerPtr a)
mkOptionMenu (IO (Ptr OptionMenu) -> IO OptionMenu)
-> IO (Ptr OptionMenu) -> IO OptionMenu
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr OptionMenu)
-> IO (Ptr Widget) -> IO (Ptr OptionMenu)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Ptr Widget -> Ptr OptionMenu
forall a b. Ptr a -> Ptr b
castPtr
IO (Ptr Widget)
gtk_option_menu_new
{-# LINE 112 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
optionMenuGetMenu :: OptionMenuClass self => self -> IO Menu
self
self =
(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 Menu) -> IO (Ptr Menu) -> IO 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 (IO (Ptr Widget) -> IO (Ptr Menu))
-> IO (Ptr Widget) -> IO (Ptr Menu)
forall a b. (a -> b) -> a -> b
$
String -> IO (Ptr Widget) -> IO (Ptr Widget)
forall a. String -> IO (Ptr a) -> IO (Ptr a)
throwIfNull String
"optionMenuGetMenu: no menu associated with this option menu." (IO (Ptr Widget) -> IO (Ptr Widget))
-> IO (Ptr Widget) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$
(\(OptionMenu ForeignPtr OptionMenu
arg1) -> ForeignPtr OptionMenu
-> (Ptr OptionMenu -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr OptionMenu
arg1 ((Ptr OptionMenu -> IO (Ptr Widget)) -> IO (Ptr Widget))
-> (Ptr OptionMenu -> IO (Ptr Widget)) -> IO (Ptr Widget)
forall a b. (a -> b) -> a -> b
$ \Ptr OptionMenu
argPtr1 ->Ptr OptionMenu -> IO (Ptr Widget)
gtk_option_menu_get_menu Ptr OptionMenu
argPtr1)
{-# LINE 124 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
(toOptionMenu self)
optionMenuSetMenu :: (OptionMenuClass self, MenuClass menu) => self -> menu -> IO ()
self
self menu
menu =
(\(OptionMenu ForeignPtr OptionMenu
arg1) (Widget ForeignPtr Widget
arg2) -> ForeignPtr OptionMenu -> (Ptr OptionMenu -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr OptionMenu
arg1 ((Ptr OptionMenu -> IO ()) -> IO ())
-> (Ptr OptionMenu -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr OptionMenu
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 OptionMenu -> Ptr Widget -> IO ()
gtk_option_menu_set_menu Ptr OptionMenu
argPtr1 Ptr Widget
argPtr2)
{-# LINE 133 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
(toOptionMenu self)
(menu -> Widget
forall o. WidgetClass o => o -> Widget
toWidget menu
menu)
optionMenuRemoveMenu :: OptionMenuClass self => self -> IO ()
self
self =
(\(OptionMenu ForeignPtr OptionMenu
arg1) -> ForeignPtr OptionMenu -> (Ptr OptionMenu -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr OptionMenu
arg1 ((Ptr OptionMenu -> IO ()) -> IO ())
-> (Ptr OptionMenu -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr OptionMenu
argPtr1 ->Ptr OptionMenu -> IO ()
gtk_option_menu_remove_menu Ptr OptionMenu
argPtr1)
{-# LINE 141 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
(toOptionMenu self)
optionMenuSetHistory :: OptionMenuClass self => self
-> Int
-> IO ()
self
self Int
index =
(\(OptionMenu ForeignPtr OptionMenu
arg1) CUInt
arg2 -> ForeignPtr OptionMenu -> (Ptr OptionMenu -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr OptionMenu
arg1 ((Ptr OptionMenu -> IO ()) -> IO ())
-> (Ptr OptionMenu -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr OptionMenu
argPtr1 ->Ptr OptionMenu -> CUInt -> IO ()
gtk_option_menu_set_history Ptr OptionMenu
argPtr1 CUInt
arg2)
{-# LINE 152 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
(toOptionMenu self)
(Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral Int
index)
optionMenuGetHistory :: OptionMenuClass self => self
-> IO Int
self
self =
(CInt -> Int) -> IO CInt -> IO Int
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral (IO CInt -> IO Int) -> IO CInt -> IO Int
forall a b. (a -> b) -> a -> b
$
(\(OptionMenu ForeignPtr OptionMenu
arg1) -> ForeignPtr OptionMenu -> (Ptr OptionMenu -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr OptionMenu
arg1 ((Ptr OptionMenu -> IO CInt) -> IO CInt)
-> (Ptr OptionMenu -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr OptionMenu
argPtr1 ->Ptr OptionMenu -> IO CInt
gtk_option_menu_get_history Ptr OptionMenu
argPtr1)
{-# LINE 164 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
(toOptionMenu self)
optionMenuMenu :: (OptionMenuClass self, MenuClass menu) => ReadWriteAttr self Menu menu
= String -> CUInt -> ReadWriteAttr self Menu menu
forall gobj gobj' gobj''.
(GObjectClass gobj, GObjectClass gobj', GObjectClass gobj'') =>
String -> CUInt -> ReadWriteAttr gobj gobj' gobj''
newAttrFromObjectProperty String
"menu"
CUInt
gtk_menu_get_type
{-# LINE 174 "./Graphics/UI/Gtk/MenuComboToolbar/OptionMenu.chs" #-}
onOMChanged, afterOMChanged :: OptionMenuClass self => self
-> IO ()
-> IO (ConnectId self)
onOMChanged :: forall self.
OptionMenuClass self =>
self -> IO () -> IO (ConnectId self)
onOMChanged = String -> ConnectAfter -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> ConnectAfter -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"changed" ConnectAfter
False
afterOMChanged :: forall self.
OptionMenuClass self =>
self -> IO () -> IO (ConnectId self)
afterOMChanged = String -> ConnectAfter -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
String -> ConnectAfter -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE String
"changed" ConnectAfter
True
foreign import ccall unsafe "gtk_option_menu_new"
:: (IO (Ptr Widget))
foreign import ccall unsafe "gtk_option_menu_get_menu"
:: ((Ptr OptionMenu) -> (IO (Ptr Widget)))
foreign import ccall safe "gtk_option_menu_set_menu"
:: ((Ptr OptionMenu) -> ((Ptr Widget) -> (IO ())))
foreign import ccall unsafe "gtk_option_menu_remove_menu"
:: ((Ptr OptionMenu) -> (IO ()))
foreign import ccall safe "gtk_option_menu_set_history"
:: ((Ptr OptionMenu) -> (CUInt -> (IO ())))
foreign import ccall unsafe "gtk_option_menu_get_history"
:: ((Ptr OptionMenu) -> (IO CInt))
foreign import ccall unsafe "gtk_menu_get_type"
:: CUInt