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

   procedure Q_Size_Image (Item : Q_Size);
   pragma Export (Ada, Q_Size_Image, "q_size_image");

   function initialize_QSize
    (Storage : in System.Address)
      return Internals.QSize_Access;
   pragma Import (C, initialize_QSize, "__QtAda_inititialize_QSize");

   function initialize_QSize_int_int
    (Storage : in System.Address;
     W : in Qt4.Q_Integer;
     H : in Qt4.Q_Integer)
      return Internals.QSize_Access;
   pragma Import (C, initialize_QSize_int_int, "__QtAda_inititialize_QSize_int_int");

   function adjust_QSize
    (Storage : in System.Address;
     From    : in Internals.QSize_Access)
       return Internals.QSize_Access;
   pragma Import (C, adjust_QSize, "__QtAda_adjust_QSize");

   procedure finalize_QSize (Object : in Internals.QSize_Access);
   pragma Import (C, finalize_QSize, "__QtAda_finalize_QSize");

   procedure QSize_boundedTo_QSizeCR
    (Returns : in Internals.QSize_Access;
     Self : in Internals.QSize_Access;
     Other_Size : in Internals.QSize_Access);
   pragma Import (C, QSize_boundedTo_QSizeCR, "__QtAda_QSize_boundedTo_QSizeCR_Q");

   procedure QSize_expandedTo_QSizeCR
    (Returns : in Internals.QSize_Access;
     Self : in Internals.QSize_Access;
     Other_Size : in Internals.QSize_Access);
   pragma Import (C, QSize_expandedTo_QSizeCR, "__QtAda_QSize_expandedTo_QSizeCR_Q");

   function QSize_height
    (Self : in Internals.QSize_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QSize_height, "__QtAda_QSize_height_Q");

   function QSize_isEmpty
    (Self : in Internals.QSize_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QSize_isEmpty, "__QtAda_QSize_isEmpty_Q");

   function QSize_isNull
    (Self : in Internals.QSize_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QSize_isNull, "__QtAda_QSize_isNull_Q");

   function QSize_isValid
    (Self : in Internals.QSize_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QSize_isValid, "__QtAda_QSize_isValid_Q");

   procedure QSize_scale_int_int_AspectRatioMode
    (Self : in Internals.QSize_Access;
     W : in Qt4.Q_Integer;
     H : in Qt4.Q_Integer;
     Mode : in Qt4.Aspect_Ratio_Mode);
   pragma Import (C, QSize_scale_int_int_AspectRatioMode, "__QtAda_QSize_scale_int_int_AspectRatioMode");

   procedure QSize_scale_QSizeCR_AspectRatioMode
    (Self : in Internals.QSize_Access;
     S : in Internals.QSize_Access;
     Mode : in Qt4.Aspect_Ratio_Mode);
   pragma Import (C, QSize_scale_QSizeCR_AspectRatioMode, "__QtAda_QSize_scale_QSizeCR_AspectRatioMode");

   procedure QSize_setHeight_int
    (Self : in Internals.QSize_Access;
     H : in Qt4.Q_Integer);
   pragma Import (C, QSize_setHeight_int, "__QtAda_QSize_setHeight_int");

   procedure QSize_setWidth_int
    (Self : in Internals.QSize_Access;
     W : in Qt4.Q_Integer);
   pragma Import (C, QSize_setWidth_int, "__QtAda_QSize_setWidth_int");

   procedure QSize_transpose
    (Self : in Internals.QSize_Access);
   pragma Import (C, QSize_transpose, "__QtAda_QSize_transpose");

   function QSize_width
    (Self : in Internals.QSize_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QSize_width, "__QtAda_QSize_width_Q");

   function eq_QSizeCR_QSizeCR
    (S_1 : in Internals.QSize_Access;
     S_2 : in Internals.QSize_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, eq_QSizeCR_QSizeCR, "__QtAda_eq_QSizeCR_QSizeCR");

   procedure plus_QSizeCR_QSizeCR
    (Returns : in Internals.QSize_Access;
     S_1 : in Internals.QSize_Access;
     S_2 : in Internals.QSize_Access);
   pragma Import (C, plus_QSizeCR_QSizeCR, "__QtAda_plus_QSizeCR_QSizeCR");

   procedure minus_QSizeCR_QSizeCR
    (Returns : in Internals.QSize_Access;
     S_1 : in Internals.QSize_Access;
     S_2 : in Internals.QSize_Access);
   pragma Import (C, minus_QSizeCR_QSizeCR, "__QtAda_minus_QSizeCR_QSizeCR");

   procedure multiplication_QSizeCR_qreal
    (Returns : in Internals.QSize_Access;
     S : in Internals.QSize_Access;
     Factor : in Qt4.Q_Real);
   pragma Import (C, multiplication_QSizeCR_qreal, "__QtAda_multiplication_QSizeCR_qreal");

   procedure multiplication_qreal_QSizeCR
    (Returns : in Internals.QSize_Access;
     Factor : in Qt4.Q_Real;
     S : in Internals.QSize_Access);
   pragma Import (C, multiplication_qreal_QSizeCR, "__QtAda_multiplication_qreal_QSizeCR");

   procedure division_QSizeCR_qreal
    (Returns : in Internals.QSize_Access;
     S : in Internals.QSize_Access;
     Factor : in Qt4.Q_Real);
   pragma Import (C, division_QSizeCR_qreal, "__QtAda_division_QSizeCR_qreal");

   ------------------
   -- Q_Size_Image --
   ------------------

   procedure Q_Size_Image (Item : Q_Size) is
   begin
      Qt4_Debug.Output
       ("(width => "
          & Q_Integer_Image (Item.Width)
          & ", height => "
          & Q_Integer_Image (Item.Height)
          & ')');
   end Q_Size_Image;

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

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

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

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

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

   overriding
   procedure Initialize (Self : in out Q_Size) is
      use type Internals.QSize_Access;

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

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

   function Create
     return Q_Size
   is
   begin
      return Self : Q_Size
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QSize (Self.Storage'Address);
      end return;
   end Create;

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

   function Create
    (W : in Qt4.Q_Integer;
     H : in Qt4.Q_Integer)
       return Q_Size
   is
   begin
      return Self : Q_Size
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QSize_int_int (Self.Storage'Address, W, H);
      end return;
   end Create;

   ----------------
   -- Bounded_To --
   ----------------

   function Bounded_To
    (Self : in Q_Size'Class;
     Other_Size : in Q_Size'Class)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         QSize_boundedTo_QSizeCR (Returns.Object, Self.Object, Other_Size.Object);
      end return;
   end Bounded_To;

   -----------------
   -- Expanded_To --
   -----------------

   function Expanded_To
    (Self : in Q_Size'Class;
     Other_Size : in Q_Size'Class)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         QSize_expandedTo_QSizeCR (Returns.Object, Self.Object, Other_Size.Object);
      end return;
   end Expanded_To;

   ------------
   -- Height --
   ------------

   function Height
    (Self : in Q_Size'Class)
       return Qt4.Q_Integer
   is
   begin
      return QSize_height (Self.Object);
   end Height;

   --------------
   -- Is_Empty --
   --------------

   function Is_Empty
    (Self : in Q_Size'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QSize_isEmpty (Self.Object), 0);
   end Is_Empty;

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

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

   --------------
   -- Is_Valid --
   --------------

   function Is_Valid
    (Self : in Q_Size'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QSize_isValid (Self.Object), 0);
   end Is_Valid;

   -----------
   -- Scale --
   -----------

   procedure Scale
    (Self : in out Q_Size'Class;
     W : in Qt4.Q_Integer;
     H : in Qt4.Q_Integer;
     Mode : in Qt4.Aspect_Ratio_Mode)
   is
   begin
      QSize_scale_int_int_AspectRatioMode (Self.Object, W, H, Mode);
   end Scale;

   -----------
   -- Scale --
   -----------

   procedure Scale
    (Self : in out Q_Size'Class;
     S : in Q_Size'Class;
     Mode : in Qt4.Aspect_Ratio_Mode)
   is
   begin
      QSize_scale_QSizeCR_AspectRatioMode (Self.Object, S.Object, Mode);
   end Scale;

   ----------------
   -- Set_Height --
   ----------------

   procedure Set_Height
    (Self : in out Q_Size'Class;
     H : in Qt4.Q_Integer)
   is
   begin
      QSize_setHeight_int (Self.Object, H);
   end Set_Height;

   ---------------
   -- Set_Width --
   ---------------

   procedure Set_Width
    (Self : in out Q_Size'Class;
     W : in Qt4.Q_Integer)
   is
   begin
      QSize_setWidth_int (Self.Object, W);
   end Set_Width;

   ---------------
   -- Transpose --
   ---------------

   procedure Transpose
    (Self : in out Q_Size'Class)
   is
   begin
      QSize_transpose (Self.Object);
   end Transpose;

   -----------
   -- Width --
   -----------

   function Width
    (Self : in Q_Size'Class)
       return Qt4.Q_Integer
   is
   begin
      return QSize_width (Self.Object);
   end Width;

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

   function "="
    (S_1 : in Q_Size;
     S_2 : in Q_Size)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (eq_QSizeCR_QSizeCR (S_1.Object, S_2.Object), 0);
   end "=";

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

   function "+"
    (S_1 : in Q_Size;
     S_2 : in Q_Size)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         plus_QSizeCR_QSizeCR (Returns.Object, S_1.Object, S_2.Object);
      end return;
   end "+";

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

   function "-"
    (S_1 : in Q_Size;
     S_2 : in Q_Size)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         minus_QSizeCR_QSizeCR (Returns.Object, S_1.Object, S_2.Object);
      end return;
   end "-";

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

   function "*"
    (S : in Q_Size;
     Factor : in Qt4.Q_Real)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         multiplication_QSizeCR_qreal (Returns.Object, S.Object, Factor);
      end return;
   end "*";

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

   function "*"
    (Factor : in Qt4.Q_Real;
     S : in Q_Size)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         multiplication_qreal_QSizeCR (Returns.Object, Factor, S.Object);
      end return;
   end "*";

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

   function "/"
    (S : in Q_Size;
     Factor : in Qt4.Q_Real)
       return Q_Size
   is
   begin
      return Returns : Q_Size do
         division_QSizeCR_qreal (Returns.Object, S.Object, Factor);
      end return;
   end "/";

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

   package body Internals is

   ----------------
   -- QSize_View --
   ----------------

      function QSize_View
       (Item : in Q_Size'Class)
          return QSize_Access
      is
      begin
         return Item.Object;
      end QSize_View;

      package QSize_Conversions is
        new System.Address_To_Access_Conversions
             (QSize);

   ---------------------
   -- QSizeTo_Pointer --
   ---------------------

      function To_Pointer
       (Address : in System.Address)
          return QSize_Access
      is
      begin
         return
           QSize_Access
            (QSize_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   ---------------------
   -- QSizeTo_Address --
   ---------------------

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

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

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

   end Internals;

end Qt4.Sizes;
