module HTk.Components.Slider (
Slider(..),
HasSlider(..)
) where
import HTk.Kernel.Core
import HTk.Kernel.Configuration
import Util.Computation
import HTk.Kernel.BaseClasses(Widget)
import HTk.Kernel.Colour(toColour)
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
repeatInterval c w = cset w "repeatinterval" c
getRepeatInterval w = cget w "repeatinterval"
repeatDelay c w = cset w "repeatdelay" c
getRepeatDelay w = cget w "repeatdelay"
newtype Slider w = Slider w
instance GUIObject w => GUIObject (Slider w) where
toGUIObject (Slider w) = toGUIObject w
cname (Slider w) = cname w
instance (HasSlider w,GUIObject w) => HasColour (Slider w) where
legalColourID = hasForeGroundColour
setColour w "foreground" c = cset w "troughcolor" (toColour c)
setColour w "background" c = cset w "activebackground" (toColour c)
setColour w _ _ = return w
getColour w "background" = cget w "troughcolor"
getColour w "foreground" = cget w "activebackground"
getColour _ _ = return cdefault