------------------------------------------------------------------------------
--                                                                          --
--                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.                                      --
--                                                                          --
------------------------------------------------------------------------------
--    This file has been generated automatically. Please don't edit it.     --
------------------------------------------------------------------------------
private with Ada.Finalization;
with System;

limited with Qt4.Abstract_Item_Models;
with Qt4.Variants;
private with Qt_Ada.Internals.Value_Class_Sizes;

package Qt4.Model_Indices is

   type Q_Model_Index is tagged private;

   function Create return Q_Model_Index;

   function Child
    (Self   : Q_Model_Index'Class;
     Row    : Qt4.Q_Integer;
     Column : Qt4.Q_Integer)
       return Q_Model_Index;

   function Column
    (Self : Q_Model_Index'Class)
       return Qt4.Q_Integer;

   function Data
    (Self : Q_Model_Index'Class;
     Role : Qt4.Item_Data_Role := Qt4.Display_Role)
       return Qt4.Variants.Q_Variant;

   function Flags
    (Self : Q_Model_Index'Class)
       return Qt4.Item_Flags;

   function Is_Valid
    (Self : Q_Model_Index'Class)
       return Boolean;

   function Parent
    (Self : Q_Model_Index'Class)
       return Q_Model_Index;

   function Row
    (Self : Q_Model_Index'Class)
       return Qt4.Q_Integer;

   function Sibling
    (Self   : Q_Model_Index'Class;
     Row    : Qt4.Q_Integer;
     Column : Qt4.Q_Integer)
       return Q_Model_Index;

   function "<"
    (Self  : Q_Model_Index;
     Other : Q_Model_Index)
       return Boolean;

   function "="
    (Self  : Q_Model_Index;
     Other : Q_Model_Index)
       return Boolean;

   function Model (Self : Q_Model_Index)
     return access Qt4.Abstract_Item_Models.Q_Abstract_Item_Model'Class;

   function Internal_Pointer (Self : Q_Model_Index) return System.Address;

   package Internals is

      type QModelIndex is private;

      type QModelIndex_Access is access all QModelIndex;
      pragma Convention (C, QModelIndex_Access);

      function QModelIndex_View
       (Item : Q_Model_Index'Class)
          return QModelIndex_Access;
      pragma Inline (QModelIndex_View);

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

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

      function Create_Wrapper
       (Item : Internals.QModelIndex_Access)
          return Q_Model_Index;

   private

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

   end Internals;

   package Thin is

      function copy_QModelIndex
       (Cpp_Object : not null access constant Internals.QModelIndex)
          return not null access Internals.QModelIndex;
      pragma Import (C, copy_QModelIndex, "__Qt4Ada_copy_QModelIndex");

   end Thin;

private

   type Q_Model_Index is new Ada.Finalization.Controlled with record
      Storage : aliased Internals.QModelIndex;
      Object  : Internals.QModelIndex_Access := null;
      Wrapper : Boolean := False;
   end record;

   overriding procedure Adjust (Self : in out Q_Model_Index);

   overriding procedure Finalize (Self : in out Q_Model_Index);

   overriding procedure Initialize (Self : in out Q_Model_Index);

end Qt4.Model_Indices;
