xtc-1.0: eXtended & Typed Controls for wxHaskell.Source codeContentsIndex
Graphics.UI.XTC
Portabilityportable
Stabilityexperimental
Maintainermartijn@cs.uu.nl
Contents
Classes
Controls
Radio view
Single-selection list view
Multiple-selection list view
Choice view
Value entry
Description

XTC: eXtended & Typed Controls for wxHaskell

The XTC library provides a typed interface to several wxHaskell controls.

  • radio view (typed radio box)
  • single-selection list view (typed single-selection list box)
  • muliple-selection list view (typed multiple-selection list box)
  • choice view (typed choice box)
  • value entry (typed text entry)

XTC controls keep track of typed values and items, rather than being string based. Selections in XTC controls consist of actual values instead of indices.

Synopsis
class Labeled x where
toLabel :: x -> String
class TypedValued x w | w -> x where
typedValue :: Attr w (Maybe x)
class Items w String => TypedItems x w | w -> x where
typedItems :: Attr w [x]
class Selection w => TypedSelection x w | w -> x where
typedSelection :: Attr w x
class Selection w => TypedMaybeSelection x w | w -> x where
typedMaybeSelection :: Attr w (Maybe x)
class Selections w => TypedSelections x w | w -> x where
typedSelections :: Attr w [x]
class Observable w where
change :: Event w (IO ())
type RadioView x b = RadioBox (CRadioView x b)
mkRadioView :: Labeled x => Window a -> Orientation -> [x] -> [Prop (RadioView x ())] -> IO (RadioView x ())
mkRadioViewEx :: Window a -> (x -> String) -> Orientation -> [x] -> [Prop (RadioView x ())] -> IO (RadioView x ())
type ListView a b = SingleListBox (CListView a b)
mkListView :: Labeled x => Window a -> [Prop (ListView x ())] -> IO (ListView x ())
mkListViewEx :: Window a -> (x -> String) -> [Prop (ListView x ())] -> IO (ListView x ())
type MultiListView a b = MultiListBox (CMultiListView a b)
mkMultiListView :: Labeled x => Window a -> [Prop (MultiListView x ())] -> IO (MultiListView x ())
mkMultiListViewEx :: Window a -> (x -> String) -> [Prop (MultiListView x ())] -> IO (MultiListView x ())
type ChoiceView a b = Choice (CChoiceView a b)
mkChoiceView :: Labeled x => Window a -> [Prop (ChoiceView x ())] -> IO (ChoiceView x ())
mkChoiceViewEx :: Window a -> (x -> String) -> Style -> [Prop (ChoiceView x ())] -> IO (ChoiceView x ())
type ValueEntry x b = TextCtrl (CValueEntry x b)
mkValueEntry :: (Show x, Read x) => Window b -> [Prop (ValueEntry x ())] -> IO (ValueEntry x ())
mkValueEntryEx :: Window b -> (x -> String) -> (String -> Maybe x) -> [Prop (ValueEntry x ())] -> IO (ValueEntry x ())
Classes
class Labeled x whereSource
The labeled class is used by mkRadioView, mkListView, mkMultiListView, and mkChoiceView for conveniently passing the function that maps an item onto its label.
Methods
toLabel :: x -> StringSource
class TypedValued x w | w -> x whereSource
Widgets that have a typed value. The value can be accessed via the attribute typedValue, and has type x.
Methods
typedValue :: Attr w (Maybe x)Source
class Items w String => TypedItems x w | w -> x whereSource
Widgets that have a typed list of items. The item list can be accessed via the attribute typedItems, and has type [x].
Methods
typedItems :: Attr w [x]Source
class Selection w => TypedSelection x w | w -> x whereSource
Widgets that have a typed selection. The selection can be accessed via the attribute typedSelection, and has type x.
Methods
typedSelection :: Attr w xSource
class Selection w => TypedMaybeSelection x w | w -> x whereSource
Widgets that have a typed selection that may be empty. The selection can be accessed via the attribute typedMaybeSelection, and has type Maybe x.
Methods
typedMaybeSelection :: Attr w (Maybe x)Source
class Selections w => TypedSelections x w | w -> x whereSource
Widgets that have a typed list of selections. The selection list can be accessed via the attribute typedSelections, and has type [x].
Methods
typedSelections :: Attr w [x]Source
class Observable w whereSource
Methods
change :: Event w (IO ())Source
Controls
Radio view
type RadioView x b = RadioBox (CRadioView x b)Source
Pointer to a radio view, deriving from RadioBox.
mkRadioView :: Labeled x => Window a -> Orientation -> [x] -> [Prop (RadioView x ())] -> IO (RadioView x ())Source

Create a new radio view with an initial orientation and a list of typed items. The item type (x) must be an instance of Labeled to show each item's label. Use attribute typedSelection to access the currently selected item, and typedItems to access the list of items. Note: for a radio view (or radio box) the items may not be modified dynamically.

mkRadioViewEx :: Window a -> (x -> String) -> Orientation -> [x] -> [Prop (RadioView x ())] -> IO (RadioView x ())Source

Create a new radio view with an initial orientation and a list of typed items. A function of type (x -> String) maps items onto labels. Use attribute typedSelection to access the currently selected item, and typedItems to access the list of items. Note: for a radio view (or radio box) the items may not be modified dynamically.

Single-selection list view
type ListView a b = SingleListBox (CListView a b)Source
Pointer to a single-selection list view, deriving from SingleListBox.
mkListView :: Labeled x => Window a -> [Prop (ListView x ())] -> IO (ListView x ())Source

Create a single-selection list view. The item type (x) must be an instance of Labeled to show each item's label. Use attribute typedMaybeSelection to access the currently selected item, and typedItems to access the list of items.

mkListViewEx :: Window a -> (x -> String) -> [Prop (ListView x ())] -> IO (ListView x ())Source

Create a single-selection list view. A function of type (x -> String) maps items onto labels. Use attribute typedMaybeSelection to access the currently selected item, and typedItems to access the list of items.

Multiple-selection list view
type MultiListView a b = MultiListBox (CMultiListView a b)Source
Pointer to a multiple-selection list view, deriving from MultiListBox.
mkMultiListView :: Labeled x => Window a -> [Prop (MultiListView x ())] -> IO (MultiListView x ())Source

Create a multiple-selection list view. The item type (x) must be an instance of Labeled to show each item's label. Use attribute typedSelections to access the currently selected items, and typedItems to access the list of items.

mkMultiListViewEx :: Window a -> (x -> String) -> [Prop (MultiListView x ())] -> IO (MultiListView x ())Source

Create a multiple-selection list view. A function of type (x -> String) maps items onto labels. Use attribute typedSelections to access the currently selected items, and typedItems to access the list of items.

Choice view
type ChoiceView a b = Choice (CChoiceView a b)Source
Pointer to a choice view, deriving from Choice.
mkChoiceView :: Labeled x => Window a -> [Prop (ChoiceView x ())] -> IO (ChoiceView x ())Source

Create a choice view to select one item from a list of typed items. The item type (x) must be an instance of Labeled to show each item's label. Use attribute typedMaybeSelection to access the currently selected item, and typedItems to access the list of items.

mkChoiceViewEx :: Window a -> (x -> String) -> Style -> [Prop (ChoiceView x ())] -> IO (ChoiceView x ())Source

Create a choice view to select one item from a list of typed items. A function of type (x -> String) maps items onto labels. Use attribute typedMaybeSelection to access the currently selected item, and typedItems to access the list of items.

Value entry
type ValueEntry x b = TextCtrl (CValueEntry x b)Source
Pointer to a choice view, deriving from TextCtrl.
mkValueEntry :: (Show x, Read x) => Window b -> [Prop (ValueEntry x ())] -> IO (ValueEntry x ())Source

Create a single-line value entry control. The value type (x) must be an instance of Show and Read to present a value as a string in the entry and parse the string from the entry back to (maybe) a value. Use typedValue to access the value. Note: alignment has to be set at creation time (or the entry has default alignment (=left) ).

mkValueEntryEx :: Window b -> (x -> String) -> (String -> Maybe x) -> [Prop (ValueEntry x ())] -> IO (ValueEntry x ())Source

Create a single-line value entry control. The two functions of type (x -> String) and (String -> Maybe x) are used to present a value as a string in the entry and parse the string from the entry back to (maybe) a value. Use typedValue to access the value. Note: alignment has to be set at creation time (or the entry has default alignment (=left) ).

Produced by Haddock version 2.1.0