------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-2010 Vadim Godunko <vgodunko@gmail.com>                 --
--                                                                          --
-- QtAda is free software;  you can  redistribute it and/or modify it under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 2,  or (at your option) any later ver- --
-- sion. QtAda is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY;  without even the  implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License --
-- for  more details.  You should have  received  a copy of the GNU General --
-- Public License distributed with QtAda;  see file COPYING.  If not, write --
-- to  the  Free Software Foundation,  51  Franklin  Street,  Fifth  Floor, --
-- Boston, MA 02110-1301, USA.                                              --
--                                                                          --
-- As a special exception,  if other files  instantiate  generics from this --
-- unit, or you link  this unit with other files  to produce an executable, --
-- this  unit  does not  by itself cause  the resulting  executable  to  be --
-- covered  by the  GNU  General  Public  License.  This exception does not --
-- however invalidate  any other reasons why  the executable file  might be --
-- covered by the  GNU Public License.                                      --
--                                                                          --
------------------------------------------------------------------------------
--    This file has been generated automatically. Please don't edit it.     --
------------------------------------------------------------------------------
with Qt_Ada.Internals.Boolean_Conversions;
with System.Address_To_Access_Conversions;

package body Qt4.Printers is

   function initialize_QPrinter
    (Storage : System.Address)
      return Internals.QPrinter_Access;
   pragma Import (C, initialize_QPrinter, "__QtAda_inititialize_QPrinter");

   function initialize_QPrinter_PrinterMode
    (Storage : System.Address;
     Mode    : Printer_Mode)
      return Internals.QPrinter_Access;
   pragma Import (C, initialize_QPrinter_PrinterMode, "__QtAda_inititialize_QPrinter_PrinterMode");

   procedure finalize_QPrinter (Object : Internals.QPrinter_Access);
   pragma Import (C, finalize_QPrinter, "__QtAda_finalize_QPrinter");

   function QPrinter_abort
    (Self : Internals.QPrinter_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPrinter_abort, "__QtAda_QPrinter_abort");

   function QPrinter_collateCopies
    (Self : Internals.QPrinter_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPrinter_collateCopies, "__QtAda_QPrinter_collateCopies_Q");

   function QPrinter_colorMode
    (Self : Internals.QPrinter_Access)
       return Printer_Color_Mode;
   pragma Import (C, QPrinter_colorMode, "__QtAda_QPrinter_colorMode_Q");

   procedure QPrinter_creator
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_creator, "__QtAda_QPrinter_creator_Q");

   procedure QPrinter_docName
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_docName, "__QtAda_QPrinter_docName_Q");

   function QPrinter_doubleSidedPrinting
    (Self : Internals.QPrinter_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPrinter_doubleSidedPrinting, "__QtAda_QPrinter_doubleSidedPrinting_Q");

   function QPrinter_fontEmbeddingEnabled
    (Self : Internals.QPrinter_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPrinter_fontEmbeddingEnabled, "__QtAda_QPrinter_fontEmbeddingEnabled_Q");

   function QPrinter_fromPage
    (Self : Internals.QPrinter_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QPrinter_fromPage, "__QtAda_QPrinter_fromPage_Q");

   function QPrinter_fullPage
    (Self : Internals.QPrinter_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPrinter_fullPage, "__QtAda_QPrinter_fullPage_Q");

   function QPrinter_newPage
    (Self : Internals.QPrinter_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPrinter_newPage, "__QtAda_QPrinter_newPage");

   function QPrinter_numCopies
    (Self : Internals.QPrinter_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QPrinter_numCopies, "__QtAda_QPrinter_numCopies_Q");

   function QPrinter_orientation
    (Self : Internals.QPrinter_Access)
       return Printer_Orientation;
   pragma Import (C, QPrinter_orientation, "__QtAda_QPrinter_orientation_Q");

   procedure QPrinter_outputFileName
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_outputFileName, "__QtAda_QPrinter_outputFileName_Q");

   function QPrinter_outputFormat
    (Self : Internals.QPrinter_Access)
       return Printer_Output_Format;
   pragma Import (C, QPrinter_outputFormat, "__QtAda_QPrinter_outputFormat_Q");

   function QPrinter_pageOrder
    (Self : Internals.QPrinter_Access)
       return Printer_Page_Order;
   pragma Import (C, QPrinter_pageOrder, "__QtAda_QPrinter_pageOrder_Q");

   procedure QPrinter_pageRect
    (Returns : Qt4.Rects.Internals.QRect_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_pageRect, "__QtAda_QPrinter_pageRect_Q");

   function QPrinter_pageSize
    (Self : Internals.QPrinter_Access)
       return Printer_Page_Size;
   pragma Import (C, QPrinter_pageSize, "__QtAda_QPrinter_pageSize_Q");

   procedure QPrinter_paperRect
    (Returns : Qt4.Rects.Internals.QRect_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_paperRect, "__QtAda_QPrinter_paperRect_Q");

   function QPrinter_paperSize
    (Self : Internals.QPrinter_Access)
       return Printer_Paper_Size;
   pragma Import (C, QPrinter_paperSize, "__QtAda_QPrinter_paperSize_Q");

   procedure QPrinter_paperSize_Unit
    (Returns : Qt4.Size_Fs.Internals.QSizeF_Access;
     Self    : Internals.QPrinter_Access;
     Unit    : Printer_Unit);
   pragma Import (C, QPrinter_paperSize_Unit, "__QtAda_QPrinter_paperSize_Unit_Q");

   function QPrinter_paperSource
    (Self : Internals.QPrinter_Access)
       return Printer_Paper_Source;
   pragma Import (C, QPrinter_paperSource, "__QtAda_QPrinter_paperSource_Q");

   procedure QPrinter_printProgram
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_printProgram, "__QtAda_QPrinter_printProgram_Q");

   function QPrinter_printRange
    (Self : Internals.QPrinter_Access)
       return Printer_Print_Range;
   pragma Import (C, QPrinter_printRange, "__QtAda_QPrinter_printRange_Q");

   procedure QPrinter_printerName
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self    : Internals.QPrinter_Access);
   pragma Import (C, QPrinter_printerName, "__QtAda_QPrinter_printerName_Q");

   function QPrinter_printerState
    (Self : Internals.QPrinter_Access)
       return Printer_Printer_State;
   pragma Import (C, QPrinter_printerState, "__QtAda_QPrinter_printerState_Q");

   function QPrinter_resolution
    (Self : Internals.QPrinter_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QPrinter_resolution, "__QtAda_QPrinter_resolution_Q");

   procedure QPrinter_setCollateCopies_bool
    (Self    : Internals.QPrinter_Access;
     Collate : Interfaces.C.unsigned);
   pragma Import (C, QPrinter_setCollateCopies_bool, "__QtAda_QPrinter_setCollateCopies_bool");

   procedure QPrinter_setColorMode_ColorMode
    (Self : Internals.QPrinter_Access;
     Mode : Printer_Color_Mode);
   pragma Import (C, QPrinter_setColorMode_ColorMode, "__QtAda_QPrinter_setColorMode_ColorMode");

   procedure QPrinter_setCreator_QStringCR
    (Self    : Internals.QPrinter_Access;
     Creator : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QPrinter_setCreator_QStringCR, "__QtAda_QPrinter_setCreator_QStringCR");

   procedure QPrinter_setDocName_QStringCR
    (Self : Internals.QPrinter_Access;
     Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QPrinter_setDocName_QStringCR, "__QtAda_QPrinter_setDocName_QStringCR");

   procedure QPrinter_setDoubleSidedPrinting_bool
    (Self   : Internals.QPrinter_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QPrinter_setDoubleSidedPrinting_bool, "__QtAda_QPrinter_setDoubleSidedPrinting_bool");

   procedure QPrinter_setFontEmbeddingEnabled_bool
    (Self   : Internals.QPrinter_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QPrinter_setFontEmbeddingEnabled_bool, "__QtAda_QPrinter_setFontEmbeddingEnabled_bool");

   procedure QPrinter_setFromTo_int_int
    (Self      : Internals.QPrinter_Access;
     From_Page : Qt4.Q_Integer;
     To_Page   : Qt4.Q_Integer);
   pragma Import (C, QPrinter_setFromTo_int_int, "__QtAda_QPrinter_setFromTo_int_int");

   procedure QPrinter_setFullPage_bool
    (Self : Internals.QPrinter_Access;
     Fp   : Interfaces.C.unsigned);
   pragma Import (C, QPrinter_setFullPage_bool, "__QtAda_QPrinter_setFullPage_bool");

   procedure QPrinter_setNumCopies_int
    (Self       : Internals.QPrinter_Access;
     Num_Copies : Qt4.Q_Integer);
   pragma Import (C, QPrinter_setNumCopies_int, "__QtAda_QPrinter_setNumCopies_int");

   procedure QPrinter_setOrientation_Orientation
    (Self              : Internals.QPrinter_Access;
     Print_Orientation : Printer_Orientation);
   pragma Import (C, QPrinter_setOrientation_Orientation, "__QtAda_QPrinter_setOrientation_Orientation");

   procedure QPrinter_setOutputFileName_QStringCR
    (Self      : Internals.QPrinter_Access;
     File_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QPrinter_setOutputFileName_QStringCR, "__QtAda_QPrinter_setOutputFileName_QStringCR");

   procedure QPrinter_setOutputFormat_OutputFormat
    (Self   : Internals.QPrinter_Access;
     Format : Printer_Output_Format);
   pragma Import (C, QPrinter_setOutputFormat_OutputFormat, "__QtAda_QPrinter_setOutputFormat_OutputFormat");

   procedure QPrinter_setPageMargins_qreal_qreal_qreal_qreal_Unit
    (Self   : Internals.QPrinter_Access;
     Left   : Qt4.Q_Real;
     Top    : Qt4.Q_Real;
     Right  : Qt4.Q_Real;
     Bottom : Qt4.Q_Real;
     Unit   : Printer_Unit);
   pragma Import (C, QPrinter_setPageMargins_qreal_qreal_qreal_qreal_Unit, "__QtAda_QPrinter_setPageMargins_qreal_qreal_qreal_qreal_Unit");

   procedure QPrinter_setPageOrder_PageOrder
    (Self  : Internals.QPrinter_Access;
     Order : Printer_Page_Order);
   pragma Import (C, QPrinter_setPageOrder_PageOrder, "__QtAda_QPrinter_setPageOrder_PageOrder");

   procedure QPrinter_setPageSize_PageSize
    (Self : Internals.QPrinter_Access;
     Size : Printer_Page_Size);
   pragma Import (C, QPrinter_setPageSize_PageSize, "__QtAda_QPrinter_setPageSize_PageSize");

   procedure QPrinter_setPaperSize_PaperSize
    (Self           : Internals.QPrinter_Access;
     New_Paper_Size : Printer_Paper_Size);
   pragma Import (C, QPrinter_setPaperSize_PaperSize, "__QtAda_QPrinter_setPaperSize_PaperSize");

   procedure QPrinter_setPaperSize_QSizeFCR_Unit
    (Self       : Internals.QPrinter_Access;
     Paper_Size : Qt4.Size_Fs.Internals.QSizeF_Access;
     Unit       : Printer_Unit);
   pragma Import (C, QPrinter_setPaperSize_QSizeFCR_Unit, "__QtAda_QPrinter_setPaperSize_QSizeFCR_Unit");

   procedure QPrinter_setPaperSource_PaperSource
    (Self   : Internals.QPrinter_Access;
     Source : Printer_Paper_Source);
   pragma Import (C, QPrinter_setPaperSource_PaperSource, "__QtAda_QPrinter_setPaperSource_PaperSource");

   procedure QPrinter_setPrintProgram_QStringCR
    (Self    : Internals.QPrinter_Access;
     Program : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QPrinter_setPrintProgram_QStringCR, "__QtAda_QPrinter_setPrintProgram_QStringCR");

   procedure QPrinter_setPrintRange_PrintRange
    (Self    : Internals.QPrinter_Access;
     P_Range : Printer_Print_Range);
   pragma Import (C, QPrinter_setPrintRange_PrintRange, "__QtAda_QPrinter_setPrintRange_PrintRange");

   procedure QPrinter_setPrinterName_QStringCR
    (Self : Internals.QPrinter_Access;
     Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QPrinter_setPrinterName_QStringCR, "__QtAda_QPrinter_setPrinterName_QStringCR");

   procedure QPrinter_setResolution_int
    (Self       : Internals.QPrinter_Access;
     Resolution : Qt4.Q_Integer);
   pragma Import (C, QPrinter_setResolution_int, "__QtAda_QPrinter_setResolution_int");

   function QPrinter_toPage
    (Self : Internals.QPrinter_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QPrinter_toPage, "__QtAda_QPrinter_toPage_Q");

   function C_QPaintDevice_View
    (Self : not null Internals.QPrinter_Access)
       return not null Qt_Ada.Internals.Paint_Devices.QPaintDevice_Access;
   pragma Import (C, C_QPaintDevice_View, "__QtAda_QPrinter_QPaintDevice_View");

   --------------
   -- Finalize --
   --------------

   overriding
   procedure Finalize (Self : in out Q_Printer) is
   begin
      if not Self.Wrapper then
         finalize_QPrinter (Self.Object);
      end if;
   end Finalize;

   ----------------
   -- Initialize --
   ----------------

   overriding
   procedure Initialize (Self : in out Q_Printer) is
      use type Internals.QPrinter_Access;

   begin
      if Self.Object = null then
         Self.Object := initialize_QPrinter (Self.Storage'Address);
      end if;
   end Initialize;

   ------------
   -- Create --
   ------------

   function Create
    (Mode : Printer_Mode := Screen_Resolution)
       return Q_Printer
   is
   begin
      return Self : Q_Printer
        := (Ada.Finalization.Limited_Controlled with others => <>)
      do
         Self.Object := initialize_QPrinter_PrinterMode (Self.Storage'Address, Mode);
      end return;
   end Create;

   -----------------
   -- Abort_Print --
   -----------------

   function Abort_Print
    (Self : not null access Q_Printer'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPrinter_abort (Self.Object), 0);
   end Abort_Print;

   --------------------
   -- Collate_Copies --
   --------------------

   function Collate_Copies
    (Self : Q_Printer'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPrinter_collateCopies (Self.Object), 0);
   end Collate_Copies;

   ----------------
   -- Color_Mode --
   ----------------

   function Color_Mode
    (Self : Q_Printer'Class)
       return Printer_Color_Mode
   is
   begin
      return QPrinter_colorMode (Self.Object);
   end Color_Mode;

   -------------
   -- Creator --
   -------------

   function Creator
    (Self : Q_Printer'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QPrinter_creator (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Creator;

   --------------
   -- Doc_Name --
   --------------

   function Doc_Name
    (Self : Q_Printer'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QPrinter_docName (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Doc_Name;

   ---------------------------
   -- Double_Sided_Printing --
   ---------------------------

   function Double_Sided_Printing
    (Self : Q_Printer'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPrinter_doubleSidedPrinting (Self.Object), 0);
   end Double_Sided_Printing;

   ----------------------------
   -- Font_Embedding_Enabled --
   ----------------------------

   function Font_Embedding_Enabled
    (Self : Q_Printer'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPrinter_fontEmbeddingEnabled (Self.Object), 0);
   end Font_Embedding_Enabled;

   ---------------
   -- From_Page --
   ---------------

   function From_Page
    (Self : Q_Printer'Class)
       return Qt4.Q_Integer
   is
   begin
      return QPrinter_fromPage (Self.Object);
   end From_Page;

   ---------------
   -- Full_Page --
   ---------------

   function Full_Page
    (Self : Q_Printer'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPrinter_fullPage (Self.Object), 0);
   end Full_Page;

   --------------
   -- New_Page --
   --------------

   function New_Page
    (Self : not null access Q_Printer'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPrinter_newPage (Self.Object), 0);
   end New_Page;

   ----------------
   -- Num_Copies --
   ----------------

   function Num_Copies
    (Self : Q_Printer'Class)
       return Qt4.Q_Integer
   is
   begin
      return QPrinter_numCopies (Self.Object);
   end Num_Copies;

   -----------------
   -- Orientation --
   -----------------

   function Orientation
    (Self : Q_Printer'Class)
       return Printer_Orientation
   is
   begin
      return QPrinter_orientation (Self.Object);
   end Orientation;

   ----------------------
   -- Output_File_Name --
   ----------------------

   function Output_File_Name
    (Self : Q_Printer'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QPrinter_outputFileName (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Output_File_Name;

   -------------------
   -- Output_Format --
   -------------------

   function Output_Format
    (Self : Q_Printer'Class)
       return Printer_Output_Format
   is
   begin
      return QPrinter_outputFormat (Self.Object);
   end Output_Format;

   ----------------
   -- Page_Order --
   ----------------

   function Page_Order
    (Self : Q_Printer'Class)
       return Printer_Page_Order
   is
   begin
      return QPrinter_pageOrder (Self.Object);
   end Page_Order;

   ---------------
   -- Page_Rect --
   ---------------

   function Page_Rect
    (Self : Q_Printer'Class)
       return Qt4.Rects.Q_Rect
   is
   begin
      return Returns : Qt4.Rects.Q_Rect do
         QPrinter_pageRect (Qt4.Rects.Internals.QRect_View (Returns), Self.Object);
      end return;
   end Page_Rect;

   ---------------
   -- Page_Size --
   ---------------

   function Page_Size
    (Self : Q_Printer'Class)
       return Printer_Page_Size
   is
   begin
      return QPrinter_pageSize (Self.Object);
   end Page_Size;

   ----------------
   -- Paper_Rect --
   ----------------

   function Paper_Rect
    (Self : Q_Printer'Class)
       return Qt4.Rects.Q_Rect
   is
   begin
      return Returns : Qt4.Rects.Q_Rect do
         QPrinter_paperRect (Qt4.Rects.Internals.QRect_View (Returns), Self.Object);
      end return;
   end Paper_Rect;

   ----------------
   -- Paper_Size --
   ----------------

   function Paper_Size
    (Self : Q_Printer'Class)
       return Printer_Paper_Size
   is
   begin
      return QPrinter_paperSize (Self.Object);
   end Paper_Size;

   ----------------
   -- Paper_Size --
   ----------------

   function Paper_Size
    (Self : Q_Printer'Class;
     Unit : Printer_Unit)
       return Qt4.Size_Fs.Q_Size_F
   is
   begin
      return Returns : Qt4.Size_Fs.Q_Size_F do
         QPrinter_paperSize_Unit (Qt4.Size_Fs.Internals.QSizeF_View (Returns), Self.Object, Unit);
      end return;
   end Paper_Size;

   ------------------
   -- Paper_Source --
   ------------------

   function Paper_Source
    (Self : Q_Printer'Class)
       return Printer_Paper_Source
   is
   begin
      return QPrinter_paperSource (Self.Object);
   end Paper_Source;

   -------------------
   -- Print_Program --
   -------------------

   function Print_Program
    (Self : Q_Printer'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QPrinter_printProgram (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Print_Program;

   -----------------
   -- Print_Range --
   -----------------

   function Print_Range
    (Self : Q_Printer'Class)
       return Printer_Print_Range
   is
   begin
      return QPrinter_printRange (Self.Object);
   end Print_Range;

   ------------------
   -- Printer_Name --
   ------------------

   function Printer_Name
    (Self : Q_Printer'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QPrinter_printerName (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Printer_Name;

   -------------------
   -- Printer_State --
   -------------------

   function Printer_State
    (Self : Q_Printer'Class)
       return Printer_Printer_State
   is
   begin
      return QPrinter_printerState (Self.Object);
   end Printer_State;

   ----------------
   -- Resolution --
   ----------------

   function Resolution
    (Self : Q_Printer'Class)
       return Qt4.Q_Integer
   is
   begin
      return QPrinter_resolution (Self.Object);
   end Resolution;

   ------------------------
   -- Set_Collate_Copies --
   ------------------------

   procedure Set_Collate_Copies
    (Self    : in out Q_Printer'Class;
     Collate : Boolean)
   is
   begin
      QPrinter_setCollateCopies_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Collate));
   end Set_Collate_Copies;

   --------------------
   -- Set_Color_Mode --
   --------------------

   procedure Set_Color_Mode
    (Self : in out Q_Printer'Class;
     Mode : Printer_Color_Mode)
   is
   begin
      QPrinter_setColorMode_ColorMode (Self.Object, Mode);
   end Set_Color_Mode;

   -----------------
   -- Set_Creator --
   -----------------

   procedure Set_Creator
    (Self    : in out Q_Printer'Class;
     Creator : Qt4.Strings.Q_String'Class)
   is
   begin
      QPrinter_setCreator_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Creator));
   end Set_Creator;

   ------------------
   -- Set_Doc_Name --
   ------------------

   procedure Set_Doc_Name
    (Self : in out Q_Printer'Class;
     Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QPrinter_setDocName_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Name));
   end Set_Doc_Name;

   -------------------------------
   -- Set_Double_Sided_Printing --
   -------------------------------

   procedure Set_Double_Sided_Printing
    (Self   : in out Q_Printer'Class;
     Enable : Boolean)
   is
   begin
      QPrinter_setDoubleSidedPrinting_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Double_Sided_Printing;

   --------------------------------
   -- Set_Font_Embedding_Enabled --
   --------------------------------

   procedure Set_Font_Embedding_Enabled
    (Self   : in out Q_Printer'Class;
     Enable : Boolean)
   is
   begin
      QPrinter_setFontEmbeddingEnabled_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Font_Embedding_Enabled;

   -----------------
   -- Set_From_To --
   -----------------

   procedure Set_From_To
    (Self      : in out Q_Printer'Class;
     From_Page : Qt4.Q_Integer;
     To_Page   : Qt4.Q_Integer)
   is
   begin
      QPrinter_setFromTo_int_int (Self.Object, From_Page, To_Page);
   end Set_From_To;

   -------------------
   -- Set_Full_Page --
   -------------------

   procedure Set_Full_Page
    (Self : in out Q_Printer'Class;
     Fp   : Boolean)
   is
   begin
      QPrinter_setFullPage_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Fp));
   end Set_Full_Page;

   --------------------
   -- Set_Num_Copies --
   --------------------

   procedure Set_Num_Copies
    (Self       : in out Q_Printer'Class;
     Num_Copies : Qt4.Q_Integer)
   is
   begin
      QPrinter_setNumCopies_int (Self.Object, Num_Copies);
   end Set_Num_Copies;

   ---------------------
   -- Set_Orientation --
   ---------------------

   procedure Set_Orientation
    (Self              : in out Q_Printer'Class;
     Print_Orientation : Printer_Orientation)
   is
   begin
      QPrinter_setOrientation_Orientation (Self.Object, Print_Orientation);
   end Set_Orientation;

   --------------------------
   -- Set_Output_File_Name --
   --------------------------

   procedure Set_Output_File_Name
    (Self      : in out Q_Printer'Class;
     File_Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QPrinter_setOutputFileName_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (File_Name));
   end Set_Output_File_Name;

   -----------------------
   -- Set_Output_Format --
   -----------------------

   procedure Set_Output_Format
    (Self   : in out Q_Printer'Class;
     Format : Printer_Output_Format)
   is
   begin
      QPrinter_setOutputFormat_OutputFormat (Self.Object, Format);
   end Set_Output_Format;

   ----------------------
   -- Set_Page_Margins --
   ----------------------

   procedure Set_Page_Margins
    (Self   : in out Q_Printer'Class;
     Left   : Qt4.Q_Real;
     Top    : Qt4.Q_Real;
     Right  : Qt4.Q_Real;
     Bottom : Qt4.Q_Real;
     Unit   : Printer_Unit)
   is
   begin
      QPrinter_setPageMargins_qreal_qreal_qreal_qreal_Unit (Self.Object, Left, Top, Right, Bottom, Unit);
   end Set_Page_Margins;

   --------------------
   -- Set_Page_Order --
   --------------------

   procedure Set_Page_Order
    (Self  : in out Q_Printer'Class;
     Order : Printer_Page_Order)
   is
   begin
      QPrinter_setPageOrder_PageOrder (Self.Object, Order);
   end Set_Page_Order;

   -------------------
   -- Set_Page_Size --
   -------------------

   procedure Set_Page_Size
    (Self : in out Q_Printer'Class;
     Size : Printer_Page_Size)
   is
   begin
      QPrinter_setPageSize_PageSize (Self.Object, Size);
   end Set_Page_Size;

   --------------------
   -- Set_Paper_Size --
   --------------------

   procedure Set_Paper_Size
    (Self           : in out Q_Printer'Class;
     New_Paper_Size : Printer_Paper_Size)
   is
   begin
      QPrinter_setPaperSize_PaperSize (Self.Object, New_Paper_Size);
   end Set_Paper_Size;

   --------------------
   -- Set_Paper_Size --
   --------------------

   procedure Set_Paper_Size
    (Self       : in out Q_Printer'Class;
     Paper_Size : Qt4.Size_Fs.Q_Size_F'Class;
     Unit       : Printer_Unit)
   is
   begin
      QPrinter_setPaperSize_QSizeFCR_Unit (Self.Object, Qt4.Size_Fs.Internals.QSizeF_View (Paper_Size), Unit);
   end Set_Paper_Size;

   ----------------------
   -- Set_Paper_Source --
   ----------------------

   procedure Set_Paper_Source
    (Self   : in out Q_Printer'Class;
     Source : Printer_Paper_Source)
   is
   begin
      QPrinter_setPaperSource_PaperSource (Self.Object, Source);
   end Set_Paper_Source;

   -----------------------
   -- Set_Print_Program --
   -----------------------

   procedure Set_Print_Program
    (Self    : in out Q_Printer'Class;
     Program : Qt4.Strings.Q_String'Class)
   is
   begin
      QPrinter_setPrintProgram_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Program));
   end Set_Print_Program;

   ---------------------
   -- Set_Print_Range --
   ---------------------

   procedure Set_Print_Range
    (Self    : in out Q_Printer'Class;
     P_Range : Printer_Print_Range)
   is
   begin
      QPrinter_setPrintRange_PrintRange (Self.Object, P_Range);
   end Set_Print_Range;

   ----------------------
   -- Set_Printer_Name --
   ----------------------

   procedure Set_Printer_Name
    (Self : in out Q_Printer'Class;
     Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QPrinter_setPrinterName_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Name));
   end Set_Printer_Name;

   --------------------
   -- Set_Resolution --
   --------------------

   procedure Set_Resolution
    (Self       : in out Q_Printer'Class;
     Resolution : Qt4.Q_Integer)
   is
   begin
      QPrinter_setResolution_int (Self.Object, Resolution);
   end Set_Resolution;

   -------------
   -- To_Page --
   -------------

   function To_Page
    (Self : Q_Printer'Class)
       return Qt4.Q_Integer
   is
   begin
      return QPrinter_toPage (Self.Object);
   end To_Page;

   -----------------------
   -- QPaintDevice_View --
   -----------------------

   overriding function QPaintDevice_View
    (Self : not null access constant Q_Printer)
       return not null Qt_Ada.Internals.Paint_Devices.QPaintDevice_Access
   is
   begin
      return
        C_QPaintDevice_View
         (Internals.QPrinter_View (Q_Printer'Class (Self.all)));
   end QPaintDevice_View;

   ------------------
   -- Paint_Engine --
   ------------------

   overriding
   function Paint_Engine
    (Self : not null access Q_Printer)
       return not null access Qt4.Paint_Engines.Q_Paint_Engine
   is
   begin
      pragma Warnings (Off);
      raise Program_Error;
      return null;
      pragma Warnings (On);
   end Paint_Engine;

   ---------------
   -- Internals --
   ---------------

   package body Internals is

      -------------------
      -- QPrinter_View --
      -------------------

      function QPrinter_View
       (Item : Q_Printer'Class)
          return QPrinter_Access
      is
      begin
         return Item.Object;
      end QPrinter_View;

      package QPrinter_Conversions is
        new System.Address_To_Access_Conversions
             (QPrinter);

      ------------------------
      -- QPrinterTo_Pointer --
      ------------------------

      function To_Pointer
       (Address : System.Address)
          return QPrinter_Access
      is
      begin
         return
           QPrinter_Access
            (QPrinter_Conversions.To_Pointer
            (Address));
      end To_Pointer;

      ------------------------
      -- QPrinterTo_Address --
      ------------------------

      function To_Address
       (Pointer : QPrinter_Access)
          return System.Address
      is
      begin
         return
           QPrinter_Conversions.To_Address
            (QPrinter_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

      --------------------
      -- Create_Wrapper --
      --------------------

      function Create_Wrapper
       (Item : Internals.QPrinter_Access)
          return Q_Printer
      is
      begin
         return Q_Printer'
          (Ada.Finalization.Limited_Controlled with
             Object  => Item,
             Wrapper => True,
             others  => <>);
      end Create_Wrapper;

   end Internals;

end Qt4.Printers;
