diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-07-17 19:20:19 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2011-07-17 19:20:19 +0200 |
commit | 0fefcaa35f217ca2e1f15e2dd77742adfd231571 (patch) | |
tree | 046600165a46fbb5a75508a5fe5b9e738124ab7e /lib/Phi/Border.hs | |
parent | b66d6690d8a062053268b3246a2a55cbff46410d (diff) | |
download | phi-0fefcaa35f217ca2e1f15e2dd77742adfd231571.tar phi-0fefcaa35f217ca2e1f15e2dd77742adfd231571.zip |
Some initial systray code
Diffstat (limited to 'lib/Phi/Border.hs')
-rw-r--r-- | lib/Phi/Border.hs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/Phi/Border.hs b/lib/Phi/Border.hs index 791845d..a025ab6 100644 --- a/lib/Phi/Border.hs +++ b/lib/Phi/Border.hs @@ -41,7 +41,7 @@ data BorderConfig = BorderConfig { margin :: !BorderWidth , padding :: !BorderWidth , borderColor :: !Color , backgroundColor :: !Color - , cornerRadius :: !Double + , cornerRadius :: !Int , borderWeight :: !Float } deriving Show @@ -60,11 +60,14 @@ instance WidgetClass Border where type WidgetData Border = BorderState initWidget (Border _ widgets) phi disp = liftM BorderState $ mapM (createWidgetState phi disp) widgets - minSize (Border config widgets) = sum (map (\(Widget w) -> minSize w) widgets) + borderH p + 2*bw + borderH m + minSize (Border config _) (BorderState widgetStates) height = + max (borderH m+2*(bw+cr)) $ sum (map (\(WidgetState {stateWidget = w, statePrivateData = priv}) -> minSize w priv height') widgetStates) + borderH p + 2*bw + borderH m where m = margin config bw = borderWidth config p = padding config + cr = cornerRadius config + height' = height - borderV m - 2*bw - borderV p weight (Border config _) = borderWeight config @@ -102,7 +105,7 @@ drawBorder config dx dy w h = do m = margin config bw = borderWidth config p = padding config - radius = cornerRadius config + radius = fromIntegral $ cornerRadius config x = (fromIntegral dx) + (fromIntegral $ borderLeft m) + (fromIntegral bw)/2 y = (fromIntegral dy) + (fromIntegral $ borderTop m) + (fromIntegral bw)/2 |