------------------------------------------------------------------------------
--                                                                          --
--                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.Lines is

   procedure Q_Line_Image (Item : Q_Line);
   pragma Export (Ada, Q_Line_Image, "q_line_image");

   function initialize_QLine
    (Storage : in System.Address)
      return Internals.QLine_Access;
   pragma Import (C, initialize_QLine, "__QtAda_inititialize_QLine");

   function initialize_QLine_QPointCR_QPointCR
    (Storage : in System.Address;
     Pt_1 : in Qt4.Points.Internals.QPoint_Access;
     Pt_2 : in Qt4.Points.Internals.QPoint_Access)
      return Internals.QLine_Access;
   pragma Import (C, initialize_QLine_QPointCR_QPointCR, "__QtAda_inititialize_QLine_QPointCR_QPointCR");

   function initialize_QLine_int_int_int_int
    (Storage : in System.Address;
     X_1 : in Qt4.Q_Integer;
     Y_1 : in Qt4.Q_Integer;
     X_2 : in Qt4.Q_Integer;
     Y_2 : in Qt4.Q_Integer)
      return Internals.QLine_Access;
   pragma Import (C, initialize_QLine_int_int_int_int, "__QtAda_inititialize_QLine_int_int_int_int");

   function adjust_QLine
    (Storage : in System.Address;
     From    : in Internals.QLine_Access)
       return Internals.QLine_Access;
   pragma Import (C, adjust_QLine, "__QtAda_adjust_QLine");

   procedure finalize_QLine (Object : in Internals.QLine_Access);
   pragma Import (C, finalize_QLine, "__QtAda_finalize_QLine");

   function QLine_dx
    (Self : in Internals.QLine_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QLine_dx, "__QtAda_QLine_dx_Q");

   function QLine_dy
    (Self : in Internals.QLine_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QLine_dy, "__QtAda_QLine_dy_Q");

   function QLine_isNull
    (Self : in Internals.QLine_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QLine_isNull, "__QtAda_QLine_isNull_Q");

   procedure QLine_p1
    (Returns : in Qt4.Points.Internals.QPoint_Access;
     Self : in Internals.QLine_Access);
   pragma Import (C, QLine_p1, "__QtAda_QLine_p1_Q");

   procedure QLine_p2
    (Returns : in Qt4.Points.Internals.QPoint_Access;
     Self : in Internals.QLine_Access);
   pragma Import (C, QLine_p2, "__QtAda_QLine_p2_Q");

   procedure QLine_translate_QPointCR
    (Self : in Internals.QLine_Access;
     P : in Qt4.Points.Internals.QPoint_Access);
   pragma Import (C, QLine_translate_QPointCR, "__QtAda_QLine_translate_QPointCR");

   procedure QLine_translate_int_int
    (Self : in Internals.QLine_Access;
     Dx : in Qt4.Q_Integer;
     Dy : in Qt4.Q_Integer);
   pragma Import (C, QLine_translate_int_int, "__QtAda_QLine_translate_int_int");

   function QLine_x1
    (Self : in Internals.QLine_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QLine_x1, "__QtAda_QLine_x1_Q");

   function QLine_x2
    (Self : in Internals.QLine_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QLine_x2, "__QtAda_QLine_x2_Q");

   function QLine_y1
    (Self : in Internals.QLine_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QLine_y1, "__QtAda_QLine_y1_Q");

   function QLine_y2
    (Self : in Internals.QLine_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QLine_y2, "__QtAda_QLine_y2_Q");

   function eq_QLineCR
    (Self : in Internals.QLine_Access;
     D : in Internals.QLine_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, eq_QLineCR, "__QtAda_QLine_eq_QLineCR_Q");

   ------------------
   -- Q_Line_Image --
   ------------------

   procedure Q_Line_Image (Item : Q_Line) is
   begin
      Qt4_Debug.Output
       ("(x1 => "
          & Q_Integer_Image (Item.X_1)
          & ", y1 => "
          & Q_Integer_Image (Item.Y_1)
          & ", x2 => "
          & Q_Integer_Image (Item.X_2)
          & ", y2 => "
          & Q_Integer_Image (Item.Y_2)
          & ')');
   end Q_Line_Image;

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

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

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

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

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

   overriding
   procedure Initialize (Self : in out Q_Line) is
      use type Internals.QLine_Access;

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

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

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

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

   function Create
    (X_1 : in Qt4.Q_Integer;
     Y_1 : in Qt4.Q_Integer;
     X_2 : in Qt4.Q_Integer;
     Y_2 : in Qt4.Q_Integer)
       return Q_Line
   is
   begin
      return Self : Q_Line
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QLine_int_int_int_int (Self.Storage'Address, X_1, Y_1, X_2, Y_2);
      end return;
   end Create;

   --------
   -- Dx --
   --------

   function Dx
    (Self : in Q_Line'Class)
       return Qt4.Q_Integer
   is
   begin
      return QLine_dx (Self.Object);
   end Dx;

   --------
   -- Dy --
   --------

   function Dy
    (Self : in Q_Line'Class)
       return Qt4.Q_Integer
   is
   begin
      return QLine_dy (Self.Object);
   end Dy;

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

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

   ---------
   -- P_1 --
   ---------

   function P_1
    (Self : in Q_Line'Class)
       return Qt4.Points.Q_Point
   is
   begin
      return Returns : Qt4.Points.Q_Point do
         QLine_p1 (Qt4.Points.Internals.QPoint_View (Returns), Self.Object);
      end return;
   end P_1;

   ---------
   -- P_2 --
   ---------

   function P_2
    (Self : in Q_Line'Class)
       return Qt4.Points.Q_Point
   is
   begin
      return Returns : Qt4.Points.Q_Point do
         QLine_p2 (Qt4.Points.Internals.QPoint_View (Returns), Self.Object);
      end return;
   end P_2;

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

   procedure Translate
    (Self : in out Q_Line'Class;
     P : in Qt4.Points.Q_Point'Class)
   is
   begin
      QLine_translate_QPointCR (Self.Object, Qt4.Points.Internals.QPoint_View (P));
   end Translate;

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

   procedure Translate
    (Self : in out Q_Line'Class;
     Dx : in Qt4.Q_Integer;
     Dy : in Qt4.Q_Integer)
   is
   begin
      QLine_translate_int_int (Self.Object, Dx, Dy);
   end Translate;

   ---------
   -- X_1 --
   ---------

   function X_1
    (Self : in Q_Line'Class)
       return Qt4.Q_Integer
   is
   begin
      return QLine_x1 (Self.Object);
   end X_1;

   ---------
   -- X_2 --
   ---------

   function X_2
    (Self : in Q_Line'Class)
       return Qt4.Q_Integer
   is
   begin
      return QLine_x2 (Self.Object);
   end X_2;

   ---------
   -- Y_1 --
   ---------

   function Y_1
    (Self : in Q_Line'Class)
       return Qt4.Q_Integer
   is
   begin
      return QLine_y1 (Self.Object);
   end Y_1;

   ---------
   -- Y_2 --
   ---------

   function Y_2
    (Self : in Q_Line'Class)
       return Qt4.Q_Integer
   is
   begin
      return QLine_y2 (Self.Object);
   end Y_2;

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

   function "="
    (Self : in Q_Line;
     D : in Q_Line)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (eq_QLineCR (Self.Object, D.Object), 0);
   end "=";

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

   package body Internals is

   ----------------
   -- QLine_View --
   ----------------

      function QLine_View
       (Item : in Q_Line'Class)
          return QLine_Access
      is
      begin
         return Item.Object;
      end QLine_View;

      package QLine_Conversions is
        new System.Address_To_Access_Conversions
             (QLine);

   ---------------------
   -- QLineTo_Pointer --
   ---------------------

      function To_Pointer
       (Address : in System.Address)
          return QLine_Access
      is
      begin
         return
           QLine_Access
            (QLine_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   ---------------------
   -- QLineTo_Address --
   ---------------------

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

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

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

   end Internals;

end Qt4.Lines;
