glib-0.13.10.0: Binding to the GLIB library for Gtk2Hs.

Safe Haskell | Safe-Inferred
Language | Haskell98

System.Glib.Signals

Synopsis

- newtype Signal object handler = Signal (Bool -> object -> handler -> IO (ConnectId object))
- on :: object -> Signal object callback -> callback -> IO (ConnectId object)
- after :: object -> Signal object callback -> callback -> IO (ConnectId object)
- type SignalName = String
- data GSignalMatchType
  - = SignalMatchId
  - | SignalMatchDetail
  - | SignalMatchClosure
  - | SignalMatchFunc
  - | SignalMatchData
  - | SignalMatchUnblocked
- type ConnectAfter = Bool
- data GObjectClass o => ConnectId o = ConnectId CULong o
- signalDisconnect :: GObjectClass obj => ConnectId obj -> IO ()
- signalBlock :: GObjectClass obj => ConnectId obj -> IO ()
- signalBlockMatched :: GObjectClass obj => obj -> [GSignalMatchType] -> SignalName -> GType -> Quark -> Maybe GClosure -> Maybe (Ptr ()) -> Maybe (Ptr ()) -> IO Int
- signalUnblock :: GObjectClass obj => ConnectId obj -> IO ()
- signalStopEmission :: GObjectClass obj => obj -> SignalName -> IO ()
- disconnect :: GObjectClass obj => ConnectId obj -> IO ()
- data GClosure
- connectGeneric :: GObjectClass obj => SignalName -> ConnectAfter -> obj -> handler -> IO (ConnectId obj)

# Documentation

newtype Signal object handler Source #

Constructors

Signal (Bool -> object -> handler -> IO (ConnectId object)) |

on :: object -> Signal object callback -> callback -> IO (ConnectId object) Source #

Perform an action in response to a signal.

Use it like this:

    on obj sig $ do
    ...

or if the signal handler takes any arguments:

    on obj sig $ \args -> do
    ...

after :: object -> Signal object callback -> callback -> IO (ConnectId object) Source #

Perform an action in response to a signal.

- Like `on` but the signal is executed after Gtk's default handler has run.

type SignalName = String Source #

data GSignalMatchType Source #

Constructors

SignalMatchId |
SignalMatchDetail |
SignalMatchClosure |
SignalMatchFunc |
SignalMatchData |
SignalMatchUnblocked |

#### Instances

Instances details

Bounded GSignalMatchType Source # |
Instance details Defined in System.Glib.Signals Methods minBound :: GSignalMatchType Source # maxBound :: GSignalMatchType Source #

Enum GSignalMatchType Source #

Blocks all handlers on an instance that match a certain selection criteria. The criteria mask is passed as a list of `GSignalMatchType` flags, and the criteria values are passed as arguments. Passing at least one of the `SignalMatchClosure`, `SignalMatchFunc` or `SignalMatchData` match flags is required for successful matches. If no handlers were found, 0 is returned, the number of blocked handlers otherwise.

Instance details

Defined in System.Glib.Signals

Methods

succ :: GSignalMatchType -> GSignalMatchType Source #

pred :: GSignalMatchType -> GSignalMatchType Source #

toEnum :: Int -> GSignalMatchType Source #

fromEnum :: GSignalMatchType -> Int Source #

enumFrom :: GSignalMatchType -> [GSignalMatchType] Source #

enumFromThen :: GSignalMatchType -> GSignalMatchType -> [GSignalMatchType] Source #

enumFromTo :: GSignalMatchType -> GSignalMatchType -> [GSignalMatchType] Source #

enumFromThenTo :: GSignalMatchType -> GSignalMatchType -> GSignalMatchType -> [GSignalMatchType] Source #

Eq GSignalMatchType Source # |
Instance details Defined in System.Glib.Signals Methods (==) :: GSignalMatchType -> GSignalMatchType -> Bool Source # (/=) :: GSignalMatchType -> GSignalMatchType -> Bool Source #
Ord GSignalMatchType Source # |

Instance details

Defined in System.Glib.Signals

Methods

compare :: GSignalMatchType -> GSignalMatchType -> Ordering Source #

(<) :: GSignalMatchType -> GSignalMatchType -> Bool Source #

(<=) :: GSignalMatchType -> GSignalMatchType -> Bool Source #

(>) :: GSignalMatchType -> GSignalMatchType -> Bool Source #

(>=) :: GSignalMatchType -> GSignalMatchType -> Bool Source #

max :: GSignalMatchType -> GSignalMatchType -> GSignalMatchType Source #

min :: GSignalMatchType -> GSignalMatchType -> GSignalMatchType Source #

Flags GSignalMatchType Source # |
Instance details Defined in System.Glib.Signals

type ConnectAfter = Bool Source #

data GObjectClass o => ConnectId o Source #

The type of signal handler ids. If you ever need to use `signalDisconnect` to disconnect a signal handler then you will need to retain the `ConnectId` you got when you registered it.

Constructors

ConnectId CULong o |

signalDisconnect :: GObjectClass obj => ConnectId obj -> IO () Source #

Disconnect a signal handler. After disconnecting the handler will no longer be invoked when the event occurs.

signalBlock :: GObjectClass obj => ConnectId obj -> IO () Source #

Block a specific signal handler.

- Blocks a handler of an instance so it will not be called during any signal emissions unless it is unblocked again. Thus "blocking" a signal handler means to temporarily deactive it, a signal handler has to be unblocked exactly the same amount of times it has been blocked before to become active again.

signalBlockMatched :: GObjectClass obj => obj -> [GSignalMatchType] -> SignalName -> GType -> Quark -> Maybe GClosure -> Maybe (Ptr ()) -> Maybe (Ptr ()) -> IO Int Source #

signalUnblock :: GObjectClass obj => ConnectId obj -> IO () Source #

Unblock a specific signal handler.

- Undoes the effect of a previous `signalBlock` call. A blocked handler is skipped during signal emissions and will not be invoked, unblocking it (for exactly the amount of times it has been blocked before) reverts its "blocked" state, so the handler will be recognized by the signal system and is called upon future or currently ongoing signal emissions (since the order in which handlers are called during signal emissions is deterministic, whether the unblocked handler in question is called as part of a currently ongoing emission depends on how far that emission has proceeded yet).

signalStopEmission :: GObjectClass obj => obj -> SignalName -> IO () Source #

Stops a signal's current emission.

- This will prevent the default method from running. The sequence in which handlers are run is "first", "on", "last" then "after" where Gtk-internal signals are connected either at "first" or at "last". Hence this function can only stop the signal processing if it is called from within a handler that is connected with an "on" signal and if the Gtk-internal handler is connected as "last". Gtk prints a warning if this function is used on a signal which isn't being emitted.

disconnect :: GObjectClass obj => ConnectId obj -> IO () Source #

Deprecated: use signalDisconnect instead

data GClosure Source #

connectGeneric :: GObjectClass obj => SignalName -> ConnectAfter -> obj -> handler -> IO (ConnectId obj) Source #