diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-08-21 05:38:37 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-08-21 05:38:37 +0200 |
commit | 028c4243a87e41e3b7e2c51eb752d4b089b30680 (patch) | |
tree | d401761df8a383b9dfdf3054a4d1365400879435 /lib/Phi/Border.hs | |
parent | 15bccc001a5ff2e76d0890f85e300e9312cddd1b (diff) | |
download | phi-028c4243a87e41e3b7e2c51eb752d4b089b30680.tar phi-028c4243a87e41e3b7e2c51eb752d4b089b30680.zip |
Use CacheArrow for rendering
Extremely hacky at the moment, for now the caching isn't used at all...
Diffstat (limited to 'lib/Phi/Border.hs')
-rw-r--r-- | lib/Phi/Border.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/Phi/Border.hs b/lib/Phi/Border.hs index 0a9a74c..01dea44 100644 --- a/lib/Phi/Border.hs +++ b/lib/Phi/Border.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiParamTypeClasses #-} module Phi.Border ( BorderWidth(..) , simpleBorderWidth @@ -23,7 +23,7 @@ data BorderWidth = BorderWidth { borderTop :: !Int , borderRight :: !Int , borderBottom :: !Int , borderLeft :: !Int - } deriving Show + } deriving (Show, Eq) simpleBorderWidth :: Int -> BorderWidth simpleBorderWidth w = BorderWidth w w w w @@ -34,7 +34,7 @@ borderH bw = borderLeft bw + borderRight bw borderV :: BorderWidth -> Int borderV bw = borderTop bw + borderBottom bw -data BorderState = BorderState ![WidgetState] deriving Show +data BorderState = BorderState ![WidgetState] deriving Eq data BorderConfig = BorderConfig { margin :: !BorderWidth , borderWidth :: !Int @@ -43,7 +43,7 @@ data BorderConfig = BorderConfig { margin :: !BorderWidth , backgroundColor :: !Color , cornerRadius :: !Int , borderWeight :: !Float - } deriving Show + } deriving (Show, Eq) defaultBorderConfig = BorderConfig { margin = simpleBorderWidth 0 , borderWidth = 1 @@ -54,10 +54,9 @@ defaultBorderConfig = BorderConfig { margin = simpleBorderWidth 0 , borderWeight = 1 } -data Border = Border !BorderConfig ![Widget] deriving Show +data Border = Border !BorderConfig ![Widget] deriving (Show, Eq) -instance WidgetClass Border where - type WidgetData Border = BorderState +instance WidgetClass Border BorderState where initWidget (Border _ widgets) phi disp = liftM BorderState $ mapM (createWidgetState phi disp) widgets minSize (Border config _) (BorderState widgetStates) height screen = @@ -88,10 +87,11 @@ instance WidgetClass Border where width' = width - borderH m - 2*bw - borderH p height' = height - borderV m - 2*bw - borderV p - render (Border config _) (BorderState widgetStates) w h screen = when (w > borderH m - 2*bw - borderH p) $ do + render (Border config _) (BorderState widgetStates) x y w h screen = when (w > borderH m - 2*bw - borderH p) $ do drawBorder config 0 0 w h clip - renderWidgets widgetStates screen + renderWidgets widgetStates screen x y + return () where m = margin config bw = borderWidth config |