{-# LINE 2 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
module Graphics.UI.Gtk.MenuComboToolbar.Combo (
Combo,
ComboClass,
castToCombo, gTypeCombo,
toCombo,
comboNew,
comboSetPopdownStrings,
comboSetValueInList,
comboSetUseArrows,
comboSetUseArrowsAlways,
comboSetCaseSensitive,
comboDisableActivate,
comboEnableArrowKeys,
comboEnableArrowsAlways,
comboCaseSensitive,
comboAllowEmpty,
comboValueInList,
) where
import Control.Monad (liftM)
import System.Glib.FFI
import System.Glib.UTFString
import System.Glib.Attributes
import System.Glib.Properties
import Graphics.UI.Gtk.Abstract.Object (makeNewObject)
import Graphics.UI.Gtk.Abstract.Widget (widgetShow)
import Graphics.UI.Gtk.Abstract.Container (containerAdd)
import Graphics.UI.Gtk.Types
{-# LINE 107 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
import Graphics.UI.Gtk.General.Structs (comboGetList)
{-# LINE 113 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
comboNew :: IO Combo
comboNew :: IO Combo
comboNew =
(ForeignPtr Combo -> Combo, FinalizerPtr Combo)
-> IO (Ptr Combo) -> IO Combo
forall obj.
ObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Combo -> Combo, FinalizerPtr Combo)
forall {a}. (ForeignPtr Combo -> Combo, FinalizerPtr a)
mkCombo (IO (Ptr Combo) -> IO Combo) -> IO (Ptr Combo) -> IO Combo
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr Combo) -> IO (Ptr Widget) -> IO (Ptr Combo)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Ptr Widget -> Ptr Combo
forall a b. Ptr a -> Ptr b
castPtr (IO (Ptr Widget) -> IO (Ptr Combo))
-> IO (Ptr Widget) -> IO (Ptr Combo)
forall a b. (a -> b) -> a -> b
$
IO (Ptr Widget)
gtk_combo_new
{-# LINE 125 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
comboSetPopdownStrings :: (ComboClass self, GlibString string) => self -> [string] -> IO ()
comboSetPopdownStrings :: forall self string.
(ComboClass self, GlibString string) =>
self -> [string] -> IO ()
comboSetPopdownStrings self
self [string]
strs = do
List
list <- Combo -> IO List
comboGetList (self -> Combo
forall o. ComboClass o => o -> Combo
toCombo self
self)
(\(List ForeignPtr List
arg1) CInt
arg2 CInt
arg3 -> ForeignPtr List -> (Ptr List -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr List
arg1 ((Ptr List -> IO ()) -> IO ()) -> (Ptr List -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr List
argPtr1 ->Ptr List -> CInt -> CInt -> IO ()
gtk_list_clear_items Ptr List
argPtr1 CInt
arg2 CInt
arg3) List
list CInt
0 (-CInt
1)
(string -> IO ()) -> [string] -> IO ()
forall (t :: * -> *) (m :: * -> *) a b.
(Foldable t, Monad m) =>
(a -> m b) -> t a -> m ()
mapM_ (\string
str -> do
Widget
li <- (ForeignPtr Widget -> Widget, FinalizerPtr Widget)
-> IO (Ptr Widget) -> IO Widget
forall obj.
ObjectClass 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 Widget) -> IO (Ptr Widget) -> IO Widget
forall a b. (a -> b) -> a -> b
$ (Ptr Widget -> Ptr Widget) -> IO (Ptr Widget) -> IO (Ptr Widget)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM Ptr Widget -> Ptr Widget
forall a b. Ptr a -> Ptr b
castPtr (IO (Ptr Widget) -> IO (Ptr Widget))
-> IO (Ptr Widget) -> IO (Ptr Widget)
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
str CString -> IO (Ptr Widget)
gtk_list_item_new_with_label
{-# LINE 139 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
widgetShow li
List -> Widget -> IO ()
forall self widget.
(ContainerClass self, WidgetClass widget) =>
self -> widget -> IO ()
containerAdd List
list Widget
li)
[string]
strs
comboSetValueInList :: ComboClass self => self
-> Bool
-> Bool
-> IO ()
comboSetValueInList :: forall self. ComboClass self => self -> Bool -> Bool -> IO ()
comboSetValueInList self
self Bool
val Bool
okIfEmpty =
(\(Combo ForeignPtr Combo
arg1) CInt
arg2 CInt
arg3 -> ForeignPtr Combo -> (Ptr Combo -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Combo
arg1 ((Ptr Combo -> IO ()) -> IO ()) -> (Ptr Combo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Combo
argPtr1 ->Ptr Combo -> CInt -> CInt -> IO ()
gtk_combo_set_value_in_list Ptr Combo
argPtr1 CInt
arg2 CInt
arg3)
{-# LINE 157 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
(toCombo self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
val)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
okIfEmpty)
comboSetUseArrows :: ComboClass self => self -> Bool -> IO ()
comboSetUseArrows :: forall self. ComboClass self => self -> Bool -> IO ()
comboSetUseArrows self
self Bool
val =
(\(Combo ForeignPtr Combo
arg1) CInt
arg2 -> ForeignPtr Combo -> (Ptr Combo -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Combo
arg1 ((Ptr Combo -> IO ()) -> IO ()) -> (Ptr Combo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Combo
argPtr1 ->Ptr Combo -> CInt -> IO ()
gtk_combo_set_use_arrows Ptr Combo
argPtr1 CInt
arg2)
{-# LINE 167 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
(toCombo self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
val)
comboSetUseArrowsAlways :: ComboClass self => self -> Bool -> IO ()
comboSetUseArrowsAlways :: forall self. ComboClass self => self -> Bool -> IO ()
comboSetUseArrowsAlways self
self Bool
val =
(\(Combo ForeignPtr Combo
arg1) CInt
arg2 -> ForeignPtr Combo -> (Ptr Combo -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Combo
arg1 ((Ptr Combo -> IO ()) -> IO ()) -> (Ptr Combo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Combo
argPtr1 ->Ptr Combo -> CInt -> IO ()
gtk_combo_set_use_arrows_always Ptr Combo
argPtr1 CInt
arg2)
{-# LINE 175 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
(toCombo self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
val)
comboSetCaseSensitive :: ComboClass self => self -> Bool -> IO ()
comboSetCaseSensitive :: forall self. ComboClass self => self -> Bool -> IO ()
comboSetCaseSensitive self
self Bool
val =
(\(Combo ForeignPtr Combo
arg1) CInt
arg2 -> ForeignPtr Combo -> (Ptr Combo -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Combo
arg1 ((Ptr Combo -> IO ()) -> IO ()) -> (Ptr Combo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Combo
argPtr1 ->Ptr Combo -> CInt -> IO ()
gtk_combo_set_case_sensitive Ptr Combo
argPtr1 CInt
arg2)
{-# LINE 188 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
(toCombo self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
val)
comboDisableActivate :: ComboClass self => self -> IO ()
comboDisableActivate :: forall self. ComboClass self => self -> IO ()
comboDisableActivate self
self =
(\(Combo ForeignPtr Combo
arg1) -> ForeignPtr Combo -> (Ptr Combo -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Combo
arg1 ((Ptr Combo -> IO ()) -> IO ()) -> (Ptr Combo -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Combo
argPtr1 ->Ptr Combo -> IO ()
gtk_combo_disable_activate Ptr Combo
argPtr1)
{-# LINE 199 "./Graphics/UI/Gtk/MenuComboToolbar/Combo.chs" #-}
(toCombo self)
comboEnableArrowKeys :: ComboClass self => Attr self Bool
comboEnableArrowKeys :: forall self. ComboClass self => Attr self Bool
comboEnableArrowKeys = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"enable-arrow-keys"
comboEnableArrowsAlways :: ComboClass self => Attr self Bool
comboEnableArrowsAlways :: forall self. ComboClass self => Attr self Bool
comboEnableArrowsAlways = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"enable-arrows-always"
comboCaseSensitive :: ComboClass self => Attr self Bool
comboCaseSensitive :: forall self. ComboClass self => Attr self Bool
comboCaseSensitive = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"case-sensitive"
comboAllowEmpty :: ComboClass self => Attr self Bool
comboAllowEmpty :: forall self. ComboClass self => Attr self Bool
comboAllowEmpty = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"allow-empty"
comboValueInList :: ComboClass self => Attr self Bool
comboValueInList :: forall self. ComboClass self => Attr self Bool
comboValueInList = String -> Attr self Bool
forall gobj. GObjectClass gobj => String -> Attr gobj Bool
newAttrFromBoolProperty String
"value-in-list"
foreign import ccall unsafe "gtk_combo_new"
gtk_combo_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_list_clear_items"
gtk_list_clear_items :: ((Ptr List) -> (CInt -> (CInt -> (IO ()))))
foreign import ccall unsafe "gtk_list_item_new_with_label"
gtk_list_item_new_with_label :: ((Ptr CChar) -> (IO (Ptr Widget)))
foreign import ccall unsafe "gtk_combo_set_value_in_list"
gtk_combo_set_value_in_list :: ((Ptr Combo) -> (CInt -> (CInt -> (IO ()))))
foreign import ccall unsafe "gtk_combo_set_use_arrows"
gtk_combo_set_use_arrows :: ((Ptr Combo) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_combo_set_use_arrows_always"
gtk_combo_set_use_arrows_always :: ((Ptr Combo) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_combo_set_case_sensitive"
gtk_combo_set_case_sensitive :: ((Ptr Combo) -> (CInt -> (IO ())))
foreign import ccall unsafe "gtk_combo_disable_activate"
gtk_combo_disable_activate :: ((Ptr Combo) -> (IO ()))