summaryrefslogtreecommitdiffstats
path: root/lib/Phi/Border.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Phi/Border.hs')
-rw-r--r--lib/Phi/Border.hs20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/Phi/Border.hs b/lib/Phi/Border.hs
index 42a0e8e..a110f2d 100644
--- a/lib/Phi/Border.hs
+++ b/lib/Phi/Border.hs
@@ -1,9 +1,12 @@
+{-# LANGUAGE TypeFamilies #-}
+
module Phi.Border ( BorderWidth(..)
, simpleBorderWidth
, border
) where
-import Phi.Panel
+import Phi.Types
+import Phi.Widget
import Graphics.Rendering.Cairo
@@ -30,11 +33,14 @@ data Border = Border { margin :: !BorderWidth
, backgroundColor :: !Color
, cornerRadius :: !Double
, borderWeight :: !Float
- , content :: !Panel
+ , content :: ![Widget]
}
-instance PanelClass Border where
- minSize border = minSize c + borderH p + 2*bw + borderH m
+instance WidgetClass Border where
+ type WidgetData Border = ()
+ initialState _ = ()
+
+ minSize border = sum (map (\(Widget w) -> minSize w) c) + borderH p + 2*bw + borderH m
where
m = margin border
bw = borderWidth border
@@ -43,7 +49,7 @@ instance PanelClass Border where
weight border = borderWeight border
- render border w h = do
+ render border _ w h = do
newPath
arc (x + width - radius) (y + radius) radius (-pi/2) 0
arc (x + width - radius) (y + height - radius) radius 0 (pi/2)
@@ -73,5 +79,5 @@ instance PanelClass Border where
(fr, fg, fb, fa) = backgroundColor border
-border :: BorderWidth -> Int -> BorderWidth -> Color -> Color -> Double -> Float -> Panel -> Panel
-border m bw p border bc cr w c = Panel $ Border m bw p border bc cr w c \ No newline at end of file
+border :: BorderWidth -> Int -> BorderWidth -> Color -> Color -> Double -> Float -> [Widget] -> Widget
+border m bw p border bc cr w c = Widget $ Border m bw p border bc cr w c \ No newline at end of file