------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2007-2009 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 System.Address_To_Access_Conversions;

with Qt4_Debug;

package body Qt4.Point_Fs is

   procedure Q_Point_F_Image (Item : Q_Point_F);
   pragma Export (Ada, Q_Point_F_Image, "q_point_f_image");

   function initialize_QPointF
    (Storage : in System.Address)
      return Internals.QPointF_Access;
   pragma Import (C, initialize_QPointF, "__QtAda_inititialize_QPointF");

   function initialize_QPointF_QPointCR
    (Storage : in System.Address;
     P : in Qt4.Points.Internals.QPoint_Access)
      return Internals.QPointF_Access;
   pragma Import (C, initialize_QPointF_QPointCR, "__QtAda_inititialize_QPointF_QPointCR");

   function initialize_QPointF_qreal_qreal
    (Storage : in System.Address;
     Xpos : in Qt4.Q_Real;
     Ypos : in Qt4.Q_Real)
      return Internals.QPointF_Access;
   pragma Import (C, initialize_QPointF_qreal_qreal, "__QtAda_inititialize_QPointF_qreal_qreal");

   function adjust_QPointF
    (Storage : in System.Address;
     From    : in Internals.QPointF_Access)
       return Internals.QPointF_Access;
   pragma Import (C, adjust_QPointF, "__QtAda_adjust_QPointF");

   procedure finalize_QPointF (Object : in Internals.QPointF_Access);
   pragma Import (C, finalize_QPointF, "__QtAda_finalize_QPointF");

   function QPointF_isNull
    (Self : in Internals.QPointF_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QPointF_isNull, "__QtAda_QPointF_isNull_Q");

   procedure QPointF_setX_qreal
    (Self : in Internals.QPointF_Access;
     X : in Qt4.Q_Real);
   pragma Import (C, QPointF_setX_qreal, "__QtAda_QPointF_setX_qreal");

   procedure QPointF_setY_qreal
    (Self : in Internals.QPointF_Access;
     Y : in Qt4.Q_Real);
   pragma Import (C, QPointF_setY_qreal, "__QtAda_QPointF_setY_qreal");

   procedure QPointF_toPoint
    (Returns : in Qt4.Points.Internals.QPoint_Access;
     Self : in Internals.QPointF_Access);
   pragma Import (C, QPointF_toPoint, "__QtAda_QPointF_toPoint_Q");

   function QPointF_x
    (Self : in Internals.QPointF_Access)
       return Qt4.Q_Real;
   pragma Import (C, QPointF_x, "__QtAda_QPointF_x_Q");

   function QPointF_y
    (Self : in Internals.QPointF_Access)
       return Qt4.Q_Real;
   pragma Import (C, QPointF_y, "__QtAda_QPointF_y_Q");

   function eq_QPointFCR_QPointFCR
    (P_1 : in Internals.QPointF_Access;
     P_2 : in Internals.QPointF_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, eq_QPointFCR_QPointFCR, "__QtAda_eq_QPointFCR_QPointFCR");

   procedure plus_QPointFCR_QPointFCR
    (Returns : in Internals.QPointF_Access;
     P_1 : in Internals.QPointF_Access;
     P_2 : in Internals.QPointF_Access);
   pragma Import (C, plus_QPointFCR_QPointFCR, "__QtAda_plus_QPointFCR_QPointFCR");

   procedure minus_QPointFCR_QPointFCR
    (Returns : in Internals.QPointF_Access;
     P_1 : in Internals.QPointF_Access;
     P_2 : in Internals.QPointF_Access);
   pragma Import (C, minus_QPointFCR_QPointFCR, "__QtAda_minus_QPointFCR_QPointFCR");

   procedure multiplication_QPointFCR_qreal
    (Returns : in Internals.QPointF_Access;
     P : in Internals.QPointF_Access;
     S : in Qt4.Q_Real);
   pragma Import (C, multiplication_QPointFCR_qreal, "__QtAda_multiplication_QPointFCR_qreal");

   procedure multiplication_qreal_QPointFCR
    (Returns : in Internals.QPointF_Access;
     S : in Qt4.Q_Real;
     P : in Internals.QPointF_Access);
   pragma Import (C, multiplication_qreal_QPointFCR, "__QtAda_multiplication_qreal_QPointFCR");

   procedure minus_QPointFCR
    (Returns : in Internals.QPointF_Access;
     P : in Internals.QPointF_Access);
   pragma Import (C, minus_QPointFCR, "__QtAda_minus_QPointFCR");

   procedure division_QPointFCR_qreal
    (Returns : in Internals.QPointF_Access;
     P : in Internals.QPointF_Access;
     S : in Qt4.Q_Real);
   pragma Import (C, division_QPointFCR_qreal, "__QtAda_division_QPointFCR_qreal");

   ---------------------
   -- Q_Point_F_Image --
   ---------------------

   procedure Q_Point_F_Image (Item : Q_Point_F) is
   begin
      Qt4_Debug.Output
       ("(x => "
          & Q_Real_Image (Item.X)
          & ", y => "
          & Q_Real_Image (Item.Y)
          & ')');
   end Q_Point_F_Image;

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

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

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

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

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

   overriding
   procedure Initialize (Self : in out Q_Point_F) is
      use type Internals.QPointF_Access;

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

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

   function Create
    (P : in Qt4.Points.Q_Point'Class)
       return Q_Point_F
   is
   begin
      return Self : Q_Point_F
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QPointF_QPointCR (Self.Storage'Address, Qt4.Points.Internals.QPoint_View (P));
      end return;
   end Create;

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

   function Create
    (Xpos : in Qt4.Q_Real;
     Ypos : in Qt4.Q_Real)
       return Q_Point_F
   is
   begin
      return Self : Q_Point_F
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QPointF_qreal_qreal (Self.Storage'Address, Xpos, Ypos);
      end return;
   end Create;

   -------------
   -- Is_Null --
   -------------

   function Is_Null
    (Self : in Q_Point_F'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QPointF_isNull (Self.Object), 0);
   end Is_Null;

   -----------
   -- Set_X --
   -----------

   procedure Set_X
    (Self : in out Q_Point_F'Class;
     X : in Qt4.Q_Real)
   is
   begin
      QPointF_setX_qreal (Self.Object, X);
   end Set_X;

   -----------
   -- Set_Y --
   -----------

   procedure Set_Y
    (Self : in out Q_Point_F'Class;
     Y : in Qt4.Q_Real)
   is
   begin
      QPointF_setY_qreal (Self.Object, Y);
   end Set_Y;

   --------------
   -- To_Point --
   --------------

   function To_Point
    (Self : in Q_Point_F'Class)
       return Qt4.Points.Q_Point
   is
   begin
      return Returns : Qt4.Points.Q_Point do
         QPointF_toPoint (Qt4.Points.Internals.QPoint_View (Returns), Self.Object);
      end return;
   end To_Point;

   -------
   -- X --
   -------

   function X
    (Self : in Q_Point_F'Class)
       return Qt4.Q_Real
   is
   begin
      return QPointF_x (Self.Object);
   end X;

   -------
   -- Y --
   -------

   function Y
    (Self : in Q_Point_F'Class)
       return Qt4.Q_Real
   is
   begin
      return QPointF_y (Self.Object);
   end Y;

   ---------
   -- "=" --
   ---------

   function "="
    (P_1 : in Q_Point_F;
     P_2 : in Q_Point_F)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (eq_QPointFCR_QPointFCR (P_1.Object, P_2.Object), 0);
   end "=";

   ---------
   -- "+" --
   ---------

   function "+"
    (P_1 : in Q_Point_F;
     P_2 : in Q_Point_F)
       return Q_Point_F
   is
   begin
      return Returns : Q_Point_F do
         plus_QPointFCR_QPointFCR (Returns.Object, P_1.Object, P_2.Object);
      end return;
   end "+";

   ---------
   -- "-" --
   ---------

   function "-"
    (P_1 : in Q_Point_F;
     P_2 : in Q_Point_F)
       return Q_Point_F
   is
   begin
      return Returns : Q_Point_F do
         minus_QPointFCR_QPointFCR (Returns.Object, P_1.Object, P_2.Object);
      end return;
   end "-";

   ---------
   -- "*" --
   ---------

   function "*"
    (P : in Q_Point_F;
     S : in Qt4.Q_Real)
       return Q_Point_F
   is
   begin
      return Returns : Q_Point_F do
         multiplication_QPointFCR_qreal (Returns.Object, P.Object, S);
      end return;
   end "*";

   ---------
   -- "*" --
   ---------

   function "*"
    (S : in Qt4.Q_Real;
     P : in Q_Point_F)
       return Q_Point_F
   is
   begin
      return Returns : Q_Point_F do
         multiplication_qreal_QPointFCR (Returns.Object, S, P.Object);
      end return;
   end "*";

   ---------
   -- "-" --
   ---------

   function "-"
    (P : in Q_Point_F)
       return Q_Point_F
   is
   begin
      return Returns : Q_Point_F do
         minus_QPointFCR (Returns.Object, P.Object);
      end return;
   end "-";

   ---------
   -- "/" --
   ---------

   function "/"
    (P : in Q_Point_F;
     S : in Qt4.Q_Real)
       return Q_Point_F
   is
   begin
      return Returns : Q_Point_F do
         division_QPointFCR_qreal (Returns.Object, P.Object, S);
      end return;
   end "/";

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

   package body Internals is

   ------------------
   -- QPointF_View --
   ------------------

      function QPointF_View
       (Item : in Q_Point_F'Class)
          return QPointF_Access
      is
      begin
         return Item.Object;
      end QPointF_View;

      package QPointF_Conversions is
        new System.Address_To_Access_Conversions
             (QPointF);

   -----------------------
   -- QPointFTo_Pointer --
   -----------------------

      function To_Pointer
       (Address : in System.Address)
          return QPointF_Access
      is
      begin
         return
           QPointF_Access
            (QPointF_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   -----------------------
   -- QPointFTo_Address --
   -----------------------

      function To_Address
       (Pointer : in QPointF_Access)
          return System.Address
      is
      begin
         return
           QPointF_Conversions.To_Address
            (QPointF_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

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

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

   end Internals;

end Qt4.Point_Fs;
