{-# LINE 2 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}-- -*-haskell-*--- GIMP Toolkit (GTK) Widget PrintContext---- Author : Andy Stewart---- Created: 28 Mar 2010---- Copyright (C) 2010 Andy Stewart---- This library is free software; you can redistribute it and/or-- modify it under the terms of the GNU Lesser General Public-- License as published by the Free Software Foundation; either-- version 2.1 of the License, or (at your option) any later version.---- This library is distributed in the hope that it will be useful,-- but WITHOUT ANY WARRANTY; without even the implied warranty of-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU-- Lesser General Public License for more details.---- |-- Maintainer : gtk2hs-users@lists.sourceforge.net-- Stability : provisional-- Portability : portable (depends on GHC)---- Encapsulates context for drawing pages---- * Module available since Gtk+ version 2.10--moduleGraphics.UI.Gtk.Printing.PrintContext(-- * Detail---- | A 'PrintContext' encapsulates context information that is required when-- drawing pages for printing, such as the cairo context and important-- parameters like page size and resolution. It also lets you easily create-- 'PangoLayout' and 'Context' objects that match the font metrics of the cairo-- surface.---- 'PrintContext' objects gets passed to the 'beginPrint', 'endPrint',-- 'requestPageSetup' and 'drawPage' signals on the 'PrintOperation'.---- Printing support was added in Gtk+ 2.10.-- * Class Hierarchy---- |-- @-- | 'GObject'-- | +----PrintContext-- @-- * TypesPrintContext,PrintContextClass,castToPrintContext,toPrintContext,-- * MethodsprintContextGetCairoContext,printContextSetCairoContext,printContextGetPageSetup,printContextGetWidth,printContextGetHeight,printContextGetDpiX,printContextGetDpiY,printContextGetPangoFontmap,printContextCreatePangoContext,printContextCreatePangoLayout,printContextGetHardMargins,)whereimportControl.Monad(liftM)importData.IORef(newIORef)importSystem.Glib.FFIimportGraphics.UI.Gtk.Types{-# LINE 82 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}importGraphics.Rendering.Pango.Types{-# LINE 83 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}importGraphics.Rendering.Pango.BasicTypes{-# LINE 84 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}importGraphics.Rendering.Cairo.Types{-# LINE 85 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}{-# LINE 87 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}---------------------- Methods-- | Obtains the cairo context that is associated with the 'PrintContext'.--printContextGetCairoContext::PrintContextClassself=>self->IOCairo-- ^ returns the cairo context of @context@printContextGetCairoContextself=liftMCairo$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_cairo_contextargPtr1)(toPrintContextself)-- | Sets a new cairo context on a print context.---- This function is intended to be used when implementing an internal print-- preview, it is not needed for printing, since Gtk+ itself creates a suitable-- cairo context in that case.--printContextSetCairoContext::PrintContextClassself=>self->Cairo-- ^ @cr@ - the cairo context->Double-- ^ @dpiX@ - the horizontal resolution to use with @cr@->Double-- ^ @dpiY@ - the vertical resolution to use with @cr@->IO()printContextSetCairoContextselfcrdpiXdpiY=(\(PrintContextarg1)(Cairoarg2)arg3arg4->withForeignPtrarg1$\argPtr1->gtk_print_context_set_cairo_contextargPtr1arg2arg3arg4){-# LINE 113 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)cr(realToFracdpiX)(realToFracdpiY)-- | Obtains the 'PageSetup' that determines the page dimensions of the-- 'PrintContext'.--printContextGetPageSetup::PrintContextClassself=>self->IOPageSetup-- ^ returns the page setup of @context@printContextGetPageSetupself=makeNewGObjectmkPageSetup$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_page_setupargPtr1){-# LINE 126 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Obtains the width of the 'PrintContext', in pixels.--printContextGetWidth::PrintContextClassself=>self->IODouble-- ^ returns the width of @context@printContextGetWidthself=liftMrealToFrac$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_widthargPtr1){-# LINE 135 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Obtains the height of the 'PrintContext', in pixels.--printContextGetHeight::PrintContextClassself=>self->IODouble-- ^ returns the height of @context@printContextGetHeightself=liftMrealToFrac$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_heightargPtr1){-# LINE 144 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Obtains the horizontal resolution of the 'PrintContext', in dots per-- inch.--printContextGetDpiX::PrintContextClassself=>self->IODouble-- ^ returns the horizontal resolution of @context@printContextGetDpiXself=liftMrealToFrac$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_dpi_xargPtr1){-# LINE 154 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Obtains the vertical resolution of the 'PrintContext', in dots per inch.--printContextGetDpiY::PrintContextClassself=>self->IODouble-- ^ returns the vertical resolution of @context@printContextGetDpiYself=liftMrealToFrac$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_dpi_yargPtr1){-# LINE 163 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Returns a 'FontMap' that is suitable for use with the 'PrintContext'.--printContextGetPangoFontmap::PrintContextClassself=>self->IOFontMap-- ^ returns the font map of @context@printContextGetPangoFontmapself=makeNewGObjectmkFontMap$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_get_pango_fontmapargPtr1){-# LINE 172 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Creates a new 'Context' that can be used with the 'PrintContext'.--printContextCreatePangoContext::PrintContextClassself=>self->IOPangoContext-- ^ returns a new Pango context for @context@printContextCreatePangoContextself=wrapNewGObjectmkPangoContext$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_create_pango_contextargPtr1){-# LINE 181 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)-- | Creates a new 'PangoLayout' that is suitable for use with the-- 'PrintContext'.--printContextCreatePangoLayout::PrintContextClassself=>self->IOPangoLayout-- ^ returns a new Pango layout for @context@printContextCreatePangoLayoutself=dopl<-wrapNewGObjectmkPangoLayoutRaw$(\(PrintContextarg1)->withForeignPtrarg1$\argPtr1->gtk_print_context_create_pango_layoutargPtr1){-# LINE 191 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)ps<-makeNewPangoString""psRef<-newIORefpsreturn(PangoLayoutpsRefpl)printContextGetHardMargins::PrintContextClassself=>self->IO(Maybe(Double,Double,Double,Double))-- ^ returns @(top, bottom, left, right)@-- @top@ top hardware printer margin-- @bottom@ bottom hardware printer margin-- @left@ left hardware printer margin-- @right@ right hardware printer marginprintContextGetHardMarginsself=alloca$\topPtr->alloca$\bottomPtr->alloca$\leftPtr->alloca$\rightPtr->dosuccess<-liftMtoBool$(\(PrintContextarg1)arg2arg3arg4arg5->withForeignPtrarg1$\argPtr1->gtk_print_context_get_hard_marginsargPtr1arg2arg3arg4arg5){-# LINE 210 "./Graphics/UI/Gtk/Printing/PrintContext.chs" #-}(toPrintContextself)topPtrbottomPtrleftPtrrightPtrifsuccessthendotop<-liftMrealToFrac$peektopPtrbottom<-liftMrealToFrac$peekbottomPtrleft<-liftMrealToFrac$peekleftPtrright<-liftMrealToFrac$peekrightPtrreturn$Just(top,bottom,left,right)elsereturnNothingforeignimportccallsafe"gtk_print_context_get_cairo_context"gtk_print_context_get_cairo_context::((PtrPrintContext)->(IO(PtrCairo)))foreignimportccallsafe"gtk_print_context_set_cairo_context"gtk_print_context_set_cairo_context::((PtrPrintContext)->((PtrCairo)->(CDouble->(CDouble->(IO())))))foreignimportccallsafe"gtk_print_context_get_page_setup"gtk_print_context_get_page_setup::((PtrPrintContext)->(IO(PtrPageSetup)))foreignimportccallsafe"gtk_print_context_get_width"gtk_print_context_get_width::((PtrPrintContext)->(IOCDouble))foreignimportccallsafe"gtk_print_context_get_height"gtk_print_context_get_height::((PtrPrintContext)->(IOCDouble))foreignimportccallsafe"gtk_print_context_get_dpi_x"gtk_print_context_get_dpi_x::((PtrPrintContext)->(IOCDouble))foreignimportccallsafe"gtk_print_context_get_dpi_y"gtk_print_context_get_dpi_y::((PtrPrintContext)->(IOCDouble))foreignimportccallsafe"gtk_print_context_get_pango_fontmap"gtk_print_context_get_pango_fontmap::((PtrPrintContext)->(IO(PtrFontMap)))foreignimportccallsafe"gtk_print_context_create_pango_context"gtk_print_context_create_pango_context::((PtrPrintContext)->(IO(PtrPangoContext)))foreignimportccallsafe"gtk_print_context_create_pango_layout"gtk_print_context_create_pango_layout::((PtrPrintContext)->(IO(PtrPangoLayoutRaw)))foreignimportccallsafe"gtk_print_context_get_hard_margins"gtk_print_context_get_hard_margins::((PtrPrintContext)->((PtrCDouble)->((PtrCDouble)->((PtrCDouble)->((PtrCDouble)->(IOCInt))))))