------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2009-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 System.Address_To_Access_Conversions;

package body Qt4.Key_Sequences is

   function initialize_QListOfQKeySequence
    (Storage : System.Address)
      return Internals.QListOfQKeySequence_Access;
   pragma Import (C, initialize_QListOfQKeySequence, "__QtAda_inititialize_QListOfQKeySequence");

   function adjust_QListOfQKeySequence
    (Storage : System.Address;
     From    : Internals.QListOfQKeySequence_Access)
       return Internals.QListOfQKeySequence_Access;
   pragma Import (C, adjust_QListOfQKeySequence, "__QtAda_adjust_QListOfQKeySequence");

   procedure finalize_QListOfQKeySequence (Object : Internals.QListOfQKeySequence_Access);
   pragma Import (C, finalize_QListOfQKeySequence, "__QtAda_finalize_QListOfQKeySequence");

   ------------
   -- Adjust --
   ------------

   overriding
   procedure Adjust (Self : in out Q_List_Of_Q_Key_Sequence) is
   begin
      Self.Object := adjust_QListOfQKeySequence (Self.Storage'Address, Self.Object);
      Self.Wrapper := False;
   end Adjust;

   --------------
   -- Finalize --
   --------------

   overriding
   procedure Finalize (Self : in out Q_List_Of_Q_Key_Sequence) is
   begin
      if not Self.Wrapper then
         finalize_QListOfQKeySequence (Self.Object);
      end if;
   end Finalize;

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

   overriding
   procedure Initialize (Self : in out Q_List_Of_Q_Key_Sequence) is
      use type Internals.QListOfQKeySequence_Access;

   begin
      if Self.Object = null then
         Self.Object := initialize_QListOfQKeySequence (Self.Storage'Address);
      end if;
   end Initialize;

   function initialize_QKeySequence
    (Storage : System.Address)
      return Internals.QKeySequence_Access;
   pragma Import (C, initialize_QKeySequence, "__QtAda_inititialize_QKeySequence");

   function initialize_QKeySequence_QStringCR
    (Storage : System.Address;
     Key : Qt4.Strings.Internals.QString_Access)
      return Internals.QKeySequence_Access;
   pragma Import (C, initialize_QKeySequence_QStringCR, "__QtAda_inititialize_QKeySequence_QStringCR");

   function initialize_QKeySequence_int_int_int_int
    (Storage : System.Address;
     K_1 : Qt4.Q_Integer;
     K_2 : Qt4.Q_Integer;
     K_3 : Qt4.Q_Integer;
     K_4 : Qt4.Q_Integer)
      return Internals.QKeySequence_Access;
   pragma Import (C, initialize_QKeySequence_int_int_int_int, "__QtAda_inititialize_QKeySequence_int_int_int_int");

   function initialize_QKeySequence_StandardKey
    (Storage : System.Address;
     Key : Standard_Key)
      return Internals.QKeySequence_Access;
   pragma Import (C, initialize_QKeySequence_StandardKey, "__QtAda_inititialize_QKeySequence_StandardKey");

   function adjust_QKeySequence
    (Storage : System.Address;
     From    : Internals.QKeySequence_Access)
       return Internals.QKeySequence_Access;
   pragma Import (C, adjust_QKeySequence, "__QtAda_adjust_QKeySequence");

   procedure finalize_QKeySequence (Object : Internals.QKeySequence_Access);
   pragma Import (C, finalize_QKeySequence, "__QtAda_finalize_QKeySequence");

   function QKeySequence_count
    (Self : Internals.QKeySequence_Access)
       return Qt4.Q_Unsigned_Integer;
   pragma Import (C, QKeySequence_count, "__QtAda_QKeySequence_count_Q");

   function QKeySequence_isEmpty
    (Self : Internals.QKeySequence_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QKeySequence_isEmpty, "__QtAda_QKeySequence_isEmpty_Q");

   function QKeySequence_matches_QKeySequenceCR
    (Self : Internals.QKeySequence_Access;
     Seq : Internals.QKeySequence_Access)
       return Sequence_Match;
   pragma Import (C, QKeySequence_matches_QKeySequenceCR, "__QtAda_QKeySequence_matches_QKeySequenceCR_Q");

   procedure QKeySequence_toString_SequenceFormat
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QKeySequence_Access;
     Format : Sequence_Format);
   pragma Import (C, QKeySequence_toString_SequenceFormat, "__QtAda_QKeySequence_toString_SequenceFormat_Q");

   function lt_QKeySequenceCR
    (Self : Internals.QKeySequence_Access;
     Other : Internals.QKeySequence_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, lt_QKeySequenceCR, "__QtAda_QKeySequence_lt_QKeySequenceCR_Q");

   function le_QKeySequenceCR
    (Self : Internals.QKeySequence_Access;
     Other : Internals.QKeySequence_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, le_QKeySequenceCR, "__QtAda_QKeySequence_le_QKeySequenceCR_Q");

   function eq_QKeySequenceCR
    (Self : Internals.QKeySequence_Access;
     Other : Internals.QKeySequence_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, eq_QKeySequenceCR, "__QtAda_QKeySequence_eq_QKeySequenceCR_Q");

   function gt_QKeySequenceCR
    (Self : Internals.QKeySequence_Access;
     Other : Internals.QKeySequence_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, gt_QKeySequenceCR, "__QtAda_QKeySequence_gt_QKeySequenceCR_Q");

   function ge_QKeySequenceCR
    (Self : Internals.QKeySequence_Access;
     Other : Internals.QKeySequence_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, ge_QKeySequenceCR, "__QtAda_QKeySequence_ge_QKeySequenceCR_Q");

   procedure QKeySequence_fromString_QStringCR_SequenceFormat
    (Returns : Internals.QKeySequence_Access;
     Str : Qt4.Strings.Internals.QString_Access;
     Format : Sequence_Format);
   pragma Import (C, QKeySequence_fromString_QStringCR_SequenceFormat, "__QtAda_QKeySequence_fromString_QStringCR_SequenceFormat_S");

   procedure QKeySequence_keyBindings_StandardKey
    (Returns : Qt4.String_Lists.Internals.QStringList_Access;
     Key : Standard_Key);
   pragma Import (C, QKeySequence_keyBindings_StandardKey, "__QtAda_QKeySequence_keyBindings_StandardKey_S");

   procedure QKeySequence_mnemonic_QStringCR
    (Returns : Internals.QKeySequence_Access;
     Text : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QKeySequence_mnemonic_QStringCR, "__QtAda_QKeySequence_mnemonic_QStringCR_S");

   ------------
   -- Adjust --
   ------------

   overriding
   procedure Adjust (Self : in out Q_Key_Sequence) is
   begin
      Self.Object := adjust_QKeySequence (Self.Storage'Address, Self.Object);
      Self.Wrapper := False;
   end Adjust;

   --------------
   -- Finalize --
   --------------

   overriding
   procedure Finalize (Self : in out Q_Key_Sequence) is
   begin
      if not Self.Wrapper then
         finalize_QKeySequence (Self.Object);
      end if;
   end Finalize;

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

   overriding
   procedure Initialize (Self : in out Q_Key_Sequence) is
      use type Internals.QKeySequence_Access;

   begin
      if Self.Object = null then
         Self.Object := initialize_QKeySequence (Self.Storage'Address);
      end if;
   end Initialize;

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

   function Create
    (Key : Qt4.Strings.Q_String'Class)
       return Q_Key_Sequence
   is
   begin
      return Self : Q_Key_Sequence
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QKeySequence_QStringCR (Self.Storage'Address, Qt4.Strings.Internals.QString_View (Key));
      end return;
   end Create;

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

   function Create
    (K_1 : Qt4.Q_Integer;
     K_2 : Qt4.Q_Integer
       := 0;
     K_3 : Qt4.Q_Integer
       := 0;
     K_4 : Qt4.Q_Integer
       := 0)
       return Q_Key_Sequence
   is
   begin
      return Self : Q_Key_Sequence
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QKeySequence_int_int_int_int (Self.Storage'Address, K_1, K_2, K_3, K_4);
      end return;
   end Create;

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

   function Create
    (Key : Standard_Key)
       return Q_Key_Sequence
   is
   begin
      return Self : Q_Key_Sequence
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QKeySequence_StandardKey (Self.Storage'Address, Key);
      end return;
   end Create;

   -----------
   -- Count --
   -----------

   function Count
    (Self : Q_Key_Sequence'Class)
       return Qt4.Q_Unsigned_Integer
   is
   begin
      return QKeySequence_count (Self.Object);
   end Count;

   --------------
   -- Is_Empty --
   --------------

   function Is_Empty
    (Self : Q_Key_Sequence'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QKeySequence_isEmpty (Self.Object), 0);
   end Is_Empty;

   -------------
   -- Matches --
   -------------

   function Matches
    (Self : Q_Key_Sequence'Class;
     Seq : Q_Key_Sequence'Class)
       return Sequence_Match
   is
   begin
      return QKeySequence_matches_QKeySequenceCR (Self.Object, Seq.Object);
   end Matches;

   ---------------
   -- To_String --
   ---------------

   function To_String
    (Self : Q_Key_Sequence'Class;
     Format : Sequence_Format
       := Portable_Text)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QKeySequence_toString_SequenceFormat (Qt4.Strings.Internals.QString_View (Returns), Self.Object, Format);
      end return;
   end To_String;

   ---------
   -- "<" --
   ---------

   function "<"
    (Self : Q_Key_Sequence;
     Other : Q_Key_Sequence)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (lt_QKeySequenceCR (Self.Object, Other.Object), 0);
   end "<";

   ----------
   -- "<=" --
   ----------

   function "<="
    (Self : Q_Key_Sequence;
     Other : Q_Key_Sequence)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (le_QKeySequenceCR (Self.Object, Other.Object), 0);
   end "<=";

   ---------
   -- "=" --
   ---------

   overriding function "="
    (Self : Q_Key_Sequence;
     Other : Q_Key_Sequence)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (eq_QKeySequenceCR (Self.Object, Other.Object), 0);
   end "=";

   ---------
   -- ">" --
   ---------

   function ">"
    (Self : Q_Key_Sequence;
     Other : Q_Key_Sequence)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (gt_QKeySequenceCR (Self.Object, Other.Object), 0);
   end ">";

   ----------
   -- ">=" --
   ----------

   function ">="
    (Self : Q_Key_Sequence;
     Other : Q_Key_Sequence)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (ge_QKeySequenceCR (Self.Object, Other.Object), 0);
   end ">=";

   -----------------
   -- From_String --
   -----------------

   function From_String
    (Str : Qt4.Strings.Q_String'Class;
     Format : Sequence_Format
       := Portable_Text)
       return Q_Key_Sequence
   is
   begin
      return Returns : Q_Key_Sequence do
         QKeySequence_fromString_QStringCR_SequenceFormat (Returns.Object, Qt4.Strings.Internals.QString_View (Str), Format);
      end return;
   end From_String;

   ------------------
   -- Key_Bindings --
   ------------------

   function Key_Bindings
    (Key : Standard_Key)
       return Qt4.String_Lists.Q_String_List
   is
   begin
      return Returns : Qt4.String_Lists.Q_String_List do
         QKeySequence_keyBindings_StandardKey (Qt4.String_Lists.Internals.QStringList_View (Returns), Key);
      end return;
   end Key_Bindings;

   --------------
   -- Mnemonic --
   --------------

   function Mnemonic
    (Text : Qt4.Strings.Q_String'Class)
       return Q_Key_Sequence
   is
   begin
      return Returns : Q_Key_Sequence do
         QKeySequence_mnemonic_QStringCR (Returns.Object, Qt4.Strings.Internals.QString_View (Text));
      end return;
   end Mnemonic;

   ---------------
   -- Internals --
   ---------------

   package body Internals is

   ------------------------------
   -- QListOfQKeySequence_View --
   ------------------------------

      function QListOfQKeySequence_View
       (Item : Q_List_Of_Q_Key_Sequence'Class)
          return QListOfQKeySequence_Access
      is
      begin
         return Item.Object;
      end QListOfQKeySequence_View;

      package QListOfQKeySequence_Conversions is
        new System.Address_To_Access_Conversions
             (QListOfQKeySequence);

   -----------------------------------
   -- QListOfQKeySequenceTo_Pointer --
   -----------------------------------

      function To_Pointer
       (Address : System.Address)
          return QListOfQKeySequence_Access
      is
      begin
         return
           QListOfQKeySequence_Access
            (QListOfQKeySequence_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   -----------------------------------
   -- QListOfQKeySequenceTo_Address --
   -----------------------------------

      function To_Address
       (Pointer : QListOfQKeySequence_Access)
          return System.Address
      is
      begin
         return
           QListOfQKeySequence_Conversions.To_Address
            (QListOfQKeySequence_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

   --------------------
   -- Create_Wrapper --
   --------------------

      function Create_Wrapper
       (Item : Internals.QListOfQKeySequence_Access)
          return Q_List_Of_Q_Key_Sequence
      is
      begin
         return Q_List_Of_Q_Key_Sequence'
          (Ada.Finalization.Controlled with
             Object  => Item,
             Wrapper => True,
             others  => <>);
      end Create_Wrapper;

   -----------------------
   -- QKeySequence_View --
   -----------------------

      function QKeySequence_View
       (Item : Q_Key_Sequence'Class)
          return QKeySequence_Access
      is
      begin
         return Item.Object;
      end QKeySequence_View;

      package QKeySequence_Conversions is
        new System.Address_To_Access_Conversions
             (QKeySequence);

   ----------------------------
   -- QKeySequenceTo_Pointer --
   ----------------------------

      function To_Pointer
       (Address : System.Address)
          return QKeySequence_Access
      is
      begin
         return
           QKeySequence_Access
            (QKeySequence_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   ----------------------------
   -- QKeySequenceTo_Address --
   ----------------------------

      function To_Address
       (Pointer : QKeySequence_Access)
          return System.Address
      is
      begin
         return
           QKeySequence_Conversions.To_Address
            (QKeySequence_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

   --------------------
   -- Create_Wrapper --
   --------------------

      function Create_Wrapper
       (Item : Internals.QKeySequence_Access)
          return Q_Key_Sequence
      is
      begin
         return Q_Key_Sequence'
          (Ada.Finalization.Controlled with
             Object  => Item,
             Wrapper => True,
             others  => <>);
      end Create_Wrapper;

   end Internals;

end Qt4.Key_Sequences;
