From 5b6f670fb3b69f103771c4042c0417c325e8d32f Mon Sep 17 00:00:00 2001 From: David Roundy Date: Tue, 23 Oct 2007 15:49:11 +0200 Subject: make DragPane work with any type (not just Windows). darcs-hash:20071023134911-72aca-d94c618211c707b74fa50cae1cc91606aca03262.gz --- DragPane.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'DragPane.hs') diff --git a/DragPane.hs b/DragPane.hs index 9a058ac..05dbd42 100644 --- a/DragPane.hs +++ b/DragPane.hs @@ -64,7 +64,7 @@ data DragPane a = data DragType = Horizontal | Vertical deriving ( Show, Read ) -instance LayoutClass DragPane Window where +instance LayoutClass DragPane a where doLayout d@(DragPane _ Vertical _ _) = doLay id d doLayout d@(DragPane _ Horizontal _ _) = doLay mirrorRect d handleMessage = handleMess @@ -72,7 +72,7 @@ instance LayoutClass DragPane Window where data SetFrac = SetFrac Int Double deriving ( Show, Read, Eq, Typeable ) instance Message SetFrac -handleMess :: DragPane Window -> SomeMessage -> X (Maybe (DragPane Window)) +handleMess :: DragPane a -> SomeMessage -> X (Maybe (DragPane a)) handleMess d@(DragPane mb@(I (Just (win,_,ident))) ty delta split) x | Just e <- fromMessage x :: Maybe Event = do handleEvent d e return Nothing @@ -87,7 +87,7 @@ handleMess d@(DragPane mb@(I (Just (win,_,ident))) ty delta split) x return $ Just (DragPane mb ty delta frac) handleMess _ _ = return Nothing -handleEvent :: DragPane Window -> Event -> X () +handleEvent :: DragPane a -> Event -> X () handleEvent (DragPane (I (Just (win,r,ident))) ty _ _) (ButtonEvent {ev_window = thisw, ev_subwindow = thisbw, ev_event_type = t }) | t == buttonPress && thisw == win || thisbw == win = do @@ -99,7 +99,7 @@ handleEvent (DragPane (I (Just (win,r,ident))) ty _ _) (return ()) handleEvent _ _ = return () -doLay :: (Rectangle -> Rectangle) -> DragPane Window -> Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (DragPane a)) +doLay :: (Rectangle -> Rectangle) -> DragPane a -> Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (DragPane a)) doLay mirror (DragPane mw ty delta split) r s = do let r' = mirror r (left', right') = splitHorizontallyBy split r' -- cgit v1.2.3