{-# LINE 2 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
module Graphics.UI.Gtk.Misc.Switch (
Switch
, castToSwitch
, gTypeSwitch
, toSwitch
, switchNew
, switchSetActive
, switchGetActive
, switchSetState
, switchGetState
, switchActive
, switchState
, switchActivate
, stateSet
) 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 83 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
import Graphics.UI.Gtk.Signals
{-# LINE 84 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
{-# LINE 86 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
switchNew :: IO Switch
switchNew :: IO Switch
switchNew =
(ForeignPtr Switch -> Switch, FinalizerPtr Switch)
-> IO (Ptr Switch) -> IO Switch
forall obj.
GObjectClass obj =>
(ForeignPtr obj -> obj, FinalizerPtr obj) -> IO (Ptr obj) -> IO obj
makeNewObject (ForeignPtr Switch -> Switch, FinalizerPtr Switch)
forall {a}. (ForeignPtr Switch -> Switch, FinalizerPtr a)
mkSwitch (IO (Ptr Switch) -> IO Switch) -> IO (Ptr Switch) -> IO Switch
forall a b. (a -> b) -> a -> b
$
(Ptr Widget -> Ptr Switch) -> IO (Ptr Widget) -> IO (Ptr Switch)
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM (Ptr Widget -> Ptr Switch
forall a b. Ptr a -> Ptr b
castPtr :: Ptr Widget -> Ptr Switch) (IO (Ptr Widget) -> IO (Ptr Switch))
-> IO (Ptr Widget) -> IO (Ptr Switch)
forall a b. (a -> b) -> a -> b
$
IO (Ptr Widget)
gtk_switch_new
{-# LINE 97 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
switchSetActive :: SwitchClass self => self
-> Bool
-> IO ()
switchSetActive :: forall self. SwitchClass self => self -> Bool -> IO ()
switchSetActive self
self Bool
is_active =
(\(Switch ForeignPtr Switch
arg1) CInt
arg2 -> ForeignPtr Switch -> (Ptr Switch -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Switch
arg1 ((Ptr Switch -> IO ()) -> IO ()) -> (Ptr Switch -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Switch
argPtr1 ->Ptr Switch -> CInt -> IO ()
gtk_switch_set_active Ptr Switch
argPtr1 CInt
arg2)
{-# LINE 108 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
(toSwitch self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
is_active)
switchGetActive :: SwitchClass self => self
-> IO Bool
switchGetActive :: forall self. SwitchClass self => self -> IO Bool
switchGetActive self
self =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(Switch ForeignPtr Switch
arg1) -> ForeignPtr Switch -> (Ptr Switch -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Switch
arg1 ((Ptr Switch -> IO CInt) -> IO CInt)
-> (Ptr Switch -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Switch
argPtr1 ->Ptr Switch -> IO CInt
gtk_switch_get_active Ptr Switch
argPtr1)
{-# LINE 117 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
(toSwitch self)
switchSetState :: SwitchClass self => self
-> Bool
-> IO ()
switchSetState :: forall self. SwitchClass self => self -> Bool -> IO ()
switchSetState self
self Bool
state =
(\(Switch ForeignPtr Switch
arg1) CInt
arg2 -> ForeignPtr Switch -> (Ptr Switch -> IO ()) -> IO ()
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Switch
arg1 ((Ptr Switch -> IO ()) -> IO ()) -> (Ptr Switch -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Switch
argPtr1 ->Ptr Switch -> CInt -> IO ()
gtk_switch_set_state Ptr Switch
argPtr1 CInt
arg2)
{-# LINE 131 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
(toSwitch self)
(Bool -> CInt
forall a. Num a => Bool -> a
fromBool Bool
state)
switchGetState :: SwitchClass self => self
-> IO Bool
switchGetState :: forall self. SwitchClass self => self -> IO Bool
switchGetState self
self =
(CInt -> Bool) -> IO CInt -> IO Bool
forall (m :: * -> *) a1 r. Monad m => (a1 -> r) -> m a1 -> m r
liftM CInt -> Bool
forall a. (Eq a, Num a) => a -> Bool
toBool (IO CInt -> IO Bool) -> IO CInt -> IO Bool
forall a b. (a -> b) -> a -> b
$
(\(Switch ForeignPtr Switch
arg1) -> ForeignPtr Switch -> (Ptr Switch -> IO CInt) -> IO CInt
forall a b. ForeignPtr a -> (Ptr a -> IO b) -> IO b
withForeignPtr ForeignPtr Switch
arg1 ((Ptr Switch -> IO CInt) -> IO CInt)
-> (Ptr Switch -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Ptr Switch
argPtr1 ->Ptr Switch -> IO CInt
gtk_switch_get_state Ptr Switch
argPtr1)
{-# LINE 141 "./Graphics/UI/Gtk/Misc/Switch.chs" #-}
(toSwitch self)
switchActive :: SwitchClass self => Attr self Bool
switchActive :: forall self. SwitchClass self => Attr self Bool
switchActive = (self -> IO Bool)
-> (self -> Bool -> IO ()) -> ReadWriteAttr self Bool Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO Bool
forall self. SwitchClass self => self -> IO Bool
switchGetActive
self -> Bool -> IO ()
forall self. SwitchClass self => self -> Bool -> IO ()
switchSetActive
switchState :: SwitchClass self => Attr self Bool
switchState :: forall self. SwitchClass self => Attr self Bool
switchState = (self -> IO Bool)
-> (self -> Bool -> IO ()) -> ReadWriteAttr self Bool Bool
forall o a b.
(o -> IO a) -> (o -> b -> IO ()) -> ReadWriteAttr o a b
newAttr
self -> IO Bool
forall self. SwitchClass self => self -> IO Bool
switchGetState
self -> Bool -> IO ()
forall self. SwitchClass self => self -> Bool -> IO ()
switchSetState
switchActivate :: SwitchClass self => Signal self (IO ())
switchActivate :: forall self. SwitchClass self => Signal self (IO ())
switchActivate = (Bool -> self -> IO () -> IO (ConnectId self))
-> Signal self (IO ())
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName -> Bool -> self -> IO () -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName -> Bool -> obj -> IO () -> IO (ConnectId obj)
connect_NONE__NONE SignalName
"activate")
stateSet :: SwitchClass self => Signal self (Bool -> IO Bool)
stateSet :: forall self. SwitchClass self => Signal self (Bool -> IO Bool)
stateSet = (Bool -> self -> (Bool -> IO Bool) -> IO (ConnectId self))
-> Signal self (Bool -> IO Bool)
forall object handler.
(Bool -> object -> handler -> IO (ConnectId object))
-> Signal object handler
Signal (SignalName
-> Bool -> self -> (Bool -> IO Bool) -> IO (ConnectId self)
forall obj.
GObjectClass obj =>
SignalName
-> Bool -> obj -> (Bool -> IO Bool) -> IO (ConnectId obj)
connect_BOOL__BOOL SignalName
"state-set")
foreign import ccall unsafe "gtk_switch_new"
gtk_switch_new :: (IO (Ptr Widget))
foreign import ccall safe "gtk_switch_set_active"
gtk_switch_set_active :: ((Ptr Switch) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_switch_get_active"
gtk_switch_get_active :: ((Ptr Switch) -> (IO CInt))
foreign import ccall safe "gtk_switch_set_state"
gtk_switch_set_state :: ((Ptr Switch) -> (CInt -> (IO ())))
foreign import ccall safe "gtk_switch_get_state"
gtk_switch_get_state :: ((Ptr Switch) -> (IO CInt))