Chart-gtk 1.3 → 1.3.1
raw patch · 2 files changed
+17/−2 lines, 2 filesdep +data-default-classPVP ok
version bump matches the API change (PVP)
Dependencies added: data-default-class
API changes (from Hackage documentation)
+ Graphics.Rendering.Chart.Gtk: toWindow :: (Default r, ToRenderable r) => Int -> Int -> EC r () -> IO ()
Files
- Chart-gtk.cabal +3/−2
- Graphics/Rendering/Chart/Gtk.hs +14/−0
Chart-gtk.cabal view
@@ -1,8 +1,8 @@ Name: Chart-gtk-Version: 1.3+Version: 1.3.1 License: BSD3 License-file: LICENSE-Copyright: Tim Docker, 2006-2010+Copyright: Tim Docker, 2006-2014 Author: Tim Docker <tim@dockerz.net> Maintainer: Tim Docker <tim@dockerz.net> Homepage: https://github.com/timbod7/haskell-chart/wiki@@ -17,6 +17,7 @@ , old-locale , time, mtl, array , cairo >= 0.9.11+ , data-default-class < 0.1 , colour >= 2.2.1 && < 2.4 , colour >= 2.2.1 , gtk >= 0.9.11
Graphics/Rendering/Chart/Gtk.hs view
@@ -6,6 +6,7 @@ module Graphics.Rendering.Chart.Gtk( renderableToWindow,+ toWindow, createRenderableWindow, updateCanvas ) where@@ -13,16 +14,22 @@ import qualified Graphics.UI.Gtk as G import qualified Graphics.UI.Gtk.Gdk.Events as GE import qualified Graphics.Rendering.Cairo as C+ import Graphics.Rendering.Chart import Graphics.Rendering.Chart.Renderable import Graphics.Rendering.Chart.Geometry import Graphics.Rendering.Chart.Drawing import Graphics.Rendering.Chart.Backend.Cairo+import Graphics.Rendering.Chart.State(EC, execEC)+ import Data.List (isPrefixOf) import Data.IORef+import Data.Default.Class+ import Control.Monad(when) import System.IO.Unsafe(unsafePerformIO) + -- do action m for any keypress (except modified keys) anyKey :: (Monad m) => m a -> GE.Event -> m Bool anyKey m (GE.Key {GE.eventModifier=[]}) = m >> return True@@ -59,6 +66,13 @@ G.onDestroy window G.mainQuit G.widgetShowAll window G.mainGUI++-- | Generate a new GTK window from the state content of+-- an EC computation. The state may have any type that is+-- an instance of `ToRenderable`+toWindow :: (Default r, ToRenderable r) =>Int -> Int -> EC r () -> IO ()+toWindow windowWidth windowHeight ec = renderableToWindow r windowWidth windowHeight where+ r = toRenderable (execEC ec) -- | Create a new GTK window displaying a renderable. createRenderableWindow :: Renderable a -> Int -> Int -> IO G.Window