------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-2011 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.     --
------------------------------------------------------------------------------
with Qt_Ada.Internals.Objects;

with Qt_Ada.Internals.Objects.Abstract_Item_Model_Proxies;
pragma Warnings (Off, Qt_Ada.Internals.Objects.Abstract_Item_Model_Proxies);
--  Elaboration of the proxy tagged type package register proxy object
--  constructor. Bindings must be able to create proxy object of the
--  corresponding tagged type for works properly.

package body Qt4.Abstract_Item_Models is

   function insertColumn_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Column : Qt4.Q_Integer;
     Parent : not null access constant Qt4.Model_Indices.Internals.QModelIndex)
       return Qt4.bool;
   pragma Import (C, insertColumn_0_wrapper,
                     "__Qt4Ada_QAbstractItemModel_insertColumn_0_wrapper");

   function insertRow_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Row : Qt4.Q_Integer;
     Parent : not null access constant Qt4.Model_Indices.Internals.QModelIndex)
       return Qt4.bool;
   pragma Import (C, insertRow_0_wrapper,
                     "__Qt4Ada_QAbstractItemModel_insertRow_0_wrapper");

   function removeColumn_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Column : Qt4.Q_Integer;
     Parent : not null access constant Qt4.Model_Indices.Internals.QModelIndex)
       return Qt4.bool;
   pragma Import (C, removeColumn_0_wrapper,
                     "__Qt4Ada_QAbstractItemModel_removeColumn_0_wrapper");

   function removeRow_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Row : Qt4.Q_Integer;
     Parent : not null access constant Qt4.Model_Indices.Internals.QModelIndex)
       return Qt4.bool;
   pragma Import (C, removeRow_0_wrapper,
                     "__Qt4Ada_QAbstractItemModel_removeRow_0_wrapper");

   procedure sibling_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Row : Qt4.Q_Integer;
     Column : Qt4.Q_Integer;
     Idx : not null access constant Qt4.Model_Indices.Internals.QModelIndex;
     Returns : not null access Qt4.Model_Indices.Internals.QModelIndex);
   pragma Import (C, sibling_0_wrapper,
                     "__Qt4Ada_QAbstractItemModel_sibling_0_wrapper");

   -----------------
   -- Insert_Rows --
   -----------------

   procedure Insert_Rows
    (Self   : not null access Q_Abstract_Item_Model'Class;
     Row    : Qt4.Q_Integer;
     Count  : Qt4.Q_Integer;
     Parent : Qt4.Model_Indices.Q_Model_Index := Qt4.Model_Indices.Create)
   is
   begin
      if not Self.Insert_Rows (Row, Count, Parent) then
         raise Program_Error;
      end if;
   end Insert_Rows;

   -----------------
   -- Remove_Rows --
   -----------------

   procedure Remove_Rows
    (Self   : not null access Q_Abstract_Item_Model'Class;
     Row    : Qt4.Q_Integer;
     Count  : Qt4.Q_Integer;
     Parent : Qt4.Model_Indices.Q_Model_Index := Qt4.Model_Indices.Create)
   is
   begin
      if not Self.Remove_Rows (Row, Count, Parent) then
         raise Program_Error;
      end if;
   end Remove_Rows;

   --------------
   -- Set_Data --
   --------------

   procedure Set_Data
    (Self  : not null access Q_Abstract_Item_Model'Class;
     Index : Qt4.Model_Indices.Q_Model_Index;
     Value : Qt4.Variants.Q_Variant;
     Role  : Qt4.Item_Data_Role := Qt4.Edit_Role)
   is
   begin
      if not Self.Set_Data (Index, Value, Role) then
         raise Program_Error;
      end if;
   end Set_Data;

   ---------------------
   -- Set_Header_Data --
   ---------------------

   procedure Set_Header_Data
    (Self    : not null access Q_Abstract_Item_Model'Class;
     Section : Qt4.Q_Integer;
     Orient  : Qt4.Orientation;
     Value   : Qt4.Variants.Q_Variant;
     Role    : Qt4.Item_Data_Role := Qt4.Edit_Role)
   is
   begin
      if not Self.Set_Header_Data (Section, Orient, Value, Role) then
         raise Program_Error;
      end if;
   end Set_Header_Data;

   pragma Style_Checks ("N");

   -------------------
   -- Insert_Column --
   -------------------

   function Insert_Column
    (Self : not null access Q_Abstract_Item_Model'Class;
     Column : Qt4.Q_Integer;
     Parent : Qt4.Model_Indices.Q_Model_Index
       := Qt4.Model_Indices.Create)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (insertColumn_0_wrapper
           (Self.QObject_View,
            Column,
            Qt4.Model_Indices.Internals.QModelIndex_View (Parent)));
   end Insert_Column;

   ----------------
   -- Insert_Row --
   ----------------

   function Insert_Row
    (Self : not null access Q_Abstract_Item_Model'Class;
     Row : Qt4.Q_Integer;
     Parent : Qt4.Model_Indices.Q_Model_Index
       := Qt4.Model_Indices.Create)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (insertRow_0_wrapper
           (Self.QObject_View,
            Row,
            Qt4.Model_Indices.Internals.QModelIndex_View (Parent)));
   end Insert_Row;

   -------------------
   -- Remove_Column --
   -------------------

   function Remove_Column
    (Self : not null access Q_Abstract_Item_Model'Class;
     Column : Qt4.Q_Integer;
     Parent : Qt4.Model_Indices.Q_Model_Index
       := Qt4.Model_Indices.Create)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (removeColumn_0_wrapper
           (Self.QObject_View,
            Column,
            Qt4.Model_Indices.Internals.QModelIndex_View (Parent)));
   end Remove_Column;

   ----------------
   -- Remove_Row --
   ----------------

   function Remove_Row
    (Self : not null access Q_Abstract_Item_Model'Class;
     Row : Qt4.Q_Integer;
     Parent : Qt4.Model_Indices.Q_Model_Index
       := Qt4.Model_Indices.Create)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (removeRow_0_wrapper
           (Self.QObject_View,
            Row,
            Qt4.Model_Indices.Internals.QModelIndex_View (Parent)));
   end Remove_Row;

   -------------
   -- Sibling --
   -------------

   function Sibling
    (Self : not null access constant Q_Abstract_Item_Model'Class;
     Row : Qt4.Q_Integer;
     Column : Qt4.Q_Integer;
     Idx : Qt4.Model_Indices.Q_Model_Index)
       return Qt4.Model_Indices.Q_Model_Index
   is
      Returns : Qt4.Model_Indices.Q_Model_Index;

   begin
      sibling_0_wrapper
       (Self.QObject_View,
        Row,
        Column,
        Qt4.Model_Indices.Internals.QModelIndex_View (Idx),
        Qt4.Model_Indices.Internals.QModelIndex_View (Returns));

      return Returns;
   end Sibling;

end Qt4.Abstract_Item_Models;
