Go to the first, previous, next, last section, table of contents.

Style interface


data Style {- abstract -}

 {-
   StyleNames and StyleAttributes are related.
   StyleNames are used for identifying Style environments,
   a StyleAttribute is a String specifying how a value
   is to be mapped to a query.

   StyleNames are Strings that can contain the following
   chars [A-Za-z0-9_-], i.e., no use of meta regexp chars.
   such as '*','+' or '?'.
	   
   StyleAttributes are restricted regexps over StyleNames and
   value names,i.e.,
   the attribute:

    *Box*foreground

   will match any Style that has a sub-Style with the name/alias
   of Box and a leaf style with attribute value (i.e, the
   StyleAttribute is string with no regexp chars.) Similarly,

    *Box.width:

   will match leaf Styles named Box that contain attributes for width.

   Note that the a StyleAttribute must end with a StyleName.
  -}

type StyleName  = String
type StyleValue	= String

  {-
   create a new style, giving it a name and an initial set
   of style values (attribute name and value.)
  -}
mkStyle        :: [StyleValue] -> Style
mkDefaults     :: [StyleValue] -> Style
 {- 
   Load in resource file for application with given name.
   If empty string, the name Haggis is used
 -}
loadStyle      :: String -> IO Style

 {-
  adds the second style as a sub-style of the first. The
  attributes in the first will be visible in the second during
  lookup. In a nested application of appendStyle, the leftmost
  style will be the root, i.e. styles are appended to the
  leftmost style.
	
    appendStyles (appendStyles style1 style2) style3

    style1 -> style2 -> style3
	
  Note that repeated application of appendStyle does not
  add a sub-style to style1 directly, but to style2.
		

   appendStyles style1 (appendStyles style2 style3)
		
    style1 -> style2 -> style3
 -}
appendStyles :: Style -> Style -> Style

lookupStyle  :: Style -> String -> IO (Maybe String)	

 {-
  add (attribute name, value) pairs to the style.
  Provided the bulk operation rather than a singular
  one, as it is the more common.
 -}
addStyleValues :: [String] -> Style -> Style

{- addStyleName pushes a new name to the tail of the
   style name. setStyleName replaces the last element. -}
addStyleName  :: StyleName -> Style -> Style
setStyleName  :: StyleName -> Style -> Style

{-
 Each level of the style name can have a set of
 aliases, i.e., QuitButton, could have the aliases
 Button and Quitter. Lookups try first to match
 using the name, if no match try the aliases.
-}
addAliasFront :: StyleName -> Style -> Style
addAliasBack  :: StyleName -> Style -> Style
	
 {- querying name&aliases -}
getStyleName    :: Style -> StyleName
getStyleAliases :: Style -> [StyleName]

 {- Lookups (prepends the StyleName to the lookup name) -}
resolveStyle        :: Style -> String -> (String -> a) -> IO a
resolveStyleDefault :: Style -> String -> a -> (String -> a) -> IO a


Go to the first, previous, next, last section, table of contents.