------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-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.                                      --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3769 $ $Date: 2010-10-24 03:16:28 +0400 (Sun, 24 Oct 2010) $
------------------------------------------------------------------------------

package body Qt4.Item_Selection_Ranges is

   function new_QItemSelectionRange
     return not null access Qt4_Entities.Cpp_Class;
   pragma Import
    (C, new_QItemSelectionRange, "__Qt4Ada_new_QItemSelectionRange");

   procedure delete_QItemSelectionRange
    (Cpp_Object : not null access Qt4_Entities.Cpp_Class);
   pragma Import
    (C, delete_QItemSelectionRange, "__Qt4Ada_delete_QItemSelectionRange");

   procedure assign_QItemSelectionRange
    (S_1 : not null access Thin.QItemSelectionRange;
     S_2 : not null access constant Thin.QItemSelectionRange);
   pragma Import
    (C, assign_QItemSelectionRange, "__Qt4Ada_assign_QItemSelectionRange");

   function bottom_wrapper (Self : not null access Thin.QItemSelectionRange)
     return Interfaces.C.int;
   pragma Import
    (C, bottom_wrapper, "__Qt4Ada_QItemSelectionRange_bottom_wrapper");

   function left_wrapper (Self : not null access Thin.QItemSelectionRange)
     return Interfaces.C.int;
   pragma Import
    (C, left_wrapper, "__Qt4Ada_QItemSelectionRange_left_wrapper");

   function right_wrapper (Self : not null access Thin.QItemSelectionRange)
     return Interfaces.C.int;
   pragma Import
    (C, right_wrapper, "__Qt4Ada_QItemSelectionRange_right_wrapper");

   function top_wrapper (Self : not null access Thin.QItemSelectionRange)
     return Interfaces.C.int;
   pragma Import
    (C, top_wrapper, "__Qt4Ada_QItemSelectionRange_top_wrapper");

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Bottom
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   function Bottom (Self : Q_Item_Selection_Range) return Q_Integer is
   begin
      return
       Q_Integer (bottom_wrapper (Internals.QItemSelectionRange_View (Self)));
   end Bottom;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Copy_Cpp_Object
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   overriding
   function Copy_Cpp_Object (Self : not null access Q_Item_Selection_Range)
     return not null access Qt4_Entities.Cpp_Class
   is
   begin
      return Thin.copy_QItemSelectionRange (Self.Cpp_Object);
   end Copy_Cpp_Object;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Default_Cpp_Object
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   overriding function Default_Cpp_Object
    (Self : not null access Q_Item_Selection_Range)
       return access Qt4_Entities.Cpp_Class
   is
      pragma Unreferenced (Self);
      --  Параметр необходим для диспетчеризации надклассового вызова.

   begin
      return new_QItemSelectionRange;
   end Default_Cpp_Object;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Delete_Cpp_Object
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   overriding
   procedure Delete_Cpp_Object (Self : not null access Q_Item_Selection_Range)
   is
   begin
      delete_QItemSelectionRange (Self.Cpp_Object);
   end Delete_Cpp_Object;

   package body Internals is

      ------------------------------------------------------------------------
      --! <Subprogram>
      --!    <Unit> Cpp_Object
      --!    <ImplementationNotes>
      ------------------------------------------------------------------------
      function QItemSelectionRange_View (Self : Q_Item_Selection_Range)
        return not null access Thin.QItemSelectionRange
      is
      begin
         return Qt4_Entities.Cpp_Object (Self);
      end QItemSelectionRange_View;

      ------------------------------------------------------------------------
      --! <Subprogram>
      --!    <Unit> To_Q_Item_Selection_Range
      --!    <ImplementationNotes>
      ------------------------------------------------------------------------
      function To_Q_Item_Selection_Range
       (Item : not null access constant Thin.QItemSelectionRange)
          return Q_Item_Selection_Range
      is
      begin
         return Result : Q_Item_Selection_Range do
            assign_QItemSelectionRange
             (Internals.QItemSelectionRange_View (Result), Item);
         end return;
      end To_Q_Item_Selection_Range;

   end Internals;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Left
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   function Left (Self : Q_Item_Selection_Range) return Q_Integer is
   begin
      return
        Q_Integer (left_wrapper (Internals.QItemSelectionRange_View (Self)));
   end Left;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Right
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   function Right (Self : Q_Item_Selection_Range) return Q_Integer is
   begin
      return
        Q_Integer (right_wrapper (Internals.QItemSelectionRange_View (Self)));
   end Right;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Top
   --!    <ImplementationNotes>
   ---------------------------------------------------------------------------
   function Top (Self : Q_Item_Selection_Range) return Q_Integer is
   begin
      return
       Q_Integer (top_wrapper (Internals.QItemSelectionRange_View (Self)));
   end Top;

end Qt4.Item_Selection_Ranges;
