Source codeContentsIndex
ScrollBar
Description

HTk's scrollbar widget.

A scroll bar is a widget which controls scrolling.

Synopsis
class (Widget w) => HasScroller w where
isWfOrientation :: w -> Orientation -> Bool
scrollbar :: Orientation -> ScrollBar -> Config w
moveto :: Orientation -> w -> Fraction -> IO ()
scroll :: Orientation -> w -> Int -> ScrollUnit -> IO ()
view :: Orientation -> w -> IO (Fraction, Fraction)
data ScrollBar
newScrollBar :: (Container par) => par -> [Config ScrollBar] -> IO ScrollBar
data ScrollUnit
= Units
| Pages
newtype Slider w = Slider w
class (Widget w) => HasSlider w where
repeatInterval :: Int -> Config (Slider w)
getRepeatInterval :: Slider w -> IO Int
repeatDelay :: Int -> Config (Slider w)
getRepeatDelay :: Slider w -> IO Int
data ScrollBarElem
= Arrow1
| Trough1
| ScrollBarSlider
| Trough2
| Arrow2
activateScrollBarElem :: ScrollBar -> ScrollBarElem -> IO ()
getActivatedElem :: ScrollBar -> IO (Maybe ScrollBarElem)
type Fraction = Double
fraction :: ScrollBar -> Position -> IO Fraction
identify :: ScrollBar -> Position -> IO (Maybe ScrollBarElem)
setView :: ScrollBar -> Fraction -> Fraction -> IO ()
Documentation
class (Widget w) => HasScroller w where
Methods
isWfOrientation :: w -> Orientation -> Bool
True for widgets that are scrollable in the given orientation.
scrollbar :: Orientation -> ScrollBar -> Config w
Associates a scrollbar with a scrollable widget.
moveto :: Orientation -> w -> Fraction -> IO ()
Positions the scrolled widget so the give Fraction is off-screen to the left.
scroll :: Orientation -> w -> Int -> ScrollUnit -> IO ()
Scrolls the associated widget by n pages or units (depending on the given ScrollUnit).
view :: Orientation -> w -> IO (Fraction, Fraction)
Returns two fractions between 0 and 1 that describe the amount of the widget off-screen to the left and the amount of the widget visible.
Instances
HasScroller Canvas
HasScroller Editor
HasScroller (Entry a)
HasScroller (ListBox a)
(HasScroller a) => HasScroller (ScrollBox a)
data ScrollBar
The ScrollBar datatype.
newScrollBar
:: (Container par)
=> par the parent widget, which has to be a container widget (an instance of class Container).
-> [Config ScrollBar] the list of configuration options for this scrollbar.
-> IO ScrollBar A scrollbar widget.
Constructs a new scrollbar widget and returns a handler.
data ScrollUnit
Constructors
Units
Pages
Instances
GUIValue ScrollUnit
Read ScrollUnit
Show ScrollUnit
newtype Slider w
The Slider datatype.
Constructors
Slider w
Instances
(ScaleValue a) => HasIncrement (Slider (Scale a)) a
HasSize (Slider (Scale a))
(GUIObject w) => GUIObject (Slider w)
(HasSlider w, GUIObject w) => HasColour (Slider w)
class (Widget w) => HasSlider w where
Widgets with sliders (scale widget, scrollbar) instantiate the class HasSlider.
Methods
repeatInterval :: Int -> Config (Slider w)
Sets the time period between auto-repeat events.
getRepeatInterval :: Slider w -> IO Int
Gets the time period between auto-repeat events.
repeatDelay :: Int -> Config (Slider w)
Sets the delay before auto-repeat starts (e.g. when mouse button is pressed).
getRepeatDelay :: Slider w -> IO Int
Gets the delay before auto-repeat starts.
Instances
HasSlider (Scale a)
HasSlider ScrollBar
data ScrollBarElem
The ScrollBarElem datatype - representing the elements of the scrollbar.
Constructors
Arrow1
Trough1
ScrollBarSlider
Trough2
Arrow2
Instances
GUIValue ScrollBarElem
Read ScrollBarElem
Show ScrollBarElem
activateScrollBarElem :: ScrollBar -> ScrollBarElem -> IO ()
getActivatedElem
:: ScrollBar the concerned scrollbar.
-> IO (Maybe ScrollBarElem) Just [elem] if an element is active, otherwise Nothing.
Gets the active element (arrow1, arrow2 or slider).
type Fraction = Double
Fractions are floating point values between 0 and 1 representing relative positions within the scrolled range.
fraction
:: ScrollBar the concerned scrollbar.
-> Position the conderned position.
-> IO Fraction The fraction indicating the relative location in the through.
Returns a fraction between 0 and 1 indicating the relative location of the given position in the through.
identify
:: ScrollBar the concerned scrollbar.
-> Position the concerned position.
-> IO (Maybe ScrollBarElem) Just [elem] if [elem] is under the given position, otherwise Nothing.
Returns the ScrollBarElem to indicate what is under the given position.
setView
:: ScrollBar the concerned scrollbar.
-> Fraction fraction between 0 and 1 representing the relative position of the top left of the display.
-> Fraction fraction between 0 and 1 representing the relative position of the bottom right of the display.
-> IO () None.
Sets the scrollbar parameters.
Produced by Haddock version 0.3