diagrams-gtk-1.3.0.2: Backend for rendering diagrams directly to GTK windows

Copyright(c) 2011 Diagrams-cairo team (see LICENSE)
LicenseBSD-style (see LICENSE)
Maintainerdiagrams-discuss@googlegroups.com
Safe HaskellNone
LanguageHaskell2010

Diagrams.Backend.Gtk

Description

Convenient interface to rendering diagrams directly on Gtk widgets using the Cairo backend.

Synopsis

Documentation

defaultRender :: Monoid' m => DrawingArea -> QDiagram Cairo V2 Double m -> IO () Source #

Render a diagram to a DrawingArea with double buffering, rescaling to fit the full area.

toGtkCoords :: Monoid' m => QDiagram Cairo V2 Double m -> QDiagram Cairo V2 Double m Source #

Convert a Diagram to the backend coordinates.

Provided to Query the diagram with coordinates from a mouse click event.

widget `on` buttonPressEvent $ tryEvent $ do
  click <- eventClick
  (x,y) <- eventCoordinates
  let result = runQuery (query $ toGtkCoords myDiagram) (x ^& y)
  do_something_with result

toGtkCoords does no rescaling of the diagram, however it is centered in the window.

renderToGtk Source #

Arguments

:: (DrawableClass dc, Monoid' m) 
=> dc

widget to render onto

-> QDiagram Cairo V2 Double m

Diagram

-> IO () 

Render a diagram to a DrawableClass with double buffering. No rescaling or transformations will be performed.

Typically the diagram will already have been transformed by toGtkCoords.