glade-0.12.1: Binding to the glade library.

Safe Haskell | None

Graphics.UI.Gtk.Glade

Contents

- Data types
- Creation operations
- Obtaining widget handles

Description

Libglade facilitates loading of XML specifications of whole widget trees that have been interactively designed with the GUI builder Glade. The present module exports operations for manipulating `GladeXML` objects.

- This binding does not support Libglade functionality that is exclusively meant for extending Libglade with new widgets. Like new widgets, such functionality is currently expected to be implemented in C.

Synopsis

- class GObjectClass o => GladeXMLClass o
- data GladeXML
- xmlNew :: FilePath -> IO (Maybe GladeXML)
- xmlNewWithRootAndDomain :: FilePath -> Maybe String -> Maybe String -> IO (Maybe GladeXML)
- xmlGetWidget :: WidgetClass widget => GladeXML -> (GObject -> widget) -> String -> IO widget
- xmlGetWidgetRaw :: GladeXML -> String -> IO (Maybe Widget)

# Data types

class GObjectClass o => GladeXMLClass o Source

Instances

GladeXMLClass GladeXML |

data GladeXML Source

Instances

Eq GladeXML |
Ord GladeXML |
GObjectClass GladeXML |
GladeXMLClass GladeXML |

# Creation operations

xmlNew :: FilePath -> IO (Maybe GladeXML)Source

Create a new XML object (and the corresponding widgets) from the given XML file.

This corresponds to `xmlNewWithRootAndDomain`, but without the ability to specify a root widget or translation domain.

xmlNewWithRootAndDomain Source

Arguments

:: FilePath | the XML file name.
-> Maybe String | `root` - the widget node in fname to start building from (or `Nothing`)
-> Maybe String | `domain` - the translation domain for the XML file (or `Nothing` for default)
-> IO (Maybe GladeXML) |

Create a new GladeXML object (and the corresponding widgets) from the given XML file.

Optionally it will only build the interface from the widget node `root` (if it is not `Nothing`). This feature is useful if you only want to build say a toolbar or menu from the XML file, but not the window it is embedded in.

Note also that the XML parse tree is cached to speed up creating another `GladeXML` object for the same file.

# Obtaining widget handles

xmlGetWidget Source

Arguments

:: WidgetClass widget |
=> GladeXML |
-> (GObject -> widget) | a dynamic cast function that returns the type of object that you expect, eg castToButton
-> String | the second parameter is the ID of the widget in the glade xml file, eg "button1".
-> IO widget |

Get the widget that has the given name in the interface description. If the named widget cannot be found or is of the wrong type the result is an error.

xmlGetWidgetRaw :: GladeXML -> String -> IO (Maybe Widget)Source

Like `xmlGetWidget` but it does not do any casting and if the named widget is not found then the result is `Nothing` rather than an error.