fltkhs-themes- A set of themed widgets that provides drop in replacements to the ones in FLTKHS.

Safe HaskellNone




A module that allows access to the resources (fonts, images, etc.) bundled with this theme. Clients of this package should not need to directly include this module since Graphics.UI.FLTK.Theme.Light re-exports it.



Description & Usage

This module mediates access to fonts, images and whatever other data is needed by this theme. To provide a consistent look-and-feel across platforms the theme bundles whatever it needs and loads them when a user's app is started. The loaded assets should not interfere with any other process thread. For example, when a user's application starts up the dejaVuSansMono font is loaded into the font cache, but it should be isolated to the app's process.

To use the assets in an FLTK app you need to enable the ImplicitParams pragma and then pass the Assets implicit constraint to every function that needs the resources:

{-# LANGUAGE ImplicitParams ...#-}
myAwesomeUI :: (?assets :: Assets) => ...
myAwesomeUI = do
  b <- buttonNew ...
  setLabelFont b dejaVuSansMono

For more extensive documentation on how to use assets in the context of a full application see Graphics.UI.FLTK.Theme.Light.

Why ImplicitParams?

ImplicitParams is a fairly contentious extension because of how it interacts with recursion and the dangers of accidental name-shadowing. The two alternatives are Reader and reflection. While both are more principled the first requires all UI functions have a MonadReader constraint which makes the API way uglier and harder to use, and the second incurs a dependency on template-haskell which I also did not want. ImplicitParams are easier to use and have been in GHC since 6.8.1 and since we're just threading through some fonts and images hopefully the downsides won't become a big deal in practice.

data Assets Source #

An opaque type that contains all of the resources needed by this theme. Getting to the resources requires threading something of the type as an implicit parameter to the accessors below, eg. dejaVuSans.

Show Assets Source # 
Instance details

Defined in Graphics.UI.FLTK.Theme.Light.Assets

loadAssets :: IO Assets Source #

Used at app start time to load the resources of this theme into memory. This should never be called directly, but through configureTheme which does some other setup.


The fonts required by this theme, all are TTF.

dejaVuSans :: (?assets :: Assets) => Font Source #

The standard font used for most labels, titles, output etc.

yanoneKaffesatz :: (?assets :: Assets) => Font Source #

Currently unused but a nice font around for the future ...


downSmallImage :: (?assets :: Assets) => Ref PNGImage Source #

The down arrow.

forwardImage :: (?assets :: Assets) => Ref PNGImage Source #

leftImage :: (?assets :: Assets) => Ref PNGImage Source #

rewindImage :: (?assets :: Assets) => Ref PNGImage Source #

rightImage :: (?assets :: Assets) => Ref PNGImage Source #

upSmallImage :: (?assets :: Assets) => Ref PNGImage Source #

The up arrow.