------------------------------------------------------------------------------
--                                                                          --
--                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.                                      --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3791 $ $Date: 2010-10-28 19:45:44 +0400 (Thu, 28 Oct 2010) $
------------------------------------------------------------------------------
with Qt_Ada.Internals.Events;

package Qt4.Events is

   type Event_Type is new Interfaces.C.int range 0 .. 65535;

   None                                   : constant Event_Type := 0;
   Timer                                  : constant Event_Type := 1;
   Mouse_Button_Press                     : constant Event_Type := 2;
   Mouse_Button_Release                   : constant Event_Type := 3;
   Mouse_Button_Dbl_Click                 : constant Event_Type := 4;
   Mouse_Move                             : constant Event_Type := 5;
   Key_Press                              : constant Event_Type := 6;
   Key_Release                            : constant Event_Type := 7;
   Focus_In                               : constant Event_Type := 8;
   Focus_Out                              : constant Event_Type := 9;
   Enter                                  : constant Event_Type := 10;
   Leave                                  : constant Event_Type := 11;
   Paint                                  : constant Event_Type := 12;
   Move                                   : constant Event_Type := 13;
   Resize                                 : constant Event_Type := 14;
   Create                                 : constant Event_Type := 15;
   Destroy                                : constant Event_Type := 16;
   --  XXX Описание события Destroy отсутствует в документации Qt.

   Show                                   : constant Event_Type := 17;
   Hide                                   : constant Event_Type := 18;
   Close                                  : constant Event_Type := 19;
   Quit                                   : constant Event_Type := 20;
   Parent_Change                          : constant Event_Type := 21;
   Parent_About_To_Change                 : constant Event_Type := 131;
   Thread_Change                          : constant Event_Type := 22;
   Window_Activate                        : constant Event_Type := 24;
   Window_Deactivate                      : constant Event_Type := 25;
   Show_To_Parent                         : constant Event_Type := 26;
   Hide_To_Parent                         : constant Event_Type := 27;
   Wheel                                  : constant Event_Type := 31;
   Window_Title_Change                    : constant Event_Type := 33;
   Window_Icon_Change                     : constant Event_Type := 34;
   Application_Window_Icon_Change         : constant Event_Type := 35;
   Application_Font_Change                : constant Event_Type := 36;
   Application_Layout_Direction_Change    : constant Event_Type := 37;
   Application_Palette_Change             : constant Event_Type := 38;
   Palette_Change                         : constant Event_Type := 39;
   Clipboard                              : constant Event_Type := 40;
   Speech                                 : constant Event_Type := 42;
   Meta_Call                              : constant Event_Type := 43;
   Sock_Act                               : constant Event_Type := 50;
   Win_Event_Act                          : constant Event_Type := 132;
   Deferred_Delete                        : constant Event_Type := 52;
   Drag_Enter                             : constant Event_Type := 60;
   Drag_Move                              : constant Event_Type := 61;
   Drag_Leave                             : constant Event_Type := 62;
   Drop                                   : constant Event_Type := 63;
   Drag_Response                          : constant Event_Type := 64;
   Child_Inserted_Request                 : constant Event_Type := 67;
   Child_Added                            : constant Event_Type := 68;
   Child_Polished                         : constant Event_Type := 69;
   Child_Inserted                         : constant Event_Type := 70;
   Child_Removed                          : constant Event_Type := 71;
   Show_Window_Request                    : constant Event_Type := 73;
   Polish_Request                         : constant Event_Type := 74;
   Polish                                 : constant Event_Type := 75;
   Layout_Request                         : constant Event_Type := 76;
   Update_Request                         : constant Event_Type := 77;
   Update_Later                           : constant Event_Type := 78;
   Embedding_Control                      : constant Event_Type := 79;
   Activate_Control                       : constant Event_Type := 80;
   Deactivate_Control                     : constant Event_Type := 81;
   Context_Menu                           : constant Event_Type := 82;
   Input_Method                           : constant Event_Type := 83;
   Accessibility_Prepare                  : constant Event_Type := 86;
   Tablet_Move                            : constant Event_Type := 87;
   Locale_Change                          : constant Event_Type := 88;
   Language_Change                        : constant Event_Type := 89;
   Layout_Direction_Change                : constant Event_Type := 90;
   Style                                  : constant Event_Type := 91;
   Tablet_Press                           : constant Event_Type := 92;
   Tablet_Release                         : constant Event_Type := 93;
   Ok_Request                             : constant Event_Type := 94;
   Help_Request                           : constant Event_Type := 95;
   Icon_Drag                              : constant Event_Type := 96;
   Font_Change                            : constant Event_Type := 97;
   Enabled_Change                         : constant Event_Type := 98;
   Activation_Change                      : constant Event_Type := 99;
   Style_Change                           : constant Event_Type := 100;
   Icon_Text_Change                       : constant Event_Type := 101;
   Modified_Change                        : constant Event_Type := 102;
   Mouse_Tracking_Change                  : constant Event_Type := 109;
   Window_Blocked                         : constant Event_Type := 103;
   Window_Unblocked                       : constant Event_Type := 104;
   Window_State_Change                    : constant Event_Type := 105;
   Tool_Tip                               : constant Event_Type := 110;
   Whats_This                             : constant Event_Type := 111;
   Status_Tip                             : constant Event_Type := 112;
   Action_Changed                         : constant Event_Type := 113;
   Action_Added                           : constant Event_Type := 114;
   Action_Removed                         : constant Event_Type := 115;
   FileOpen                               : constant Event_Type := 116;
   Shortcut                               : constant Event_Type := 117;
   Shortcut_Override                      : constant Event_Type := 51;
   Whats_This_Clicked                     : constant Event_Type := 118;
   Tool_Bar_Change                        : constant Event_Type := 120;
   Application_Activated                  : constant Event_Type := 121;
   Application_Deactivated                : constant Event_Type := 122;
   Query_Whats_This                       : constant Event_Type := 123;
   Enter_Whats_This_Mode                  : constant Event_Type := 124;
   Leave_Whats_This_Mode                  : constant Event_Type := 125;
   Z_Order_Change                         : constant Event_Type := 126;
   Hover_Enter                            : constant Event_Type := 127;
   Hover_Leave                            : constant Event_Type := 128;
   Hover_Move                             : constant Event_Type := 129;
   Accessibility_Help                     : constant Event_Type := 119;
   Accessibility_Description              : constant Event_Type := 130;
   Accept_Drops_Change                    : constant Event_Type := 152;
   Menubar_Updated                        : constant Event_Type := 153;
   Zero_Timer_Event                       : constant Event_Type := 154;
   Graphics_Scene_Mouse_Move              : constant Event_Type := 155;
   Graphics_Scene_Mouse_Press             : constant Event_Type := 156;
   Graphics_Scene_Mouse_Release           : constant Event_Type := 157;
   Graphics_Scene_Mouse_Double_Click      : constant Event_Type := 158;
   Graphics_Scene_Context_Menu            : constant Event_Type := 159;
   Graphics_Scene_Hover_Enter             : constant Event_Type := 160;
   Graphics_Scene_Hover_Move              : constant Event_Type := 161;
   Graphics_Scene_Hover_Leave             : constant Event_Type := 162;
   Graphics_Scene_Help                    : constant Event_Type := 163;
   Graphics_Scene_Drag_Enter              : constant Event_Type := 164;
   Graphics_Scene_Drag_Move               : constant Event_Type := 165;
   Graphics_Scene_Drag_Leave              : constant Event_Type := 166;
   Graphics_Scene_Drop                    : constant Event_Type := 167;
   Graphics_Scene_Wheel                   : constant Event_Type := 168;
   Keyboard_Layout_Change                 : constant Event_Type := 169;
   Dynamic_Property_Change                : constant Event_Type := 170;
   Tablet_Enter_Proximity                 : constant Event_Type := 171;
   Tablet_Leave_Proximity                 : constant Event_Type := 172;
   Non_Client_Area_Mouse_Move             : constant Event_Type := 173;
   Non_Client_Area_Mouse_Button_Press     : constant Event_Type := 174;
   Non_Client_Area_Mouse_Button_Release   : constant Event_Type := 175;
   Non_Client_Area_Mouse_Button_Dbl_Click : constant Event_Type := 176;
   --  XXX Описание событий Non_Client_Area_Mouse_* отсутствует в документации
   --  Qt 4.3.0.
   Mac_Size_Change                        : constant Event_Type := 177;
   Contents_Rect_Change                   : constant Event_Type := 178;
   Mac_GL_Window_Change                   : constant Event_Type := 179;
   --  XXX This event was not described in the Qt 4.4 documentation.
   Future_Call_Out                        : constant Event_Type := 180;
   --  XXX This event was not described in the Qt 4.4 documentation.
   Graphics_Scene_Resize                  : constant Event_Type := 181;
   Graphics_Scene_Move                    : constant Event_Type := 182;
   Cursor_Change                          : constant Event_Type := 183;
   Tool_Tip_Change                        : constant Event_Type := 184;
   Network_Reply_Updated                  : constant Event_Type := 185;
   Grab_Mouse                             : constant Event_Type := 186;
   Ungrab_Mouse                           : constant Event_Type := 187;
   Grab_Keyboard                          : constant Event_Type := 188;
   Ungrab_Keyboard                        : constant Event_Type := 189;

   User                                   : constant Event_Type := 1000;
   Max_User                               : constant Event_Type
     := Event_Type'Last;

--   type Q_Event is limited interface
--     and Qt_Ada.Internals.Events.Q_Event_Base;

   type Q_Event is
     new Qt_Ada.Internals.Events.Q_Event_Base with null record;

--   type Q_Event_Access is access all Q_Event'Class;
   type Q_Event_Access is
     access all Qt_Ada.Internals.Events.Q_Event_Base'Class;

   procedure Accept_Event (Self : not null access Q_Event'Class);

   procedure Ignore (Self : not null access Q_Event'Class);

   function Is_Accepted (Self : not null access constant Q_Event'Class)
     return Boolean;

   procedure Set_Accepted
    (Self  : not null access Q_Event'Class;
     Value : Boolean);

   function Spontaneous (Self : not null access constant Q_Event'Class)
     return Boolean;

   function Type_Of_Event (Self : not null access constant Q_Event'Class)
     return Event_Type;

   package Internals is

      function Create_Null_Wrapper
       (Cpp_Object : access Qt_Ada.Internals.Events.QEvent)
          return access Q_Event'Class;

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

   end Internals;

end Qt4.Events;
