sindre-0.2: A programming language for simple GUIs

Portabilityunportable
Stabilityprovisional

Sindre.X11

Description

X11 backend for Sindre. For internationalised keyboard input to work, make sure the locale is correctly set.

Synopsis

Documentation

data SindreX11Conf Source

The read-only configuration of the X11 backend, created during backend initialisation.

sindreX11overrideSource

Arguments

:: String

The display string (usually the value of the environment variable $DISPLAY or :0)

-> SindreX11M ExitCode

The function returned by compileSindre after command line options have been given

-> IO ExitCode 

Execute Sindre in the X11 backend, grabbing control of the entire display and staying on top.

sindreX11dockSource

Arguments

:: String

The display string (usually the value of the environment variable $DISPLAY or :0)

-> SindreX11M ExitCode

The function returned by compileSindre after command line options have been given

-> IO ExitCode 

Execute Sindre in the X11 backend as a dock/statusbar.

sindreX11Source

Arguments

:: String

The display string (usually the value of the environment variable $DISPLAY or :0)

-> SindreX11M ExitCode

The function returned by compileSindre after command line options have been given

-> IO ExitCode 

Execute Sindre in the X11 backend as an ordinary client visible to the window manager.

xoptSource

Arguments

:: Param SindreX11M a 
=> Maybe String

Name of widget, using _ if Nothing is passed

-> String

Widget class

-> String

Property name

-> ConstructorM SindreX11M a 

Performs a lookup in the X resources database for a given property. The class used is Sindre.class.property and the name is progname.name.property, where progname is the value of getProgName.

data VisualOpts Source

Options regarding visual appearance of widgets (colors and fonts).

visualOpts :: WidgetRef -> ConstructorM SindreX11M VisualOptsSource

Read visual options from either widget parameters or the X resources database using xopt, or a combination. The following graphical components are read:

Foreground color
From fg parameter or foreground X property.
Background color
From bg parameter or background X property.
Focus foreground color
From ffg parameter or focusForeground X property.
Focus background color
From fbg parameter or focusBackground X property.

drawingSource

Arguments

:: (a -> VisualOpts) 
-> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M [Rectangle])

The body of the drawing call - this function is called with a rectangle representing the area of the widget, and Drawers for foreground, background, focus foreground, and focus background respectively.

-> Rectangle 
-> ObjectM a SindreX11M SpaceUse 

Helper function that makes it easier it write consistent widgets in the X11 backend. The widget is automatically filled with its (nonfocus) background color. You are supposed to use this in the drawI method of a Widget instance definition. An example:

 drawI = drawing myWidgetWin myWidgetVisual $ r fg bg ffg fbg -> do
   fg drawString 0 5 "foreground"
   bg drawString 0 15 "background"
   ffg drawString 0 25 "focus foreground"
   fbg drawString 0 35 "focus background"

drawing' :: (a -> VisualOpts) -> (Rectangle -> Drawer -> Drawer -> ObjectM a SindreX11M ()) -> Rectangle -> ObjectM a SindreX11M SpaceUseSource

Variant of drawing that assumes the entire rectangle is used.

data Drawer Source

Constructors

Drawer 

Fields

fg :: forall f. CoreDrawer f
 
bg :: forall f. CoreDrawer f
 
drawerFont :: Font
 
drawerFgColor :: Color
 
drawerBgColor :: Color
 

drawText :: (Integral x, Integral y, Integral z) => Color -> Font -> x -> y -> z -> String -> SindreX11M ()Source

mkDial :: Constructor SindreX11MSource

A simple dial using an arc segment to indicate the value compared to the max value. Accepts max and value parameters (both integers, default values 12 and 0), and a single field: value. n and p are used to increase and decrease the value.

mkLabel :: Constructor SindreX11MSource

Label displaying the text contained in the field label, which is also accepted as a widget parameter (defaults to the empty string).

mkBlank :: Constructor SindreX11MSource

A blank widget, showing only background color, that can use as much or as little room as necessary. Useful for constraining the layout of other widgets.

mkTextField :: Constructor SindreX11MSource

Single-line text field, whose single field value (also a parameter, defaults to the empty string) is the contents of the editing buffer.

mkInStream :: Handle -> ObjectRef -> SindreX11M (NewObject SindreX11M)Source

An input stream object wrapping the given Handle. Input is purely event-driven and line-oriented: the event lines is sent (roughly) for each sequence of lines that can be read without blocking, with the payload being a single string value containing the lines read since the last time the event was sent. When end of file is reached, the eof event (no payload) is sent.

mkHList :: Constructor SindreX11MSource

Horizontal dmenu-style list containing a list of elements, one of which is the "selected" element. If the parameter i is given a true value, element matching will be case-insensitive. The following methods are supported:

insert(string)
Split string into lines and add each line as an element.
clear()
Delete all elements.
filter(string)
Only display those elements that contain string.
next()
Move selection right.
prev()
Move selection left.
first()
Move to leftmost element.
last()
Move to rightmost element.

The field selected is the selected element.

mkVList :: Constructor SindreX11MSource

As mkHList, except the list is vertical. The parameter lines (default value 10) is the number of lines shown.