| Copyright | (c) 2011 Diagrams-cairo team (see LICENSE) |
|---|---|
| License | BSD-style (see LICENSE) |
| Maintainer | diagrams-discuss@googlegroups.com |
| Safe Haskell | None |
| Language | Haskell2010 |
Diagrams.Backend.Gtk
Description
Convenient interface to rendering diagrams directly on Gtk widgets using the Cairo backend.
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.
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.