------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 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.                                      --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3855 $ $Date: 2011-06-29 18:40:53 +0400 (Wed, 29 Jun 2011) $
------------------------------------------------------------------------------
with Qt4.Events;
with Qt_Ada.Internals.Events.Registry;
with Qt_Ada.Internals.Object_Registry;
with Qt_Ada.Internals.Objects;

package body Qt4.Graphics_Scene_Drag_Drop_Events is

   function Create
    (Object : not null Qt_Ada.Internals.Events.QEvent_Access)
       return not null Qt4.Events.Q_Event_Access;

   function mimeData_wrapper
    (Self : not null access Qt_Ada.Internals.Events.QEvent)
       return not null access Qt_Ada.Internals.Objects.QObject;
   pragma Import
    (C,
     mimeData_wrapper,
     "__Qt4Ada_QGraphicsSceneDragDropEvent_mimeData_wrapper");

   procedure pos_wrapper
    (Returns : Qt4.Point_Fs.Internals.QPointF_Access;
     Self    : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Import
    (C, pos_wrapper, "__Qt4Ada_QGraphicsSceneDragDropEvent_pos_wrapper");

   procedure scenePos_wrapper
    (Returns : Qt4.Point_Fs.Internals.QPointF_Access;
     Self    : not null access Qt_Ada.Internals.Events.QEvent);
   pragma Import
    (C,
     scenePos_wrapper,
     "__Qt4Ada_QGraphicsSceneDragDropEvent_scenePos_wrapper");

   ------------
   -- Create --
   ------------

   function Create
    (Object : not null Qt_Ada.Internals.Events.QEvent_Access)
       return not null Qt4.Events.Q_Event_Access
   is
   begin
      return Result : constant not null Qt4.Events.Q_Event_Access
        := new Q_Graphics_Scene_Drag_Drop_Event
      do
         Qt_Ada.Internals.Events.Initialize (Result, Object);
      end return;
   end Create;

   ---------------
   -- Mime_Data --
   ---------------

   function Mime_Data
    (Self : not null access constant Q_Graphics_Scene_Drag_Drop_Event'Class)
       return not null access Qt4.Mime_Datas.Q_Mime_Data'Class is
   begin
      return
        Qt4.Mime_Datas.Q_Mime_Data'Class
         (Qt_Ada.Internals.Object_Registry.To_Q_Object
           (mimeData_wrapper (Self.QEvent_View)).all)'Access;
   end Mime_Data;

   ---------
   -- Pos --
   ---------

   function Pos
    (Self : not null access constant Q_Graphics_Scene_Drag_Drop_Event'Class)
       return Qt4.Point_Fs.Q_Point_F is
   begin
      return Returns : Qt4.Point_Fs.Q_Point_F do
         pos_wrapper
          (Qt4.Point_Fs.Internals.QPointF_View (Returns), Self.QEvent_View);
      end return;
   end Pos;

   ---------------
   -- Scene_Pos --
   ---------------

   function Scene_Pos
    (Self : not null access constant Q_Graphics_Scene_Drag_Drop_Event'Class)
       return Qt4.Point_Fs.Q_Point_F is
   begin
      return Returns : Qt4.Point_Fs.Q_Point_F do
         scenePos_wrapper
          (Qt4.Point_Fs.Internals.QPointF_View (Returns), Self.QEvent_View);
      end return;
   end Scene_Pos;

begin
   Qt_Ada.Internals.Events.Registry.Register
    (Qt4.Events.Graphics_Scene_Drag_Enter, Create'Access);
   Qt_Ada.Internals.Events.Registry.Register
    (Qt4.Events.Graphics_Scene_Drag_Leave, Create'Access);
   Qt_Ada.Internals.Events.Registry.Register
    (Qt4.Events.Graphics_Scene_Drag_Move, Create'Access);
   Qt_Ada.Internals.Events.Registry.Register
    (Qt4.Events.Graphics_Scene_Drop, Create'Access);
end Qt4.Graphics_Scene_Drag_Drop_Events;
