summaryrefslogtreecommitdiffstats
path: root/lib/Phi/Widget.hs
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Phi/Widget.hs')
-rw-r--r--lib/Phi/Widget.hs8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/Phi/Widget.hs b/lib/Phi/Widget.hs
index 48ab536..d954b58 100644
--- a/lib/Phi/Widget.hs
+++ b/lib/Phi/Widget.hs
@@ -64,7 +64,7 @@ class Show a => WidgetClass a where
initWidget :: a -> Phi -> Display -> IO (WidgetData a)
- minSize :: a -> Int
+ minSize :: a -> WidgetData a -> Int -> Int
weight :: a -> Float
weight _ = 0
@@ -104,7 +104,7 @@ createWidgetState phi disp (Widget w) = do
layoutWidgets :: [WidgetState] -> Int -> Int -> Int -> Int -> [WidgetState]
layoutWidgets widgets x y width height = snd $ mapAccumL layoutWidgetAndX x widgets
where
- sizesum = sum $ map (\(WidgetState {stateWidget = w} ) -> nneg . minSize $ w) widgets
+ sizesum = sum $ map (\(WidgetState {stateWidget = w, statePrivateData = priv} ) -> nneg $ minSize w priv height) widgets
wsum = let wsum = sum $ map (\(WidgetState {stateWidget = w} ) -> nneg . weight $ w) widgets
in if wsum > 0 then wsum else 1
@@ -115,7 +115,7 @@ layoutWidgets widgets x y width height = snd $ mapAccumL layoutWidgetAndX x widg
layoutWidget wX state = case state of
WidgetState {stateWidget = w, statePrivateData = priv} ->
- let wWidth = floor $ (fromIntegral $ minSize w) + (fromIntegral surplus)*(nneg $ weight w)/wsum
+ let wWidth = floor $ (fromIntegral $ minSize w priv height) + (fromIntegral surplus)*(nneg $ weight w)/wsum
priv' = layout w priv wWidth height
in WidgetState w wX y wWidth height priv'
@@ -145,7 +145,7 @@ instance WidgetClass Separator where
type WidgetData Separator = ()
initWidget _ _ _ = return ()
- minSize (Separator s _) = s
+ minSize (Separator s _) _ _ = s
weight (Separator _ w) = w
render _ _ _ _ _ = return ()