------------------------------------------------------------------------------
--                                                                          --
--                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 Interfaces.C.Strings;
with Qt4.Child_Events;
with Qt4.Events;
with Qt4.Timer_Events;
with Qt_Ada.Internals.Events;
with Qt_Ada.Internals.Events.Registry;
with Qt_Ada.Internals.Object_Registry;
pragma Elaborate (Qt_Ada.Internals.Object_Registry);
with Qt_Ada.Internals.Objects.Object_Utilities;

package body Qt4.Objects.Directors is

   function qt_metacall_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Kind : Qt4.Meta_Objects.Call;
     Id   : Qt4.Q_Integer;
     Args : Qt4.Address_Pointer)
       return Qt4.Q_Integer;
   pragma Import (C, qt_metacall_wrapper,
                  "__Qt4Ada_QObject_qt_metacall_wrapper");

   function qt_metacast_wrapper
    (Self  : not null access Qt_Ada.Internals.Objects.QObject;
     Class : Interfaces.C.char_array)
       return System.Address;
   pragma Import (C, qt_metacast_wrapper,
                  "__Qt4Ada_QObject_qt_metacast_wrapper");

   function event_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     E : not null access Qt_Ada.Internals.Events.QEvent)
       return Qt4.bool;
   pragma Export (C, event_0_dispatch,
                     "__Qt4Ada_QObject_event_0_dispatch");
   pragma Warnings (Off, event_0_dispatch);
   --  GCC GNAT 4.3.0: suppress warning
   --  is a tagged type which does not correspond to any C type

   function event_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     E : not null access Qt_Ada.Internals.Events.QEvent)
       return Qt4.bool;
   pragma Import (C, event_0_wrapper,
                     "__Qt4Ada_QObject_event_0_wrapper");

   function eventFilter_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Watched : not null access Qt_Ada.Internals.Objects.QObject;
     Event : not null access Qt_Ada.Internals.Events.QEvent)
       return Qt4.bool;
   pragma Export (C, eventFilter_0_dispatch,
                     "__Qt4Ada_QObject_eventFilter_0_dispatch");
   pragma Warnings (Off, eventFilter_0_dispatch);
   --  GCC GNAT 4.3.0: suppress warning
   --  is a tagged type which does not correspond to any C type

   function eventFilter_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Watched : not null access Qt_Ada.Internals.Objects.QObject;
     Event : not null access Qt_Ada.Internals.Events.QEvent)
       return Qt4.bool;
   pragma Import (C, eventFilter_0_wrapper,
                     "__Qt4Ada_QObject_eventFilter_0_wrapper");

   procedure childEvent_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Event : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Export (C, childEvent_0_dispatch,
                     "__Qt4Ada_QObject_childEvent_0_dispatch");
   pragma Warnings (Off, childEvent_0_dispatch);
   --  GCC GNAT 4.3.0: suppress warning
   --  is a tagged type which does not correspond to any C type

   procedure childEvent_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Event : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Import (C, childEvent_0_wrapper,
                     "__Qt4Ada_QObject_childEvent_0_wrapper");

   procedure customEvent_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Event : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Export (C, customEvent_0_dispatch,
                     "__Qt4Ada_QObject_customEvent_0_dispatch");
   pragma Warnings (Off, customEvent_0_dispatch);
   --  GCC GNAT 4.3.0: suppress warning
   --  is a tagged type which does not correspond to any C type

   procedure customEvent_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Event : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Import (C, customEvent_0_wrapper,
                     "__Qt4Ada_QObject_customEvent_0_wrapper");

   procedure timerEvent_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Event : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Export (C, timerEvent_0_dispatch,
                     "__Qt4Ada_QObject_timerEvent_0_dispatch");
   pragma Warnings (Off, timerEvent_0_dispatch);
   --  GCC GNAT 4.3.0: suppress warning
   --  is a tagged type which does not correspond to any C type

   procedure timerEvent_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Event : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Import (C, timerEvent_0_wrapper,
                     "__Qt4Ada_QObject_timerEvent_0_wrapper");

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

   type Q_Object_Access is access all Q_Object'Class;

   procedure connectNotify
    (Self   : not null access Qt_Ada.Internals.Objects.QObject;
     Signal : Interfaces.C.char_array);
   pragma Import (C, connectNotify, "__Qt4Ada_QObject_connectNotify_wrapper");

   procedure disconnectNotify
    (Self   : not null access Qt_Ada.Internals.Objects.QObject;
     Signal : Interfaces.C.char_array);
   pragma Import
    (C, disconnectNotify, "__Qt4Ada_QObject_disconnectNotify_wrapper");

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

   procedure connectNotify_dispatch
    (Self   : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Signal : Interfaces.C.Strings.chars_ptr);
   pragma Export
    (C, connectNotify_dispatch, "__Qt4Ada_QObject_connectNotify_dispatch");
   pragma Warnings (Off, connectNotify_dispatch);

   procedure disconnectNotify_dispatch
    (Self   : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Signal : Interfaces.C.Strings.chars_ptr);
   pragma Export
    (C, disconnectNotify_dispatch,
     "__Qt4Ada_QObject_disconnectNotify_dispatch");
   pragma Warnings (Off, disconnectNotify_dispatch);

   --------------------
   -- Connect_Notify --
   --------------------

   procedure Connect_Notify
    (Self   : not null access Q_Object_Director;
     Signal : String)
   is
   begin
      connectNotify (Self.QObject_View, Interfaces.C.To_C (Signal));
   end Connect_Notify;

   ----------------------------
   -- connectNotify_dispatch --
   ----------------------------

   procedure connectNotify_dispatch
    (Self   : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Signal : Interfaces.C.Strings.chars_ptr)
   is
   begin
      Q_Object_Director'Class (Self.all).Connect_Notify
       (Interfaces.C.Strings.Value (Signal));
   end connectNotify_dispatch;

   ------------------
   -- Constructors --
   ------------------

   package body Constructors is

      function new_QObjectDirector
       (Object : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
        Parent : access Qt_Ada.Internals.Objects.QObject)
          return not null Qt_Ada.Internals.Objects.QObject_Access;
      pragma Import (C, new_QObjectDirector, "__Qt4Ada_new_QObjectDirector");
      pragma Warnings (Off, new_QObjectDirector);

      ----------------
      -- Initialize --
      ----------------

      procedure Initialize
       (Self   : not null access Q_Object_Director'Class;
        Parent : access Q_Object'Class := null)
      is
         Director : constant not null Qt_Ada.Internals.Objects.QObject_Access
           := new_QObjectDirector
               (Qt_Ada.Internals.Objects.Q_Object_Base_Access (Self),
                Qt_Ada.Internals.Objects.Object_Utilities.Corresponding_QObject
                 (Parent));

      begin
         Qt_Ada.Internals.Objects.Initialize (Self, Director);
      end Initialize;

   end Constructors;

   -----------------------
   -- Disconnect_Notify --
   -----------------------

   procedure Disconnect_Notify
    (Self   : not null access Q_Object_Director;
     Signal : String)
   is
   begin
      disconnectNotify (Self.QObject_View, Interfaces.C.To_C (Signal));
   end Disconnect_Notify;

   -------------------------------
   -- disconnectNotify_dispatch --
   -------------------------------

   procedure disconnectNotify_dispatch
    (Self   : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Signal : Interfaces.C.Strings.chars_ptr)
   is
   begin
      Q_Object_Director'Class (Self.all).Disconnect_Notify
       (Interfaces.C.Strings.Value (Signal));
   end disconnectNotify_dispatch;

   --------------------
   -- Emit_Destroyed --
   --------------------

   procedure Emit_Destroyed
    (Self : not null access Q_Object_Director;
     Obj  : access Qt4.Objects.Q_Object'Class := null)
   is
   begin
      destroyed_wrapper
       (Self.QObject_View,
        Qt_Ada.Internals.Objects.Object_Utilities.Corresponding_QObject (Obj));
   end Emit_Destroyed;

   pragma Style_Checks ("N");

   ----------------------
   -- event_0_dispatch --
   ----------------------

   function event_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     E : not null access Qt_Ada.Internals.Events.QEvent)
       return Qt4.bool
   is
   begin
      return
        Qt4.To_bool
         (Q_Object_Director'Class (Self.all).Event
           (Qt4.Events.Q_Event'Class (Qt_Ada.Internals.Events.Registry.Create_Wrapper (E).all)'Access));
   end event_0_dispatch;

   -----------
   -- Event --
   -----------

   overriding
   function Event
    (Self : not null access Q_Object_Director;
     E : not null access Qt4.Events.Q_Event'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (event_0_wrapper
           (Q_Object_Director'Class (Self.all).QObject_View,
            E.QEvent_View));
   end Event;

   ----------------------------
   -- eventFilter_0_dispatch --
   ----------------------------

   function eventFilter_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Watched : not null access Qt_Ada.Internals.Objects.QObject;
     Event : not null access Qt_Ada.Internals.Events.QEvent)
       return Qt4.bool
   is
   begin
      return
        Qt4.To_bool
         (Q_Object_Director'Class (Self.all).Event_Filter
           (Qt4.Objects.Q_Object'Class (Qt_Ada.Internals.Object_Registry.To_Q_Object (Watched).all)'Access,
            Qt4.Events.Q_Event'Class (Qt_Ada.Internals.Events.Registry.Create_Wrapper (Event).all)'Access));
   end eventFilter_0_dispatch;

   ------------------
   -- Event_Filter --
   ------------------

   overriding
   function Event_Filter
    (Self : not null access Q_Object_Director;
     Watched : not null access Qt4.Objects.Q_Object'Class;
     Event : not null access Qt4.Events.Q_Event'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (eventFilter_0_wrapper
           (Q_Object_Director'Class (Self.all).QObject_View,
            Watched.QObject_View,
            Event.QEvent_View));
   end Event_Filter;

   ---------------------------
   -- childEvent_0_dispatch --
   ---------------------------

   procedure childEvent_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Event : not null access Qt_Ada.Internals.Events.QEvent)
   is
   begin
      Q_Object_Director'Class (Self.all).Child_Event
       (Qt4.Child_Events.Q_Child_Event'Class (Qt_Ada.Internals.Events.Registry.Create_Wrapper (Event).all)'Access);
   end childEvent_0_dispatch;

   -----------------
   -- Child_Event --
   -----------------

   not overriding
   procedure Child_Event
    (Self : not null access Q_Object_Director;
     Event : not null access Qt4.Child_Events.Q_Child_Event'Class)
   is
   begin
      childEvent_0_wrapper
       (Q_Object_Director'Class (Self.all).QObject_View,
        Event.QEvent_View);
   end Child_Event;

   ----------------------------
   -- customEvent_0_dispatch --
   ----------------------------

   procedure customEvent_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Event : not null access Qt_Ada.Internals.Events.QEvent)
   is
   begin
      Q_Object_Director'Class (Self.all).Custom_Event
       (Qt4.Events.Q_Event'Class (Qt_Ada.Internals.Events.Registry.Create_Wrapper (Event).all)'Access);
   end customEvent_0_dispatch;

   ------------------
   -- Custom_Event --
   ------------------

   not overriding
   procedure Custom_Event
    (Self : not null access Q_Object_Director;
     Event : not null access Qt4.Events.Q_Event'Class)
   is
   begin
      customEvent_0_wrapper
       (Q_Object_Director'Class (Self.all).QObject_View,
        Event.QEvent_View);
   end Custom_Event;

   ---------------------------
   -- timerEvent_0_dispatch --
   ---------------------------

   procedure timerEvent_0_dispatch
    (Self : not null Qt_Ada.Internals.Objects.Q_Object_Base_Access;
     Event : not null access Qt_Ada.Internals.Events.QEvent)
   is
   begin
      Q_Object_Director'Class (Self.all).Timer_Event
       (Qt4.Timer_Events.Q_Timer_Event'Class (Qt_Ada.Internals.Events.Registry.Create_Wrapper (Event).all)'Access);
   end timerEvent_0_dispatch;

   -----------------
   -- Timer_Event --
   -----------------

   not overriding
   procedure Timer_Event
    (Self : not null access Q_Object_Director;
     Event : not null access Qt4.Timer_Events.Q_Timer_Event'Class)
   is
   begin
      timerEvent_0_wrapper
       (Q_Object_Director'Class (Self.all).QObject_View,
        Event.QEvent_View);
   end Timer_Event;

   ------------
   -- Sender --
   ------------

   not overriding
   function Sender
    (Self : not null access constant Q_Object_Director)
       return access Qt4.Objects.Q_Object'Class
   is
   begin
      return
        Qt_Ada.Internals.Objects.Object_Utilities.Corresponding_Q_Object
         (sender_0_wrapper
           (Q_Object_Director'Class (Self.all).QObject_View));
   end Sender;

begin
   Qt_Ada.Internals.Object_Registry.Register_Director
    ("QObject", qt_metacast_wrapper'Access, qt_metacall_wrapper'Access);

end Qt4.Objects.Directors;
