------------------------------------------------------------------------------
--                                                                          --
--                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.     --
------------------------------------------------------------------------------
with Qt_Ada.Internals.Object_Registry;
with Qt_Ada.Internals.Objects.Object_Utilities;

with Qt_Ada.Internals.Objects.Object_Proxies;
pragma Warnings (Off, Qt_Ada.Internals.Objects.Object_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.Objects is

   function blockSignals_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     B : Qt4.bool)
       return Qt4.bool;
   pragma Import (C, blockSignals_0_wrapper,
                     "__Qt4Ada_QObject_blockSignals_0_wrapper");

   procedure installEventFilter_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Filter_Obj : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, installEventFilter_0_wrapper,
                     "__Qt4Ada_QObject_installEventFilter_0_wrapper");

   function isWidgetType_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isWidgetType_0_wrapper,
                     "__Qt4Ada_QObject_isWidgetType_0_wrapper");

   procedure objectName_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Strings.Internals.QString);
   pragma Import (C, objectName_0_wrapper,
                     "__Qt4Ada_QObject_objectName_0_wrapper");

   function parent_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return not null access Qt_Ada.Internals.Objects.QObject;
   pragma Import (C, parent_0_wrapper,
                     "__Qt4Ada_QObject_parent_0_wrapper");

   procedure property_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Name : Interfaces.C.char_array;
     Returns : not null access Qt4.Variants.Internals.QVariant);
   pragma Import (C, property_0_wrapper,
                     "__Qt4Ada_QObject_property_0_wrapper");

   procedure removeEventFilter_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Obj : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, removeEventFilter_0_wrapper,
                     "__Qt4Ada_QObject_removeEventFilter_0_wrapper");

   procedure setObjectName_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Name : not null access constant Qt4.Strings.Internals.QString);
   pragma Import (C, setObjectName_0_wrapper,
                     "__Qt4Ada_QObject_setObjectName_0_wrapper");

   procedure setParent_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Parent : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, setParent_0_wrapper,
                     "__Qt4Ada_QObject_setParent_0_wrapper");

   procedure setProperty_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Name : Interfaces.C.char_array;
     Value : not null access constant Qt4.Variants.Internals.QVariant);
   pragma Import (C, setProperty_0_wrapper,
                     "__Qt4Ada_QObject_setProperty_0_wrapper");

   function signalsBlocked_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, signalsBlocked_0_wrapper,
                     "__Qt4Ada_QObject_signalsBlocked_0_wrapper");

   procedure deleteLater_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, deleteLater_0_wrapper,
                     "__Qt4Ada_QObject_deleteLater_0_wrapper");

   function metaObject_virtual
    (This : not null access Qt_Ada.Internals.Objects.QObject)
       return not null access constant Qt4.Meta_Objects.Q_Meta_Object;
   pragma Import
    (C, metaObject_virtual, "__Qt4Ada_QObject_metaObject_virtual");

   function connect_wrapper
    (Sender   : not null access Qt_Ada.Internals.Objects.QObject;
     Signal   : Interfaces.C.char_array;
     Receiver : not null access Qt_Ada.Internals.Objects.QObject;
     Slot     : Interfaces.C.char_array;
     The_Type : Qt4.Connection_Type)
       return bool;
   pragma Import (C, connect_wrapper, "__Qt4Ada_QObject_connect_wrapper");

   function start_timer_wrapper
    (Self     : not null access Qt_Ada.Internals.Objects.QObject;
     Interval : Interfaces.C.int)
       return Interfaces.C.int;
   pragma Import
    (C, start_timer_wrapper, "__Qt4Ada_QObject_start_timer_wrapper");

   procedure kill_timer_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Id   : Interfaces.C.int);
   pragma Import
    (C, kill_timer_wrapper, "__Qt4Ada_QObject_kill_timer_wrapper");

   function findChild_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Name : Qt4.Strings.Internals.QString_Access)
       return access Qt_Ada.Internals.Objects.QObject;
   pragma Import (C, findChild_wrapper,
                     "__Qt4Ada_QObject_findChild_wrapper");

   -------------
   -- Connect --
   -------------

   procedure Connect
    (Sender   : not null access Q_Object'Class;
     Signal   : Qt4.Signal_Name;
     Receiver : not null access Q_Object'Class;
     Method   : Qt4.Signal_Name;
     The_Type : Qt4.Connection_Type := Qt4.Auto_Connection)
   is
   begin
      if not connect_wrapper
              (Sender.QObject_View,
               Interfaces.C.To_C (String (Signal)),
               Receiver.QObject_View,
               Interfaces.C.To_C (String (Method)),
               The_Type)
      then
         raise Connect_Error;
      end if;
   end Connect;

   -------------
   -- Connect --
   -------------

   procedure Connect
    (Sender   : not null access Q_Object'Class;
     Signal   : Qt4.Signal_Name;
     Receiver : not null access Q_Object'Class;
     Method   : Qt4.Slot_Name;
     The_Type : Qt4.Connection_Type := Qt4.Auto_Connection)
   is
   begin
      if not connect_wrapper
              (Sender.QObject_View,
               Interfaces.C.To_C (String (Signal)),
               Receiver.QObject_View,
               Interfaces.C.To_C (String (Method)),
               The_Type)
      then
         raise Connect_Error;
      end if;
   end Connect;

   -------------
   -- Connect --
   -------------

   procedure Connect
    (Self     : not null access Q_Object'Class;
     Sender   : not null access Q_Object'Class;
     Signal   : Qt4.Signal_Name;
     Method   : Qt4.Signal_Name;
     The_Type : Qt4.Connection_Type := Qt4.Auto_Connection)
   is
   begin
      Connect (Sender, Signal, Self, Method, The_Type);
   end Connect;

   -------------
   -- Connect --
   -------------

   procedure Connect
    (Self     : not null access Q_Object'Class;
     Sender   : not null access Q_Object'Class;
     Signal   : Qt4.Signal_Name;
     Method   : Qt4.Slot_Name;
     The_Type : Qt4.Connection_Type := Auto_Connection)
   is
   begin
      Connect (Sender, Signal, Self, Method, The_Type);
   end Connect;

   -----------------
   -- Meta_Object --
   -----------------

   function Meta_Object (Self : not null access Q_Object'Class)
     return not null access constant Qt4.Meta_Objects.Q_Meta_Object
   is
   begin
      return metaObject_virtual (Self.QObject_View);
   end Meta_Object;

   -----------------
   -- Start_Timer --
   -----------------

   function Start_Timer
    (Self     : not null access Q_Object'Class;
     Interval : Duration)
       return Qt4.Q_Integer
   is
   begin
      return Qt4.Q_Integer
              (start_timer_wrapper
                (Self.QObject_View,
                 Interfaces.C.int (Interval * 1000)));
   end Start_Timer;

   ----------------
   -- Kill_Timer --
   ----------------

   procedure Kill_Timer
    (Self : not null access Q_Object'Class;
     Id   : Qt4.Q_Integer)
   is
   begin
      kill_timer_wrapper
       (Self.QObject_View,
        Interfaces.C.int (Id));
   end Kill_Timer;

   ----------------
   -- Find_Child --
   ----------------

   function Find_Child
    (Self : not null access constant Q_Object'Class;
     Name : Qt4.Strings.Q_String := Qt4.Strings.Create)
       return access Qt4.Objects.Q_Object'Class
   is
   begin
      return
        Qt_Ada.Internals.Objects.Object_Utilities.Corresponding_Q_Object
         (findChild_wrapper
           (Self.QObject_View,
            Qt4.Strings.Internals.QString_View (Name)));
   end Find_Child;

   pragma Style_Checks ("N");

   -------------------
   -- Block_Signals --
   -------------------

   function Block_Signals
    (Self : not null access Q_Object'Class;
     B : Standard.Boolean)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (blockSignals_0_wrapper
           (Self.QObject_View,
            Qt4.To_bool (B)));
   end Block_Signals;

   --------------------------
   -- Install_Event_Filter --
   --------------------------

   procedure Install_Event_Filter
    (Self : not null access Q_Object'Class;
     Filter_Obj : not null access Qt4.Objects.Q_Object'Class)
   is
   begin
      installEventFilter_0_wrapper
       (Self.QObject_View,
        Filter_Obj.QObject_View);
   end Install_Event_Filter;

   --------------------
   -- Is_Widget_Type --
   --------------------

   function Is_Widget_Type
    (Self : not null access constant Q_Object'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isWidgetType_0_wrapper
           (Self.QObject_View));
   end Is_Widget_Type;

   -----------------
   -- Object_Name --
   -----------------

   function Object_Name
    (Self : not null access constant Q_Object'Class)
       return Qt4.Strings.Q_String
   is
      Returns : Qt4.Strings.Q_String;

   begin
      objectName_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Returns));

      return Returns;
   end Object_Name;

   ------------
   -- Parent --
   ------------

   function Parent
    (Self : not null access constant Q_Object'Class)
       return not null access Qt4.Objects.Q_Object'Class
   is
   begin
      return
        Qt4.Objects.Q_Object'Class
         (Qt_Ada.Internals.Object_Registry.To_Q_Object
           (parent_0_wrapper
             (Self.QObject_View)).all)'Access;
   end Parent;

   --------------
   -- Property --
   --------------

   function Property
    (Self : not null access constant Q_Object'Class;
     Name : String)
       return Qt4.Variants.Q_Variant
   is
      Returns : Qt4.Variants.Q_Variant;

   begin
      property_0_wrapper
       (Self.QObject_View,
        Interfaces.C.To_C (Name),
        Qt4.Variants.Internals.QVariant_View (Returns));

      return Returns;
   end Property;

   -------------------------
   -- Remove_Event_Filter --
   -------------------------

   procedure Remove_Event_Filter
    (Self : not null access Q_Object'Class;
     Obj : not null access Qt4.Objects.Q_Object'Class)
   is
   begin
      removeEventFilter_0_wrapper
       (Self.QObject_View,
        Obj.QObject_View);
   end Remove_Event_Filter;

   ---------------------
   -- Set_Object_Name --
   ---------------------

   procedure Set_Object_Name
    (Self : not null access Q_Object'Class;
     Name : Qt4.Strings.Q_String)
   is
   begin
      setObjectName_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Name));
   end Set_Object_Name;

   ----------------
   -- Set_Parent --
   ----------------

   procedure Set_Parent
    (Self : not null access Q_Object'Class;
     Parent : not null access Qt4.Objects.Q_Object'Class)
   is
   begin
      setParent_0_wrapper
       (Self.QObject_View,
        Parent.QObject_View);
   end Set_Parent;

   ------------------
   -- Set_Property --
   ------------------

   procedure Set_Property
    (Self : not null access Q_Object'Class;
     Name : String;
     Value : Qt4.Variants.Q_Variant)
   is
   begin
      setProperty_0_wrapper
       (Self.QObject_View,
        Interfaces.C.To_C (Name),
        Qt4.Variants.Internals.QVariant_View (Value));
   end Set_Property;

   ---------------------
   -- Signals_Blocked --
   ---------------------

   function Signals_Blocked
    (Self : not null access constant Q_Object'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (signalsBlocked_0_wrapper
           (Self.QObject_View));
   end Signals_Blocked;

   ------------------
   -- Delete_Later --
   ------------------

   procedure Delete_Later
    (Self : not null access Q_Object'Class)
   is
   begin
      deleteLater_0_wrapper
       (Self.QObject_View);
   end Delete_Later;

end Qt4.Objects;
