gtk3-0.15.10: Binding to the Gtk+ 3 graphical user interface library

Maintainer | gtk2hs-users@lists.sourceforge.net
Stability | provisional
Portability | portable (depends on GHC)
Safe Haskell | None
Language | Haskell98

Graphics.UI.Gtk.Builder

Contents

- Detail
- Class Hierarchy
- Types
- Constructing and adding objects
- Retrieving objects

Description

Build an interface from an XML UI definition

All functions in this module are only available in Gtk 2.12 or higher.

Synopsis

- data Builder
- class GObjectClass o => BuilderClass o
- castToBuilder :: GObjectClass obj => obj -> Builder
- gTypeBuilder :: GType
- toBuilder :: BuilderClass o => o -> Builder
- data BuilderError
  - = BuilderErrorInvalidTypeFunction
  - | BuilderErrorUnhandledTag
  - | BuilderErrorMissingAttribute
  - | BuilderErrorInvalidAttribute
  - | BuilderErrorInvalidTag
  - | BuilderErrorMissingPropertyValue
  - | BuilderErrorInvalidValue
  - | BuilderErrorVersionMismatch
  - | BuilderErrorDuplicateId
  - | BuilderErrorObjectTypeRefused
  - | BuilderErrorTemplateMismatch
  - | BuilderErrorInvalidProperty
  - | BuilderErrorInvalidSignal
  - | BuilderErrorInvalidId
- builderNew :: IO Builder
- builderAddFromFile :: GlibFilePath fp => Builder -> fp -> IO ()
- builderAddFromString :: GlibString string => Builder -> string -> IO ()
- builderAddObjectsFromFile :: (GlibString string, GlibFilePath fp) => Builder -> fp -> [string] -> IO ()
- builderAddObjectsFromString :: GlibString string => Builder -> string -> [string] -> IO ()
- builderGetObject :: (GObjectClass cls, GlibString string) => Builder -> (GObject -> cls) -> string -> IO cls
- builderGetObjects :: Builder -> IO [GObject]
- builderGetObjectRaw :: GlibString string => Builder -> string -> IO (Maybe GObject)
- builderSetTranslationDomain :: GlibString string => Builder -> Maybe string -> IO ()
- builderGetTranslationDomain :: GlibString string => Builder -> IO (Maybe string)

# Detail

# Class Hierarchy

    | GObject
    | +----GtkBuilder

# Types

data Builder Source #

#### Instances

Instances details

Eq Builder Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods (==) :: Builder -> Builder -> Bool Source # (/=) :: Builder -> Builder -> Bool Source #
Ord Builder Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods compare :: Builder -> Builder -> Ordering Source # (<) :: Builder -> Builder -> Bool Source # (<=) :: Builder -> Builder -> Bool Source # (>) :: Builder -> Builder -> Bool Source # (>=) :: Builder -> Builder -> Bool Source # max :: Builder -> Builder -> Builder Source # min :: Builder -> Builder -> Builder Source #
GObjectClass Builder Source # |
Instance details Defined in Graphics.UI.Gtk.Types Methods toGObject :: Builder -> GObject Source # unsafeCastGObject :: GObject -> Builder Source #
BuilderClass Builder Source # |
Instance details Defined in Graphics.UI.Gtk.Types

class GObjectClass o => BuilderClass o Source #

#### Instances

Instances details

BuilderClass Builder Source # |
Instance details Defined in Graphics.UI.Gtk.Types

castToBuilder :: GObjectClass obj => obj -> Builder Source #

gTypeBuilder :: GType Source #

toBuilder :: BuilderClass o => o -> Builder Source #

data BuilderError Source #

Constructors

BuilderErrorInvalidTypeFunction |
BuilderErrorUnhandledTag |
BuilderErrorMissingAttribute |
BuilderErrorInvalidAttribute |
BuilderErrorInvalidTag |
BuilderErrorMissingPropertyValue |
BuilderErrorInvalidValue |
BuilderErrorVersionMismatch |
BuilderErrorDuplicateId |
BuilderErrorObjectTypeRefused |
BuilderErrorTemplateMismatch |
BuilderErrorInvalidProperty |
BuilderErrorInvalidSignal |
BuilderErrorInvalidId |

#### Instances

Instances details

Enum BuilderError Source # |

Instance details

Defined in Graphics.UI.Gtk.Builder

Methods

succ :: BuilderError -> BuilderError Source #

pred :: BuilderError -> BuilderError Source #

toEnum :: Int -> BuilderError Source #

fromEnum :: BuilderError -> Int Source #

enumFrom :: BuilderError -> [BuilderError] Source #

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

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

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

Show BuilderError Source # |
Instance details Defined in Graphics.UI.Gtk.Builder Methods showsPrec :: Int -> BuilderError -> ShowS Source # show :: BuilderError -> String Source # showList :: [BuilderError] -> ShowS Source #
Eq BuilderError Source # |
Instance details Defined in Graphics.UI.Gtk.Builder Methods (==) :: BuilderError -> BuilderError -> Bool Source # (/=) :: BuilderError -> BuilderError -> Bool Source #

# Constructing and adding objects

builderNew :: IO Builder Source #

Creates a new `Builder` object.

builderAddFromFile :: GlibFilePath fp => Builder -> fp -> IO () Source #

Parses a file containing a GtkBuilder UI definition and merges it with the current contents of the `Builder`.

- If an error occurs, the computation will throw an exception that can be caught using e.g. `catchGErrorJust` and one of the error codes in `BuilderError`.

builderAddFromString :: GlibString string => Builder -> string -> IO () Source #

Parses a string containing a GtkBuilder UI definition and merges it with the current contents of the `Builder`.

- If an error occurs, the computation will throw an exception that can be caught using e.g. `catchGErrorJust` and one of the error codes in `BuilderError`.

builderAddObjectsFromFile Source #

Arguments

:: (GlibString string, GlibFilePath fp) |
=> Builder |
-> fp |
-> [string] | Object IDs
-> IO () |

Parses a file containing a GtkBuilder UI definition building only the requested objects and merges them with the current contents of the `Builder`.

- If an error occurs, the computation will throw an exception that can be caught using e.g. `catchGErrorJust` and one of the error codes in `BuilderError`.

builderAddObjectsFromString Source #

Arguments

:: GlibString string |
=> Builder |
-> string |
-> [string] | Object IDs
-> IO () |

Parses a string containing a GtkBuilder UI definition building only the requested objects and merges them with the current contents of the `Builder`.

- If an error occurs, the computation will throw an exception that can be caught using e.g. `catchGErrorJust` and one of the error codes in `BuilderError`.

# Retrieving objects

builderGetObject Source #

Arguments

:: (GObjectClass cls, GlibString string) |
=> Builder |
-> (GObject -> cls) | A dynamic cast function which returns an object of the expected type, eg `castToButton`
-> string |
-> IO cls |

Gets the object with the given name, with a conversion function. Note that this computation does not increment the reference count of the returned object.

If the object with the given ID is not of the requested type, an exception will be thrown.

builderGetObjects :: Builder -> IO [GObject] Source #

Gets all objects that have been constructed by builder. Note that this computation does not increment the reference counts of the returned objects.

builderGetObjectRaw :: GlibString string => Builder -> string -> IO (Maybe GObject) Source #

Gets the object with the given name. Note that this computation does not increment the reference count of the returned object.

builderSetTranslationDomain :: GlibString string => Builder -> Maybe string -> IO () Source #

Sets the translation domain of the `Builder`.

builderGetTranslationDomain :: GlibString string => Builder -> IO (Maybe string) Source #

Gets the translation domain of the `Builder`.