------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2007-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.     --
------------------------------------------------------------------------------
pragma Style_Checks ("NM32766");
with Qt4.Point_Fs;
with System.Address_To_Access_Conversions;

package body Qt4.Polygon_Fs is

   function initialize_QPolygonF
    (Storage : System.Address)
      return Internals.QPolygonF_Access;
   pragma Import (C, initialize_QPolygonF, "__QtAda_inititialize_QPolygonF");

   function initialize_QPolygonF_int
    (Storage : System.Address;
     Size : Qt4.Q_Integer)
      return Internals.QPolygonF_Access;
   pragma Import (C, initialize_QPolygonF_int, "__QtAda_inititialize_QPolygonF_int");

   function initialize_QPolygonF_QRectFCR
    (Storage : System.Address;
     R : Qt4.Rect_Fs.Internals.QRectF_Access)
      return Internals.QPolygonF_Access;
   pragma Import (C, initialize_QPolygonF_QRectFCR, "__QtAda_inititialize_QPolygonF_QRectFCR");

   function initialize_QPolygonF_QPolygonCR
    (Storage : System.Address;
     A : Qt4.Polygons.Internals.QPolygon_Access)
      return Internals.QPolygonF_Access;
   pragma Import (C, initialize_QPolygonF_QPolygonCR, "__QtAda_inititialize_QPolygonF_QPolygonCR");

   function adjust_QPolygonF
    (Storage : System.Address;
     From    : Internals.QPolygonF_Access)
       return Internals.QPolygonF_Access;
   pragma Import (C, adjust_QPolygonF, "__QtAda_adjust_QPolygonF");

   procedure finalize_QPolygonF (Object : Internals.QPolygonF_Access);
   pragma Import (C, finalize_QPolygonF, "__QtAda_finalize_QPolygonF");

   procedure QPolygonF_boundingRect
    (Returns : Qt4.Rect_Fs.Internals.QRectF_Access;
     Self : Internals.QPolygonF_Access);
   pragma Import (C, QPolygonF_boundingRect, "__QtAda_QPolygonF_boundingRect_Q");

   function QPolygonF_containsPoint_QPointFCR_FillRule
    (Self : Internals.QPolygonF_Access;
     Pt : Qt4.Point_Fs.Internals.QPointF_Access;
     Fill_Rule : Qt4.Fill_Rule)
       return Interfaces.C.unsigned;
   pragma Import (C, QPolygonF_containsPoint_QPointFCR_FillRule, "__QtAda_QPolygonF_containsPoint_QPointFCR_FillRule_Q");

   procedure QPolygonF_intersected_QPolygonFCR
    (Returns : Internals.QPolygonF_Access;
     Self : Internals.QPolygonF_Access;
     R : Internals.QPolygonF_Access);
   pragma Import (C, QPolygonF_intersected_QPolygonFCR, "__QtAda_QPolygonF_intersected_QPolygonFCR_Q");

   function QPolygonF_isClosed
    (Self : Internals.QPolygonF_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPolygonF_isClosed, "__QtAda_QPolygonF_isClosed_Q");

   procedure QPolygonF_subtracted_QPolygonFCR
    (Returns : Internals.QPolygonF_Access;
     Self : Internals.QPolygonF_Access;
     R : Internals.QPolygonF_Access);
   pragma Import (C, QPolygonF_subtracted_QPolygonFCR, "__QtAda_QPolygonF_subtracted_QPolygonFCR_Q");

   procedure QPolygonF_toPolygon
    (Returns : Qt4.Polygons.Internals.QPolygon_Access;
     Self : Internals.QPolygonF_Access);
   pragma Import (C, QPolygonF_toPolygon, "__QtAda_QPolygonF_toPolygon_Q");

   procedure QPolygonF_translate_QPointFCR
    (Self : Internals.QPolygonF_Access;
     Offset : Qt4.Point_Fs.Internals.QPointF_Access);
   pragma Import (C, QPolygonF_translate_QPointFCR, "__QtAda_QPolygonF_translate_QPointFCR");

   procedure QPolygonF_translate_qreal_qreal
    (Self : Internals.QPolygonF_Access;
     Dx : Qt4.Q_Real;
     Dy : Qt4.Q_Real);
   pragma Import (C, QPolygonF_translate_qreal_qreal, "__QtAda_QPolygonF_translate_qreal_qreal");

   procedure QPolygonF_united_QPolygonFCR
    (Returns : Internals.QPolygonF_Access;
     Self : Internals.QPolygonF_Access;
     R : Internals.QPolygonF_Access);
   pragma Import (C, QPolygonF_united_QPolygonFCR, "__QtAda_QPolygonF_united_QPolygonFCR_Q");

   procedure QPolygonF_append_QPointFCR
    (Self : Internals.QPolygonF_Access;
     T : Qt4.Point_Fs.Internals.QPointF_Access);
   pragma Import (C, QPolygonF_append_QPointFCR, "__QtAda_QPolygonF_append_QPointFCR");

   ------------
   -- Adjust --
   ------------

   overriding
   procedure Adjust (Self : in out Q_Polygon_F) is
   begin
      Self.Object := adjust_QPolygonF (Self.Storage'Address, Self.Object);
      Self.Wrapper := False;
   end Adjust;

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

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

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

   overriding
   procedure Initialize (Self : in out Q_Polygon_F) is
      use type Internals.QPolygonF_Access;

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

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

   function Create
    (Size : Qt4.Q_Integer)
       return Q_Polygon_F
   is
   begin
      return Self : Q_Polygon_F
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QPolygonF_int (Self.Storage'Address, Size);
      end return;
   end Create;

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

   function Create
    (R : Qt4.Rect_Fs.Q_Rect_F'Class)
       return Q_Polygon_F
   is
   begin
      return Self : Q_Polygon_F
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QPolygonF_QRectFCR (Self.Storage'Address, Qt4.Rect_Fs.Internals.QRectF_View (R));
      end return;
   end Create;

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

   function Create
    (A : Qt4.Polygons.Q_Polygon'Class)
       return Q_Polygon_F
   is
   begin
      return Self : Q_Polygon_F
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QPolygonF_QPolygonCR (Self.Storage'Address, Qt4.Polygons.Internals.QPolygon_View (A));
      end return;
   end Create;

   -------------------
   -- Bounding_Rect --
   -------------------

   function Bounding_Rect
    (Self : Q_Polygon_F'Class)
       return Qt4.Rect_Fs.Q_Rect_F
   is
   begin
      return Returns : Qt4.Rect_Fs.Q_Rect_F do
         QPolygonF_boundingRect (Qt4.Rect_Fs.Internals.QRectF_View (Returns), Self.Object);
      end return;
   end Bounding_Rect;

   --------------------
   -- Contains_Point --
   --------------------

   function Contains_Point
    (Self : Q_Polygon_F'Class;
     Pt : Qt4.Point_Fs.Q_Point_F'Class;
     Fill_Rule : Qt4.Fill_Rule)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPolygonF_containsPoint_QPointFCR_FillRule (Self.Object, Qt4.Point_Fs.Internals.QPointF_View (Pt), Fill_Rule), 0);
   end Contains_Point;

   -----------------
   -- Intersected --
   -----------------

   function Intersected
    (Self : Q_Polygon_F'Class;
     R : Q_Polygon_F'Class)
       return Q_Polygon_F
   is
   begin
      return Returns : Q_Polygon_F do
         QPolygonF_intersected_QPolygonFCR (Returns.Object, Self.Object, R.Object);
      end return;
   end Intersected;

   ---------------
   -- Is_Closed --
   ---------------

   function Is_Closed
    (Self : Q_Polygon_F'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPolygonF_isClosed (Self.Object), 0);
   end Is_Closed;

   ----------------
   -- Subtracted --
   ----------------

   function Subtracted
    (Self : Q_Polygon_F'Class;
     R : Q_Polygon_F'Class)
       return Q_Polygon_F
   is
   begin
      return Returns : Q_Polygon_F do
         QPolygonF_subtracted_QPolygonFCR (Returns.Object, Self.Object, R.Object);
      end return;
   end Subtracted;

   ----------------
   -- To_Polygon --
   ----------------

   function To_Polygon
    (Self : Q_Polygon_F'Class)
       return Qt4.Polygons.Q_Polygon
   is
   begin
      return Returns : Qt4.Polygons.Q_Polygon do
         QPolygonF_toPolygon (Qt4.Polygons.Internals.QPolygon_View (Returns), Self.Object);
      end return;
   end To_Polygon;

   ---------------
   -- Translate --
   ---------------

   procedure Translate
    (Self : in out Q_Polygon_F'Class;
     Offset : Qt4.Point_Fs.Q_Point_F'Class)
   is
   begin
      QPolygonF_translate_QPointFCR (Self.Object, Qt4.Point_Fs.Internals.QPointF_View (Offset));
   end Translate;

   ---------------
   -- Translate --
   ---------------

   procedure Translate
    (Self : in out Q_Polygon_F'Class;
     Dx : Qt4.Q_Real;
     Dy : Qt4.Q_Real)
   is
   begin
      QPolygonF_translate_qreal_qreal (Self.Object, Dx, Dy);
   end Translate;

   ------------
   -- United --
   ------------

   function United
    (Self : Q_Polygon_F'Class;
     R : Q_Polygon_F'Class)
       return Q_Polygon_F
   is
   begin
      return Returns : Q_Polygon_F do
         QPolygonF_united_QPolygonFCR (Returns.Object, Self.Object, R.Object);
      end return;
   end United;

   ------------
   -- Append --
   ------------

   procedure Append
    (Self : in out Q_Polygon_F'Class;
     T : Qt4.Point_Fs.Q_Point_F'Class)
   is
   begin
      QPolygonF_append_QPointFCR (Self.Object, Qt4.Point_Fs.Internals.QPointF_View (T));
   end Append;

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

   package body Internals is

   --------------------
   -- QPolygonF_View --
   --------------------

      function QPolygonF_View
       (Item : Q_Polygon_F'Class)
          return QPolygonF_Access
      is
      begin
         return Item.Object;
      end QPolygonF_View;

      package QPolygonF_Conversions is
        new System.Address_To_Access_Conversions
             (QPolygonF);

   -------------------------
   -- QPolygonFTo_Pointer --
   -------------------------

      function To_Pointer
       (Address : System.Address)
          return QPolygonF_Access
      is
      begin
         return
           QPolygonF_Access
            (QPolygonF_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   -------------------------
   -- QPolygonFTo_Address --
   -------------------------

      function To_Address
       (Pointer : QPolygonF_Access)
          return System.Address
      is
      begin
         return
           QPolygonF_Conversions.To_Address
            (QPolygonF_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

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

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

   end Internals;

end Qt4.Polygon_Fs;
