gi-gtk-hs-0.3.18: A wrapper for gi-gtk, adding a few more idiomatic API parts on top

Safe Haskell | None
Language | Haskell2010

Data.GI.Gtk.BuildFn

Description

A module aimed at making working with GtkBuilder easier. It's meant to be used like this (requires OverloadedStrings):

    buildUI :: BuildFn ()
    buildUI = do
        mainWin <- buildMainWin
        buildAboutDialog

        widgetShowAll mainWin

    buildMainWin :: BuildFn ApplicationWindow
    buildMainWin = do
        buildHeaderBar
        buildMenuBar
        buildMainArea

        mainWin <- getObject' ApplicationWindow "mainWin"
        on mainWin Destroy mainQuit
        return mainWin

    buildAboutDialog :: BuildFn AboutDialog
    ...

    buildHeaderBar :: BuildFn HeaderBar
    ...

    buildMenuBar :: BuildFn MenuBar
    ...

    buildMainArea :: BuildFn Grid
    ...

# Documentation

type BuildFn a = ReaderT Builder IO a Source #

buildWithBuilder :: MonadIO m => BuildFn a -> Builder -> m a Source #

getObject :: GObject a => (ManagedPtr a -> a) -> Text -> BuildFn a Source #