packages feed

DysFRP-Craftwerk (empty) → 0.1

raw patch · 4 files changed

+89/−0 lines, 4 filesdep +DysFRPdep +DysFRP-Cairodep +basesetup-changed

Dependencies added: DysFRP, DysFRP-Cairo, base, cairo, containers, craftwerk, craftwerk-gtk, gtk

Files

+ Control/DysFRP/Craftwerk.hs view
@@ -0,0 +1,46 @@+module Control.DysFRP.Craftwerk(+    drawFigureOnDrawable, +    render, renderB,+    compositionB, rotateB, translateB, translate2B, scaleB, scale2B+) where++import qualified Control.DysFRP as R+import Control.DysFRP.Cairo+import Data.IORef+import Control.Applicative+import Graphics.UI.Gtk+import Graphics.UI.Gtk.Gdk.GC+import Graphics.Craftwerk.Core+import Graphics.Craftwerk.UI.Gtk hiding (RenderContext)+import qualified Graphics.Rendering.Cairo as C+import Foreign.Ptr+import qualified Data.Map as Map+import Data.Traversable++drawFigureOnDrawable :: DrawableClass d => Double -> Double -> d -> Figure -> IO ()+drawFigureOnDrawable px py srf fig = drawContextOnDrawable srf (render px py fig)++renderB :: Double -> Double -> R.Behavior Figure -> R.Behavior (RenderContext)+renderB px py = fmap (render px py)++render :: Double -> Double -> Figure -> RenderContext+render px py fig = cairo (renderFigure px py (\_ -> return fig)) Map.empty++compositionB :: [R.Behavior Figure] -> R.Behavior Figure+compositionB = fmap composition . sequenceA++rotateB :: R.Behavior Double -> R.Behavior Figure -> R.Behavior Figure+rotateB = liftA2 rotate++translateB :: R.Behavior Vector -> R.Behavior Figure -> R.Behavior Figure+translateB = liftA2 translate++translate2B :: R.Behavior Double -> R.Behavior Double -> R.Behavior Figure -> R.Behavior Figure+translate2B x y = translateB (liftA2 (,) x y)++scaleB :: R.Behavior Vector -> R.Behavior Figure -> R.Behavior Figure+scaleB = liftA2 scale++scale2B :: R.Behavior Double -> R.Behavior Double -> R.Behavior Figure -> R.Behavior Figure+scale2B x y = scaleB (liftA2 (,) x y)+
+ DysFRP-Craftwerk.cabal view
@@ -0,0 +1,18 @@+Name: DysFRP-Craftwerk+Version: 0.1+License: BSD3+License-File: LICENSE+Author: Marek Materzok+Maintainer: Marek Materzok+Build-Type: Simple+Stability: experimental+Cabal-Version: >= 1.2+Homepage: https://github.com/tilk/DysFRP+Category: FRP+Synopsis: dysFunctional Reactive Programming on Craftwerk+Description: Simple Craftwerk bindings for DysFRP.++Library+    Build-Depends: base >= 4 && < 5, cairo, gtk, containers, craftwerk, craftwerk-gtk, DysFRP, DysFRP-Cairo+    Exposed-modules: Control.DysFRP.Craftwerk+
+ LICENSE view
@@ -0,0 +1,22 @@+Copyright (c) 2012, Marek Materzok+All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:+    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.+    * Redistributions in binary form must reproduce the above copyright+      notice, this list of conditions and the following disclaimer in the+      documentation and/or other materials provided with the distribution.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.+
+ Setup.hs view
@@ -0,0 +1,3 @@+import Distribution.Simple+main = defaultMain+