gi-glib-2.0.30: GLib bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | Safe-Inferred
Language | Haskell2010

GI.GLib.Structs.MainLoop

Contents

- Exported types
- Methods
  - getContext
  - isRunning
  - new
  - quit
  - ref
  - run
  - unref

Description

The `GMainLoop` struct is an opaque data type representing the main event loop of a GLib or GTK application.

Synopsis

- newtype MainLoop = MainLoop (ManagedPtr MainLoop)
- mainLoopGetContext :: (HasCallStack, MonadIO m) => MainLoop -> m MainContext
- mainLoopIsRunning :: (HasCallStack, MonadIO m) => MainLoop -> m Bool
- mainLoopNew :: (HasCallStack, MonadIO m) => Maybe MainContext -> Bool -> m MainLoop
- mainLoopQuit :: (HasCallStack, MonadIO m) => MainLoop -> m ()
- mainLoopRef :: (HasCallStack, MonadIO m) => MainLoop -> m MainLoop
- mainLoopRun :: (HasCallStack, MonadIO m) => MainLoop -> m ()
- mainLoopUnref :: (HasCallStack, MonadIO m) => MainLoop -> m ()

# Exported types

newtype MainLoop Source #

Memory-managed wrapper type.

Constructors

MainLoop (ManagedPtr MainLoop) |

#### Instances

Instances details

Eq MainLoop Source # |
Instance details Defined in GI.GLib.Structs.MainLoop Methods (==) :: MainLoop -> MainLoop -> Bool Source # (/=) :: MainLoop -> MainLoop -> Bool Source #
GBoxed MainLoop Source # |
Instance details Defined in GI.GLib.Structs.MainLoop
ManagedPtrNewtype MainLoop Source # |
Instance details Defined in GI.GLib.Structs.MainLoop Methods toManagedPtr :: MainLoop -> ManagedPtr MainLoop Source #
TypedObject MainLoop Source # |
Instance details Defined in GI.GLib.Structs.MainLoop Methods glibType :: IO GType Source #
HasParentTypes MainLoop Source # |
Instance details Defined in GI.GLib.Structs.MainLoop
IsGValue (Maybe MainLoop) Source # | Convert `MainLoop` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.GLib.Structs.MainLoop Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe MainLoop -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe MainLoop) Source #
type ParentTypes MainLoop Source # |
Instance details Defined in GI.GLib.Structs.MainLoop type ParentTypes MainLoop = '[] :: [Type]

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

isRunning, quit, ref, run, unref.

#### Getters

getContext.

#### Setters

None.

## getContext

mainLoopGetContext Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MainLoop | `loop`: a `MainLoop`.
-> m MainContext | Returns: the [struct`gLib`.MainContext] of `loop`

Returns the [struct`gLib`.MainContext] of `loop`.

## isRunning

mainLoopIsRunning Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MainLoop | `loop`: a `MainLoop`.
-> m Bool | Returns: `True` if the mainloop is currently being run.

Checks to see if the main loop is currently being run via `mainLoopRun`.

## new

mainLoopNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Maybe MainContext | `context`: a `MainContext` (if `Nothing`, the global-default main context will be used).
-> Bool | `isRunning`: set to `True` to indicate that the loop is running. This is not very important since calling `mainLoopRun` will set this to `True` anyway.
-> m MainLoop | Returns: a new `MainLoop`.

Creates a new [struct`gLib`.MainLoop] structure.

## quit

mainLoopQuit Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MainLoop | `loop`: a `MainLoop`
-> m () |

Stops a [struct`gLib`.MainLoop] from running. Any calls to `mainLoopRun` for the loop will return.

Note that sources that have already been dispatched when `mainLoopQuit` is called will still be executed.

## ref

mainLoopRef Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MainLoop | `loop`: a `MainLoop`
-> m MainLoop | Returns: `loop`

Increases the reference count on a [struct`gLib`.MainLoop] object by one.

## run

mainLoopRun Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MainLoop | `loop`: a `MainLoop`
-> m () |

Runs a main loop until `mainLoopQuit` is called on the loop. If this is called for the thread of the loop's `MainContext`, it will process events from the loop, otherwise it will simply wait.

## unref

mainLoopUnref Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> MainLoop | `loop`: a `MainLoop`
-> m () |

Decreases the reference count on a [struct`gLib`.MainLoop] object by one. If the result is zero, free the loop and free all associated memory.