------------------------------------------------------------------------------
--                                                                          --
--                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.     --
------------------------------------------------------------------------------
private with Ada.Finalization;
with Interfaces.C;
limited with Qt4.Points;
limited with Qt4.Polygons;
with Qt4.Rects;
private with Qt_Ada.Internals.Value_Class_Sizes;
with System;

package Qt4.Regions is

   --  QRegion::RegionType

   type Region_Type is
    (Rectangle,
     Ellipse);
   pragma Convention (C, Region_Type);
   for Region_Type'Size use Interfaces.C.unsigned'Size;

   type Q_Region is tagged private;

   function Create
    (X : Qt4.Q_Integer;
     Y : Qt4.Q_Integer;
     H : Qt4.Q_Integer;
     T : Region_Type
       := Rectangle)
       return Q_Region;

   function Create
    (Pa : Qt4.Polygons.Q_Polygon'Class;
     Fill_Rule : Qt4.Fill_Rule
       := Odd_Even_Fill)
       return Q_Region;

   function Create
    (R : Qt4.Rects.Q_Rect'Class;
     T : Region_Type
       := Rectangle)
       return Q_Region;

   function Bounding_Rect
    (Self : Q_Region'Class)
       return Qt4.Rects.Q_Rect;

   function Contains
    (Self : Q_Region'Class;
     P : Qt4.Points.Q_Point'Class)
       return Boolean;

   function Contains
    (Self : Q_Region'Class;
     R : Qt4.Rects.Q_Rect'Class)
       return Boolean;

   function Intersected
    (Self : Q_Region'Class;
     R : Q_Region'Class)
       return Q_Region;

   function Intersects
    (Self : Q_Region'Class;
     R : Q_Region'Class)
       return Boolean;

   function Intersects
    (Self : Q_Region'Class;
     R : Qt4.Rects.Q_Rect'Class)
       return Boolean;

   function Is_Empty
    (Self : Q_Region'Class)
       return Boolean;

   function Subtracted
    (Self : Q_Region'Class;
     R : Q_Region'Class)
       return Q_Region;

   procedure Translate
    (Self : in out Q_Region'Class;
     Dx : Qt4.Q_Integer;
     Dy : Qt4.Q_Integer);

   procedure Translate
    (Self : in out Q_Region'Class;
     P : Qt4.Points.Q_Point'Class);

   function Translated
    (Self : Q_Region'Class;
     Dx : Qt4.Q_Integer;
     Dy : Qt4.Q_Integer)
       return Q_Region;

   function Translated
    (Self : Q_Region'Class;
     P : Qt4.Points.Q_Point'Class)
       return Q_Region;

   function United
    (Self : Q_Region'Class;
     R : Q_Region'Class)
       return Q_Region;

   function Xored
    (Self : Q_Region'Class;
     R : Q_Region'Class)
       return Q_Region;

   function "="
    (Self : Q_Region;
     R : Q_Region)
       return Boolean;

   package Internals is

      type QRegion is private;

      type QRegion_Access is access all QRegion;
      pragma Convention (C, QRegion_Access);

      function QRegion_View
       (Item : Q_Region'Class)
          return QRegion_Access;
      pragma Inline (QRegion_View);

      function To_Pointer
       (Address : System.Address)
          return QRegion_Access;
      pragma Inline (To_Pointer);

      function To_Address
       (Pointer : QRegion_Access)
          return System.Address;
      pragma Inline (To_Address);

      function Create_Wrapper
       (Item : Internals.QRegion_Access)
          return Q_Region;

   private

      type QRegion is record
         Placeholder : Interfaces.C.char_array (1 .. Qt_Ada.Internals.Value_Class_Sizes.QRegion_C_Size_Of);
      end record;
      pragma Convention (C, QRegion);

   end Internals;

   package Thin is

      function copy_QRegion
       (Cpp_Object : not null access Internals.QRegion)
          return not null access Internals.QRegion;
      pragma Import (C, copy_QRegion, "__Qt4Ada_copy_QRegion");

   end Thin;

private

   type Q_Region is new Ada.Finalization.Controlled with record
      Storage : aliased Internals.QRegion;
      Object  : Internals.QRegion_Access := null;
      Wrapper : Boolean := False;
   end record;

   overriding
   procedure Adjust (Self : in out Q_Region);

   overriding
   procedure Finalize (Self : in out Q_Region);

   overriding
   procedure Initialize (Self : in out Q_Region);

end Qt4.Regions;
