diff options
Diffstat (limited to 'lib/Phi/Widgets/AlphaBox.hs')
-rw-r--r-- | lib/Phi/Widgets/AlphaBox.hs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Phi/Widgets/AlphaBox.hs b/lib/Phi/Widgets/AlphaBox.hs index dd4bfba..2db17f4 100644 --- a/lib/Phi/Widgets/AlphaBox.hs +++ b/lib/Phi/Widgets/AlphaBox.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE MultiParamTypeClasses #-} module Phi.Widgets.AlphaBox ( alphaBox ) where @@ -11,13 +11,12 @@ import Control.Monad import Graphics.Rendering.Cairo -data AlphaBoxState = AlphaBoxState ![WidgetState] deriving Show +data AlphaBoxState = AlphaBoxState ![WidgetState] deriving Eq -data AlphaBox = AlphaBox !Double ![Widget] deriving Show +data AlphaBox = AlphaBox !Double ![Widget] deriving (Show, Eq) -instance WidgetClass AlphaBox where - type WidgetData AlphaBox = AlphaBoxState +instance WidgetClass AlphaBox AlphaBoxState where initWidget (AlphaBox _ widgets) phi disp = liftM AlphaBoxState $ mapM (createWidgetState phi disp) widgets minSize (AlphaBox _ _) (AlphaBoxState widgetStates) height screen = @@ -27,10 +26,10 @@ instance WidgetClass AlphaBox where layout (AlphaBox _ _) (AlphaBoxState widgetStates) width height screen = AlphaBoxState $ layoutWidgets widgetStates 0 0 width height screen - render (AlphaBox alpha _) (AlphaBoxState widgetStates) w h screen = do + render (AlphaBox alpha _) (AlphaBoxState widgetStates) x y w h screen = do renderWithSimilarSurface ContentColorAlpha w h $ \surface -> do renderWith surface $ do - renderWidgets widgetStates screen + renderWidgets widgetStates screen x y setOperator OperatorDestIn setSourceRGBA 0 0 0 alpha |