------------------------------------------------------------------------------
--                                                                          --
--                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: 3800 $ $Date: 2010-11-25 12:06:39 +0300 (Thu, 25 Nov 2010) $
------------------------------------------------------------------------------
with Interfaces.C.Pointers;
with System;

with Qt4_Generic_Flags;
with Qt_Ada.Internals.Generic_Q_Flags;

package Qt4 is

   --  Исключения.

   Connect_Error : exception;
   --  Возбуждается при невозможности установить соединение между указанными
   --  сигналом и методом указанных объектов.

   Invoke_Error : exception;
   --  Возбуждается при невозможности выполнить вызов указанного метода
   --  объекта.

   --  Предопределённые типы данных.

   type Q_Unsigned_Short is new Interfaces.C.unsigned_short;

   type Q_Integer is new Interfaces.C.int;

   type Q_Integer_64 is new Interfaces.Integer_64;

   type Q_Unsigned_Integer is new Interfaces.C.unsigned;

   type Q_Double is new Interfaces.C.double;

   type Q_Real is new Interfaces.C.double;
   --  XXX  Для архитектуры ARM должно быть float.

   type Q_Float is new Interfaces.C.C_float;

   type Q_Unsigned_Long is new Interfaces.C.unsigned_long;

   subtype Q_Year_Number is Q_Integer range -4713 .. 2100;
   subtype Q_Month_Number is Q_Integer range 1 .. 12;
   subtype Q_Day_Number is Q_Integer range 1 .. 31;
   subtype Q_Years_Day_Number is Q_Integer range 1 .. 366;
   subtype Q_Hour_Number is Q_Integer range 0 .. 23;
   subtype Q_Minute_Number is Q_Integer range 0 .. 59;
   subtype Q_Second_Number is Q_Integer range 0 .. 59;

   subtype Q_Day_Duration is Duration range 0.0 .. 86_400.0;
   subtype Q_Second_Duration is Duration range 0.0 .. 0.999;

   type Signal_Name (<>) is private;

   type Slot_Name (<>) is private;

   type W_Id is new Interfaces.C.unsigned_long;
   --  This type is used only on X11 platform for now.

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Signal
   --!    <Purpose> Производит преобразование строки в имя сигнала. Эквивалент
   --! макроса SIGNAL.
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   function Signal (Name : String) return Signal_Name;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Slot
   --!    <Purpose> Производит преобразование строки в имя слота. Эквивалент
   --! макроса SLOT.
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   function Slot (Name : String) return Slot_Name;

   --  Enumeration types and flag types.

   --  Enumeration AspectRatio Mode

   type Aspect_Ratio_Mode is
    (Ignore_Aspect_Ratio,
     KeepAspectRatio,
     KeepAspectRatioByExpanding);
   pragma Convention (C, Aspect_Ratio_Mode);

   type Cursor_Shape is
    (Arrow_Cursor,
     Up_Arrow_Cursor,
     Cross_Cursor,
     Wait_Cursor,
     I_Beam_Cursor,
     Size_Ver_Cursor,
     Size_Hor_Cursor,
     Size_B_Diag_Cursor,
     Size_F_Diag_Cursor,
     Size_All_Cursor,
     Blank_Cursor,
     Split_V_Cursor,
     Split_H_Cursor,
     Pointing_Hand_Cursor,
     Forbidden_Cursor,
     Whats_This_Cursor,
     Busy_Cursor,
     Open_Hand_Cursor,
     Closed_Hand_Cursor,
     Bitmap_Cursor,
     Custom_Cursor);
   pragma Convention (C, Cursor_Shape);
   for Cursor_Shape'Size use Interfaces.C.unsigned'Size;
   for Cursor_Shape use
    (Arrow_Cursor         => 0,
     Up_Arrow_Cursor      => 1,
     Cross_Cursor         => 2,
     Wait_Cursor          => 3,
     I_Beam_Cursor        => 4,
     Size_Ver_Cursor      => 5,
     Size_Hor_Cursor      => 6,
     Size_B_Diag_Cursor   => 7,
     Size_F_Diag_Cursor   => 8,
     Size_All_Cursor      => 9,
     Blank_Cursor         => 10,
     Split_V_Cursor       => 11,
     Split_H_Cursor       => 12,
     Pointing_Hand_Cursor => 13,
     Forbidden_Cursor     => 14,
     Whats_This_Cursor    => 15,
     Busy_Cursor          => 16,
     Open_Hand_Cursor     => 17,
     Closed_Hand_Cursor   => 18,
     Bitmap_Cursor        => 24,
     Custom_Cursor        => 25);

   --  Window Type

   type Window_Type is
    (Widget,
     Window,
     Dialog,
     Sheet,
     Drawer,
     Popup,
     Tool,
     Tool_Tip,
     Splash_Screen,
     Desktop,
     Sub_Window,
     Window_Type_Mask,
     MS_Windows_Fixed_Size_Dialog_Hint,
     MS_Windows_Own_DC,
     X11_Bypass_Window_Manager_Hint,
     Frameless_Window_Hint,
     Window_Title_Hint,
     Window_System_Menu_Hint,
     Window_Minimize_Button_Hint,
     Window_Maximize_Button_Hint,
     Window_Min_Max_Buttons_Hint,
     Window_Context_Help_Button_Hint,
     Window_Shade_Button_Hint,
     Window_Stays_On_Top_Hint,
     Customize_Window_Hint);
   pragma Convention (C, Window_Type);
   for Window_Type'Size use Interfaces.C.unsigned'Size;
   for Window_Type use
    (Widget                            => 16#00000000#,
     Window                            => 16#00000001#,
     Dialog                            => 16#00000003#, --  0x00000002 | Window
     Sheet                             => 16#00000005#, --  0x00000004 | Window
     Drawer                            => 16#00000007#, --  0x00000006 | Window
     Popup                             => 16#00000009#, --  0x00000008 | Window
     Tool                              => 16#0000000B#, --  0x0000000a | Window
     Tool_Tip                          => 16#0000000D#, --  0x0000000c | Window
     Splash_Screen                     => 16#0000000E#,
     Desktop                           => 16#00000011#, --  0x00000010 | Window
     Sub_Window                        => 16#00000012#,
     Window_Type_Mask                  => 16#000000FF#,
     MS_Windows_Fixed_Size_Dialog_Hint => 16#00000100#,
     MS_Windows_Own_DC                 => 16#00000200#,
     X11_Bypass_Window_Manager_Hint    => 16#00000400#,
     Frameless_Window_Hint             => 16#00000800#,
     Window_Title_Hint                 => 16#00001000#,
     Window_System_Menu_Hint           => 16#00002000#,
     Window_Minimize_Button_Hint       => 16#00004000#,
     Window_Maximize_Button_Hint       => 16#00008000#,
     Window_Min_Max_Buttons_Hint       => 16#0000C000#,
     --  WindowMinimizeButtonHint | WindowMaximizeButtonHint

     Window_Context_Help_Button_Hint   => 16#00010000#,
     Window_Shade_Button_Hint          => 16#00020000#,
     Window_Stays_On_Top_Hint          => 16#00040000#,
     Customize_Window_Hint             => 16#02000000#);

   package Window_Type_Flags is new Qt4_Generic_Flags (Window_Type);

   type Window_Flags is new Window_Type_Flags.Flags;

   --  Window State

   type Window_State is
    (Window_No_State,
     Window_Minimized,
     Window_Maximized,
     Window_Full_Screen,
     Window_Active);
   pragma Convention (C, Window_State);
   for Window_State'Size use Interfaces.C.unsigned'Size;
   for Window_State use
    (Window_No_State    => 16#00000000#,
     Window_Minimized   => 16#00000001#,
     Window_Maximized   => 16#00000002#,
     Window_Full_Screen => 16#00000004#,
     Window_Active      => 16#00000008#);

   package Window_State_Flags is new Qt4_Generic_Flags (Window_State);

   type Window_States is new Window_State_Flags.Flags;

   --  Alignment Flag

   type Alignment_Flag is
    (Align_Default,
     Align_Left,
     Align_Right,
     Align_H_Center,
     Align_Justify,
     Align_Absolute,
     Align_Horizontal_Mask,
     Align_Top,
     Align_Bottom,
     Align_V_Center,
     Align_Center,
     Align_Vertical_Mask);
   pragma Convention (C, Alignment_Flag);
   for Alignment_Flag'Size use Interfaces.C.unsigned'Size;
   for Alignment_Flag use
    (Align_Default         => 16#00000000#,
     Align_Left            => 16#00000001#,
     Align_Right           => 16#00000002#,
     Align_H_Center        => 16#00000004#,
     Align_Justify         => 16#00000008#,
     Align_Absolute        => 16#00000010#,
     Align_Horizontal_Mask => 16#0000001F#,
     --  AlignLeft | AlignRight | AlignHCenter | AlignJustify | Align_Absolute

     Align_Top             => 16#00000020#,
     Align_Bottom          => 16#00000040#,
     Align_V_Center        => 16#00000080#,
     Align_Center          => 16#00000084#,
     --  AlignVCenter | AlignHCenter

     Align_Vertical_Mask   => 16#000000E0#);
     --  AlignTop | AlignBottom | AlignVCenter

   Align_Leading  : constant Alignment_Flag := Align_Left;
   Align_Trailing : constant Alignment_Flag := Align_Right;

   package Alignment_Flag_Flags is new Qt4_Generic_Flags (Alignment_Flag);

   type Alignment is new Alignment_Flag_Flags.Flags;

   --  Qt::ArrowType

   type Arrow_Type is
    (No_Arrow,
     Up_Arrow,
     Down_Arrow,
     Left_Arrow,
     Right_Arrow);
   pragma Convention (C, Arrow_Type);
   for Arrow_Type'Size use Interfaces.C.unsigned'Size;

   --  Keyboard Modifiers

   type Keyboard_Modifier is
     (No_Modifier,
      Shift_Modifier,
      Control_Modifier,
      Alt_Modifier,
      Meta_Modifier,
      Keypad_Modifier,
      Group_Switch_Modifier,
      Keyboard_Modifier_Mask);
   pragma Convention (C, Keyboard_Modifier);
   for Keyboard_Modifier'Size use Interfaces.C.unsigned'Size;
   for Keyboard_Modifier use
     (No_Modifier            => 16#00000000#,
      Shift_Modifier         => 16#02000000#,
      Control_Modifier       => 16#04000000#,
      Alt_Modifier           => 16#08000000#,
      Meta_Modifier          => 16#10000000#,
      Keypad_Modifier        => 16#20000000#,
      Group_Switch_Modifier  => 16#40000000#,
      Keyboard_Modifier_Mask => 16#FE000000#);

    package Keyboard_Modifier_Flags is
      new Qt4_Generic_Flags (Keyboard_Modifier);

    type Keyboard_Modifiers is new Keyboard_Modifier_Flags.Flags;

    --  enum Qt::Key

    type Key is
     (Key_Space,                --  7 bit printable ASCII
--       Key_Any = Key_Space,
      Key_Exclam,
      Key_QuoteDbl,
      Key_NumberSign,
      Key_Dollar,
      Key_Percent,
      Key_Ampersand,
      Key_Apostrophe,
      Key_ParenLeft,
      Key_ParenRight,
      Key_Asterisk,
      Key_Plus,
      Key_Comma,
      Key_Minus,
      Key_Period,
      Key_Slash,
      Key_0,
      Key_1,
      Key_2,
      Key_3,
      Key_4,
      Key_5,
      Key_6,
      Key_7,
      Key_8,
      Key_9,
      Key_Colon,
      Key_Semicolon,
      Key_Less,
      Key_Equal,
      Key_Greater,
      Key_Question,
      Key_At,
      Key_A,
      Key_B,
      Key_C,
      Key_D,
      Key_E,
      Key_F,
      Key_G,
      Key_H,
      Key_I,
      Key_J,
      Key_K,
      Key_L,
      Key_M,
      Key_N,
      Key_O,
      Key_P,
      Key_Q,
      Key_R,
      Key_S,
      Key_T,
      Key_U,
      Key_V,
      Key_W,
      Key_X,
      Key_Y,
      Key_Z,
      Key_BracketLeft,
      Key_Backslash,
      Key_BracketRight,
      Key_AsciiCircum,
      Key_Underscore,
      Key_QuoteLeft,
      Key_BraceLeft,
      Key_Bar,
      Key_BraceRight,
      Key_AsciiTilde,

      Key_nobreakspace,
      Key_exclamdown,
      Key_cent,
      Key_sterling,
      Key_currency,
      Key_yen,
      Key_brokenbar,
      Key_section,
      Key_diaeresis,
      Key_copyright,
      Key_ordfeminine,
      Key_guillemotleft,        --  left angle quotation mark
      Key_notsign,
      Key_hyphen,
      Key_registered,
      Key_macron,
      Key_degree,
      Key_plusminus,
      Key_twosuperior,
      Key_threesuperior,
      Key_acute,
      Key_mu,
      Key_paragraph,
      Key_periodcentered,
      Key_cedilla,
      Key_onesuperior,
      Key_masculine,
      Key_guillemotright,        --  right angle quotation mark
      Key_onequarter,
      Key_onehalf,
      Key_threequarters,
      Key_questiondown,
      Key_Agrave,
      Key_Aacute,
      Key_Acircumflex,
      Key_Atilde,
      Key_Adiaeresis,
      Key_Aring,
      Key_AE,
      Key_Ccedilla,
      Key_Egrave,
      Key_Eacute,
      Key_Ecircumflex,
      Key_Ediaeresis,
      Key_Igrave,
      Key_Iacute,
      Key_Icircumflex,
      Key_Idiaeresis,
      Key_ETH,
      Key_Ntilde,
      Key_Ograve,
      Key_Oacute,
      Key_Ocircumflex,
      Key_Otilde,
      Key_Odiaeresis,
      Key_multiply,
      Key_Ooblique,
      Key_Ugrave,
      Key_Uacute,
      Key_Ucircumflex,
      Key_Udiaeresis,
      Key_Yacute,
      Key_THORN,
      Key_ssharp,
      Key_division,
      Key_ydiaeresis,
      Key_Escape,
      Key_Tab,
      Key_Backtab,
      Key_Backspace,
      Key_Return,
      Key_Enter,
      Key_Insert,
      Key_Delete,
      Key_Pause,
      Key_Print,
      Key_SysReq,
      Key_Clear,
      Key_Home,                --  cursor movement
      Key_End,
      Key_Left,
      Key_Up,
      Key_Right,
      Key_Down,
      Key_PageUp,
      Key_PageDown,
      Key_Shift,                --  modifiers
      Key_Control,
      Key_Meta,
      Key_Alt,
      Key_CapsLock,
      Key_NumLock,
      Key_ScrollLock,
      Key_F1,                --  function keys
      Key_F2,
      Key_F3,
      Key_F4,
      Key_F5,
      Key_F6,
      Key_F7,
      Key_F8,
      Key_F9,
      Key_F10,
      Key_F11,
      Key_F12,
      Key_F13,
      Key_F14,
      Key_F15,
      Key_F16,
      Key_F17,
      Key_F18,
      Key_F19,
      Key_F20,
      Key_F21,
      Key_F22,
      Key_F23,
      Key_F24,
      Key_F25,                --  F25 .. F35 only on X11
      Key_F26,
      Key_F27,
      Key_F28,
      Key_F29,
      Key_F30,
      Key_F31,
      Key_F32,
      Key_F33,
      Key_F34,
      Key_F35,
      Key_Super_L,                 --  extra keys
      Key_Super_R,
      Key_Menu,
      Key_Hyper_L,
      Key_Hyper_R,
      Key_Help,
      Key_Direction_L,
      Key_Direction_R,
      Key_Back,
      Key_Forward,
      Key_Stop,
      Key_Refresh,

      Key_VolumeDown,
      Key_VolumeMute,
      Key_VolumeUp,
      Key_BassBoost,
      Key_BassUp,
      Key_BassDown,
      Key_TrebleUp,
      Key_TrebleDown,

      Key_MediaPlay,
      Key_MediaStop,
      Key_MediaPrevious,
      Key_MediaNext,
      Key_MediaRecord,

      Key_HomePage,
      Key_Favorites,
      Key_Search,
      Key_Standby,
      Key_OpenUrl,
      Key_LaunchMail,
      Key_LaunchMedia,
      Key_Launch0,
      Key_Launch1,
      Key_Launch2,
      Key_Launch3,
      Key_Launch4,
      Key_Launch5,
      Key_Launch6,
      Key_Launch7,
      Key_Launch8,
      Key_Launch9,
      Key_LaunchA,
      Key_LaunchB,
      Key_LaunchC,
      Key_LaunchD,
      Key_LaunchE,
      Key_LaunchF,

      --  International input method support (X keycode - 0xEE00, the
      --  definition follows Qt/Embedded 2.3.7) Only interesting if
      --  you are writing your own input method

      --  International & multi-key character composition
      Key_AltGr,
      Key_Multi_key,  --  Multi-key character compose
      --  Japanese keyboard support
      Key_Muhenkan,  --  Cancel Conversion
      --  Key_Henkan_Mode,  --  Start/Stop Conversion
      Key_Henkan,  --  Alias for Henkan_Mode
      Key_Romaji,  --  to Romaji
      Key_Hiragana,  --  to Hiragana
      Key_Katakana,  --  to Katakana
      Key_Hiragana_Katakana,  --  Hiragana/Katakana toggle
      Key_Zenkaku,  --  to Zenkaku
      Key_Hankaku,  --  to Hankaku
      Key_Zenkaku_Hankaku,  --  Zenkaku/Hankaku toggle
      Key_Touroku,  --  Add to Dictionary
      Key_Massyo,  --  Delete from Dictionary
      Key_Kana_Lock,  --  Kana Lock
      Key_Kana_Shift,  --  Kana Shift
      Key_Eisu_Shift,  --  Alphanumeric Shift
      Key_Eisu_toggle,  --  Alphanumeric toggle
      --  Key_Kanji_Bangou,  --  Codeinput
      --  Key_Zen_Koho,  --  Multiple/All Candidate(s)
      --  Key_Mae_Koho,  --  Previous Candidate

      --  Korean keyboard support
      --
      --  In fact, many Korean users need only 2 keys, Key_Hangul and
      --  Key_Hangul_Hanja. But rest of the keys are good for future.

      Key_Hangul,  --  Hangul start/stop(toggle)
      Key_Hangul_Start,  --  Hangul start
      Key_Hangul_End,  --  English start
      Key_Hangul_Hanja,  --  Start Hangul->Hanja Conversion
      Key_Hangul_Jamo,  --  Hangul Jamo mode
      Key_Hangul_Romaja,  --  Hangul Romaja mode
      Key_Codeinput,
      --  Key_Hangul_Codeinput,  --  Hangul code input mode
      Key_Hangul_Jeonja,  --  Jeonja mode
      Key_Hangul_Banja,  --  Banja mode
      Key_Hangul_PreHanja,  --  Pre Hanja conversion
      Key_Hangul_PostHanja,  --  Post Hanja conversion
      Key_SingleCandidate,
      Key_MultipleCandidate,
      Key_PreviousCandidate,
      --  Key_Hangul_SingleCandidate,  --  Single candidate
      --  Key_Hangul_MultipleCandidate,  --  Multiple candidate
      --  Key_Hangul_PreviousCandidate,  --  Previous candidate
      Key_Hangul_Special,  --  Special symbols
      --  Key_Hangul_switch,  --  Alias for mode_switch

      --  Misc Functions
      --       Key_Kanji,  -- Kanji convert
      Key_Mode_switch,  --  Character set switch
      --  Key_script_switch,  --  Alias for mode_switch

      --  dead keys (X keycode - 0xED00 to avoid the conflict)
      Key_Dead_Grave,
      Key_Dead_Acute,
      Key_Dead_Circumflex,
      Key_Dead_Tilde,
      Key_Dead_Macron,
      Key_Dead_Breve,
      Key_Dead_Abovedot,
      Key_Dead_Diaeresis,
      Key_Dead_Abovering,
      Key_Dead_Doubleacute,
      Key_Dead_Caron,
      Key_Dead_Cedilla,
      Key_Dead_Ogonek,
      Key_Dead_Iota,
      Key_Dead_Voiced_Sound,
      Key_Dead_Semivoiced_Sound,
      Key_Dead_Belowdot,
      Key_Dead_Hook,
      Key_Dead_Horn,

      --  multimedia/internet keys - ignored by default - see QKeyEvent c'tor

      Key_MediaLast,

      --  Keypad navigation keys
      Key_Select,
      Key_Yes,
      Key_No,

      --  Newer misc keys
      Key_Cancel,
      Key_Printer,
      Key_Execute,
      Key_Sleep,
      Key_Play, --  Not the same as Key_MediaPlay
      Key_Zoom,
      --  Key_Jisho, --  IME: Dictionary key
      --  Key_Oyayubi_Left, --  IME: Left Oyayubi key
      --  Key_Oyayubi_Right, --  IME: Right Oyayubi key

      --  Device keys
      Key_Context1,
      Key_Context2,
      Key_Context3,
      Key_Context4,
      Key_Call,
      Key_Hangup,
      Key_Flip,
      Key_unknown);

    pragma Convention (C, Key);
    for Key'Size use Interfaces.C.unsigned'Size;
    for Key use
     (Key_Space                 => 16#00000020#,    --  7 bit printable ASCII
      --      Key_Any = Key_Space,
      Key_Exclam                => 16#00000021#,
      Key_QuoteDbl              => 16#00000022#,
      Key_NumberSign            => 16#00000023#,
      Key_Dollar                => 16#00000024#,
      Key_Percent               => 16#00000025#,
      Key_Ampersand             => 16#00000026#,
      Key_Apostrophe            => 16#00000027#,
      Key_ParenLeft             => 16#00000028#,
      Key_ParenRight            => 16#00000029#,
      Key_Asterisk              => 16#0000002a#,
      Key_Plus                  => 16#0000002b#,
      Key_Comma                 => 16#0000002c#,
      Key_Minus                 => 16#0000002d#,
      Key_Period                => 16#0000002e#,
      Key_Slash                 => 16#0000002f#,
      Key_0                     => 16#00000030#,
      Key_1                     => 16#00000031#,
      Key_2                     => 16#00000032#,
      Key_3                     => 16#00000033#,
      Key_4                     => 16#00000034#,
      Key_5                     => 16#00000035#,
      Key_6                     => 16#00000036#,
      Key_7                     => 16#00000037#,
      Key_8                     => 16#00000038#,
      Key_9                     => 16#00000039#,
      Key_Colon                 => 16#0000003a#,
      Key_Semicolon             => 16#0000003b#,
      Key_Less                  => 16#0000003c#,
      Key_Equal                 => 16#0000003d#,
      Key_Greater               => 16#0000003e#,
      Key_Question              => 16#0000003f#,
      Key_At                    => 16#00000040#,
      Key_A                     => 16#00000041#,
      Key_B                     => 16#00000042#,
      Key_C                     => 16#00000043#,
      Key_D                     => 16#00000044#,
      Key_E                     => 16#00000045#,
      Key_F                     => 16#00000046#,
      Key_G                     => 16#00000047#,
      Key_H                     => 16#00000048#,
      Key_I                     => 16#00000049#,
      Key_J                     => 16#0000004a#,
      Key_K                     => 16#0000004b#,
      Key_L                     => 16#0000004c#,
      Key_M                     => 16#0000004d#,
      Key_N                     => 16#0000004e#,
      Key_O                     => 16#0000004f#,
      Key_P                     => 16#00000050#,
      Key_Q                     => 16#00000051#,
      Key_R                     => 16#00000052#,
      Key_S                     => 16#00000053#,
      Key_T                     => 16#00000054#,
      Key_U                     => 16#00000055#,
      Key_V                     => 16#00000056#,
      Key_W                     => 16#00000057#,
      Key_X                     => 16#00000058#,
      Key_Y                     => 16#00000059#,
      Key_Z                     => 16#0000005a#,
      Key_BracketLeft           => 16#0000005b#,
      Key_Backslash             => 16#0000005c#,
      Key_BracketRight          => 16#0000005d#,
      Key_AsciiCircum           => 16#0000005e#,
      Key_Underscore            => 16#0000005f#,
      Key_QuoteLeft             => 16#00000060#,
      Key_BraceLeft             => 16#0000007b#,
      Key_Bar                   => 16#0000007c#,
      Key_BraceRight            => 16#0000007d#,
      Key_AsciiTilde            => 16#0000007e#,

      Key_nobreakspace          => 16#000000a0#,
      Key_exclamdown            => 16#000000a1#,
      Key_cent                  => 16#000000a2#,
      Key_sterling              => 16#000000a3#,
      Key_currency              => 16#000000a4#,
      Key_yen                   => 16#000000a5#,
      Key_brokenbar             => 16#000000a6#,
      Key_section               => 16#000000a7#,
      Key_diaeresis             => 16#000000a8#,
      Key_copyright             => 16#000000a9#,
      Key_ordfeminine           => 16#000000aa#,
      Key_guillemotleft         => 16#000000ab#,
      --  left angle quotation mark

      Key_notsign               => 16#000000ac#,
      Key_hyphen                => 16#000000ad#,
      Key_registered            => 16#000000ae#,
      Key_macron                => 16#000000af#,
      Key_degree                => 16#000000b0#,
      Key_plusminus             => 16#000000b1#,
      Key_twosuperior           => 16#000000b2#,
      Key_threesuperior         => 16#000000b3#,
      Key_acute                 => 16#000000b4#,
      Key_mu                    => 16#000000b5#,
      Key_paragraph             => 16#000000b6#,
      Key_periodcentered        => 16#000000b7#,
      Key_cedilla               => 16#000000b8#,
      Key_onesuperior           => 16#000000b9#,
      Key_masculine             => 16#000000ba#,
      Key_guillemotright        => 16#000000bb#,
      --  right angle quotation mark

      Key_onequarter            => 16#000000bc#,
      Key_onehalf               => 16#000000bd#,
      Key_threequarters         => 16#000000be#,
      Key_questiondown          => 16#000000bf#,
      Key_Agrave                => 16#000000c0#,
      Key_Aacute                => 16#000000c1#,
      Key_Acircumflex           => 16#000000c2#,
      Key_Atilde                => 16#000000c3#,
      Key_Adiaeresis            => 16#000000c4#,
      Key_Aring                 => 16#000000c5#,
      Key_AE                    => 16#000000c6#,
      Key_Ccedilla              => 16#000000c7#,
      Key_Egrave                => 16#000000c8#,
      Key_Eacute                => 16#000000c9#,
      Key_Ecircumflex           => 16#000000ca#,
      Key_Ediaeresis            => 16#000000cb#,
      Key_Igrave                => 16#000000cc#,
      Key_Iacute                => 16#000000cd#,
      Key_Icircumflex           => 16#000000ce#,
      Key_Idiaeresis            => 16#000000cf#,
      Key_ETH                   => 16#000000d0#,
      Key_Ntilde                => 16#000000d1#,
      Key_Ograve                => 16#000000d2#,
      Key_Oacute                => 16#000000d3#,
      Key_Ocircumflex           => 16#000000d4#,
      Key_Otilde                => 16#000000d5#,
      Key_Odiaeresis            => 16#000000d6#,
      Key_multiply              => 16#000000d7#,
      Key_Ooblique              => 16#000000d8#,
      Key_Ugrave                => 16#000000d9#,
      Key_Uacute                => 16#000000da#,
      Key_Ucircumflex           => 16#000000db#,
      Key_Udiaeresis            => 16#000000dc#,
      Key_Yacute                => 16#000000dd#,
      Key_THORN                 => 16#000000de#,
      Key_ssharp                => 16#000000df#,
      Key_division              => 16#000000f7#,
      Key_ydiaeresis            => 16#000000ff#,
      Key_Escape                => 16#01000000#,              --  misc keys
      Key_Tab                   => 16#01000001#,
      Key_Backtab               => 16#01000002#,
      Key_Backspace             => 16#01000003#,
      Key_Return                => 16#01000004#,
      Key_Enter                 => 16#01000005#,
      Key_Insert                => 16#01000006#,
      Key_Delete                => 16#01000007#,
      Key_Pause                 => 16#01000008#,
      Key_Print                 => 16#01000009#,
      Key_SysReq                => 16#0100000a#,
      Key_Clear                 => 16#0100000b#,
      Key_Home                  => 16#01000010#,         --  cursor movement
      Key_End                   => 16#01000011#,
      Key_Left                  => 16#01000012#,
      Key_Up                    => 16#01000013#,
      Key_Right                 => 16#01000014#,
      Key_Down                  => 16#01000015#,
      Key_PageUp                => 16#01000016#,
      Key_PageDown              => 16#01000017#,
      Key_Shift                 => 16#01000020#,                --  modifiers
      Key_Control               => 16#01000021#,
      Key_Meta                  => 16#01000022#,
      Key_Alt                   => 16#01000023#,
      Key_CapsLock              => 16#01000024#,
      Key_NumLock               => 16#01000025#,
      Key_ScrollLock            => 16#01000026#,
      Key_F1                    => 16#01000030#,             --  function keys
      Key_F2                    => 16#01000031#,
      Key_F3                    => 16#01000032#,
      Key_F4                    => 16#01000033#,
      Key_F5                    => 16#01000034#,
      Key_F6                    => 16#01000035#,
      Key_F7                    => 16#01000036#,
      Key_F8                    => 16#01000037#,
      Key_F9                    => 16#01000038#,
      Key_F10                   => 16#01000039#,
      Key_F11                   => 16#0100003a#,
      Key_F12                   => 16#0100003b#,
      Key_F13                   => 16#0100003c#,
      Key_F14                   => 16#0100003d#,
      Key_F15                   => 16#0100003e#,
      Key_F16                   => 16#0100003f#,
      Key_F17                   => 16#01000040#,
      Key_F18                   => 16#01000041#,
      Key_F19                   => 16#01000042#,
      Key_F20                   => 16#01000043#,
      Key_F21                   => 16#01000044#,
      Key_F22                   => 16#01000045#,
      Key_F23                   => 16#01000046#,
      Key_F24                   => 16#01000047#,
      Key_F25                   => 16#01000048#,   --  F25 .. F35 only on X11
      Key_F26                   => 16#01000049#,
      Key_F27                   => 16#0100004a#,
      Key_F28                   => 16#0100004b#,
      Key_F29                   => 16#0100004c#,
      Key_F30                   => 16#0100004d#,
      Key_F31                   => 16#0100004e#,
      Key_F32                   => 16#0100004f#,
      Key_F33                   => 16#01000050#,
      Key_F34                   => 16#01000051#,
      Key_F35                   => 16#01000052#,
      Key_Super_L               => 16#01000053#,                --  extra keys
      Key_Super_R               => 16#01000054#,
      Key_Menu                  => 16#01000055#,
      Key_Hyper_L               => 16#01000056#,
      Key_Hyper_R               => 16#01000057#,
      Key_Help                  => 16#01000058#,
      Key_Direction_L           => 16#01000059#,
      Key_Direction_R           => 16#01000060#,
      Key_Back                  => 16#01000061#,
      Key_Forward               => 16#01000062#,
      Key_Stop                  => 16#01000063#,
      Key_Refresh               => 16#01000064#,
      Key_VolumeDown            => 16#01000070#,
      Key_VolumeMute            => 16#01000071#,
      Key_VolumeUp              => 16#01000072#,
      Key_BassBoost             => 16#01000073#,
      Key_BassUp                => 16#01000074#,
      Key_BassDown              => 16#01000075#,
      Key_TrebleUp              => 16#01000076#,
      Key_TrebleDown            => 16#01000077#,
      Key_MediaPlay             => 16#01000080#,
      Key_MediaStop             => 16#01000081#,
      Key_MediaPrevious         => 16#01000082#,
      Key_MediaNext             => 16#01000083#,
      Key_MediaRecord           => 16#01000084#,
      Key_HomePage              => 16#01000090#,
      Key_Favorites             => 16#01000091#,
      Key_Search                => 16#01000092#,
      Key_Standby               => 16#01000093#,
      Key_OpenUrl               => 16#01000094#,
      Key_LaunchMail            => 16#010000a0#,
      Key_LaunchMedia           => 16#010000a1#,
      Key_Launch0               => 16#010000a2#,
      Key_Launch1               => 16#010000a3#,
      Key_Launch2               => 16#010000a4#,
      Key_Launch3               => 16#010000a5#,
      Key_Launch4               => 16#010000a6#,
      Key_Launch5               => 16#010000a7#,
      Key_Launch6               => 16#010000a8#,
      Key_Launch7               => 16#010000a9#,
      Key_Launch8               => 16#010000aa#,
      Key_Launch9               => 16#010000ab#,
      Key_LaunchA               => 16#010000ac#,
      Key_LaunchB               => 16#010000ad#,
      Key_LaunchC               => 16#010000ae#,
      Key_LaunchD               => 16#010000af#,
      Key_LaunchE               => 16#010000b0#,
      Key_LaunchF               => 16#010000b1#,

      --  International input method support (X keycode - 16#EE00, the
      --  definition follows Qt/Embedded 2.3.7) Only interesting if
      --  you are writing your own input method

      --  International & multi-key character composition
      Key_AltGr                 => 16#01001103#,
      Key_Multi_key             => 16#01001120#,
      --  Multi-key character compose
      --       Key_Kanji            => 16#01001121#,  --  Kanji, Kanji convert

      --  Japanese keyboard support
      Key_Muhenkan              => 16#01001122#,  --  Cancel Conversion
      --  Key_Henkan_Mode         = 0x01001123,  --  Start/Stop Conversion
      Key_Henkan                => 16#01001123#,  --  Alias for Henkan_Mode
      Key_Romaji                => 16#01001124#,  --  to Romaji
      Key_Hiragana              => 16#01001125#,  --  to Hiragana
      Key_Katakana              => 16#01001126#,  --  to Katakana
      Key_Hiragana_Katakana     => 16#01001127#,  --  Hiragana/Katakana toggle
      Key_Zenkaku               => 16#01001128#,  --  to Zenkaku
      Key_Hankaku               => 16#01001129#,  --  to Hankaku
      Key_Zenkaku_Hankaku       => 16#0100112a#,  --  Zenkaku/Hankaku toggle
      Key_Touroku               => 16#0100112b#,  --  Add to Dictionary
      Key_Massyo                => 16#0100112c#,  --  Delete from Dictionary
      Key_Kana_Lock             => 16#0100112d#,  --  Kana Lock
      Key_Kana_Shift            => 16#0100112e#,  --  Kana Shift
      Key_Eisu_Shift            => 16#0100112f#,  --  Alphanumeric Shift
      Key_Eisu_toggle           => 16#01001130#,  --  Alphanumeric toggle
      --  Key_Kanji_Bangou        => 16#01001137,  --  Codeinput
      --  Key_Zen_Koho            = 0x0100113d,  --  Multiple/All Candidate(s)
      --  Key_Mae_Koho            = 0x0100113e,  --  Previous Candidate

      --  Korean keyboard support
      --
      --  In fact, many Korean users need only 2 keys, Key_Hangul and
      --  Key_Hangul_Hanja. But rest of the keys are good for future.

      Key_Hangul                => 16#01001131#,  --  Hangul start/stop(toggle)
      Key_Hangul_Start          => 16#01001132#,  --  Hangul start
      Key_Hangul_End            => 16#01001133#,  --  Hangul end, English start
      Key_Hangul_Hanja          => 16#01001134#,
      --  Start Hangul->Hanja Conversion

      Key_Hangul_Jamo           => 16#01001135#,  --  Hangul Jamo mode
      Key_Hangul_Romaja         => 16#01001136#,  --  Hangul Romaja mode
      --  Key_Hangul_Codeinput    = 0x01001137,  --  Hangul code input mode
      Key_Codeinput             => 16#01001137#,
      Key_Hangul_Jeonja         => 16#01001138#,  --  Jeonja mode
      Key_Hangul_Banja          => 16#01001139#,  --  Banja mode
      Key_Hangul_PreHanja       => 16#0100113a#,  --  Pre Hanja conversion
      Key_Hangul_PostHanja      => 16#0100113b#,  --  Post Hanja conversion
      Key_SingleCandidate       => 16#0100113c#,
      Key_MultipleCandidate     => 16#0100113d#,
      Key_PreviousCandidate     => 16#0100113e#,
      --  Key_Hangul_SingleCandidate   = 0x0100113c,  --  Single candidate
      --  Key_Hangul_MultipleCandidate = 0x0100113d,  --  Multiple candidate
      --  Key_Hangul_PreviousCandidate = 0x0100113e,  --  Previous candidate
      Key_Hangul_Special        => 16#0100113f#,  --  Special symbols
      --  Key_Hangul_switch       = 0x0100117e,  --  Alias for mode_switch

      --  Misc Functions
      Key_Mode_switch           => 16#0100117e#,  --  Character set switch
      --  Key_script_switch       = 0x0100117e,  --  Alias for mode_switch

      --  dead keys (X keycode - 0xED00 to avoid the conflict)
      Key_Dead_Grave            => 16#01001250#,
      Key_Dead_Acute            => 16#01001251#,
      Key_Dead_Circumflex       => 16#01001252#,
      Key_Dead_Tilde            => 16#01001253#,
      Key_Dead_Macron           => 16#01001254#,
      Key_Dead_Breve            => 16#01001255#,
      Key_Dead_Abovedot         => 16#01001256#,
      Key_Dead_Diaeresis        => 16#01001257#,
      Key_Dead_Abovering        => 16#01001258#,
      Key_Dead_Doubleacute      => 16#01001259#,
      Key_Dead_Caron            => 16#0100125a#,
      Key_Dead_Cedilla          => 16#0100125b#,
      Key_Dead_Ogonek           => 16#0100125c#,
      Key_Dead_Iota             => 16#0100125d#,
      Key_Dead_Voiced_Sound     => 16#0100125e#,
      Key_Dead_Semivoiced_Sound => 16#0100125f#,
      Key_Dead_Belowdot         => 16#01001260#,
      Key_Dead_Hook             => 16#01001261#,
      Key_Dead_Horn             => 16#01001262#,

      --  multimedia/internet keys - ignored by default - see QKeyEvent c'tor
      Key_MediaLast             => 16#0100ffff#,

      --  Keypad navigation keys
      Key_Select                => 16#01010000#,
      Key_Yes                   => 16#01010001#,
      Key_No                    => 16#01010002#,

      --  Newer misc keys
      Key_Cancel                => 16#01020001#,
      Key_Printer               => 16#01020002#,
      Key_Execute               => 16#01020003#,
      Key_Sleep                 => 16#01020004#,
      Key_Play                  => 16#01020005#,
      --  Not the same as Key_MediaPlay

      Key_Zoom                  => 16#01020006#,
      --  Key_Jisho   = 0x01020007, --  IME: Dictionary key
      --  Key_Oyayubi_Left = 0x01020008, --  IME: Left Oyayubi key
      --  Key_Oyayubi_Right = 0x01020009, --  IME: Right Oyayubi key

      --  Device keys
      Key_Context1              => 16#01100000#,
      Key_Context2              => 16#01100001#,
      Key_Context3              => 16#01100002#,
      Key_Context4              => 16#01100003#,
      Key_Call                  => 16#01100004#,
      Key_Hangup                => 16#01100005#,
      Key_Flip                  => 16#01100006#,
      Key_unknown               => 16#01ffffff#);

    --  Enumeration Modifier

    type Modifier is
      (UNICODE_ACCEL,
       SHIFT,
       CTRL,
       ALT,
       META,
       MODIFIER_MASK);
    pragma Convention (C, Modifier);
    for Modifier'Size use Interfaces.C.unsigned'Size;
    for Modifier use
      (UNICODE_ACCEL => 16#00000000#,
       SHIFT         => 16#02000000#,     --  Shift_Modifier
       CTRL          => 16#04000000#,     --  Control_Modifier
       ALT           => 16#08000000#,     --  Alt_Modifier
       META          => 16#10000000#,     --  Meta_Modifier
       MODIFIER_MASK => 16#FE000000#);    --  Keyboard_Modifier_Mask

    --  Mouse Buttons

    type Mouse_Button is
      (No_Button,
       Left_Button,
       Right_Button,
       Mid_Button,
       X_Button_1,
       X_Button_2,
       Mouse_Button_Mask);
    pragma Convention (C, Mouse_Button);
    for Mouse_Button'Size use Interfaces.C.unsigned'Size;
    for Mouse_Button use
      (No_Button         => 16#00000000#,
       Left_Button       => 16#00000001#,
       Right_Button      => 16#00000002#,
       Mid_Button        => 16#00000004#,
       X_Button_1        => 16#00000008#,
       X_Button_2        => 16#00000010#,
       Mouse_Button_Mask => 16#000000FF#);

    package Mouse_Button_Flags is new Qt4_Generic_Flags (Mouse_Button);

    type Mouse_Buttons is new Mouse_Button_Flags.Flags;

   --  Orientations

    type Orientation is (Horizontal, Vertical);
    pragma Convention (C, Orientation);
    for Orientation'Size use Interfaces.C.unsigned'Size;
    for Orientation use
      (Horizontal => 16#00000001#,
       Vertical   => 16#00000002#);

    package Orientation_Flags is new Qt4_Generic_Flags (Orientation);

    type Orientations is new Orientation_Flags.Flags;

    type Step_Enabled_Flags is
     (Step_None,
      Step_Up_Enabled,
      Step_Down_Enabled);
    pragma Convention (C, Step_Enabled_Flags);
    for Step_Enabled_Flags'Size use Interfaces.C.unsigned'Size;
    for Step_Enabled_Flags use
     (Step_None         => 16#00000000#,
      Step_Up_Enabled   => 16#00000001#,
      Step_Down_Enabled => 16#00000002#);

    package Step_Enabled_Package is new Qt4_Generic_Flags (Step_Enabled_Flags);

    type Step_Enabled is new Step_Enabled_Package.Flags;

   --  Dock Widget Areas

   type Dock_Widget_Area is
     (No_Dock_Widget_Area,
      Left_Dock_Widget_Area,
      Right_Dock_Widget_Area,
      Top_Dock_Widget_Area,
      Bottom_Dock_Widget_Area,
      Dock_Widget_Area_Mask);
   pragma Convention (C, Dock_Widget_Area);
   for Dock_Widget_Area'Size use Interfaces.C.unsigned'Size;
   for Dock_Widget_Area use
     (No_Dock_Widget_Area     => 16#00000000#,
      Left_Dock_Widget_Area   => 16#00000001#,
      Right_Dock_Widget_Area  => 16#00000002#,
      Top_Dock_Widget_Area    => 16#00000004#,
      Bottom_Dock_Widget_Area => 16#00000008#,
      Dock_Widget_Area_Mask   => 16#0000000F#);

   All_Dock_Widget_Areas : constant Dock_Widget_Area := Dock_Widget_Area_Mask;

   package Dock_Widget_Area_Flags is new Qt4_Generic_Flags (Dock_Widget_Area);

   type Dock_Widget_Areas is new Dock_Widget_Area_Flags.Flags;

   --  Enumeration Dock Widget Area Sizes

   type Dock_Widget_Area_Sizes is (N_Dock_Widget_Areas);
   pragma Convention (C, Dock_Widget_Area_Sizes);
   for Dock_Widget_Area_Sizes'Size use Interfaces.C.unsigned'Size;
   for Dock_Widget_Area_Sizes use (N_Dock_Widget_Areas => 4);

   type Tool_Bar_Area is
     (No_Tool_Bar_Area,
      Left_Tool_Bar_Area,
      Right_Tool_Bar_Area,
      Top_Tool_Bar_Area,
      Bottom_Tool_Bar_Area,
      Tool_Bar_Area_Mask);
   pragma Convention (C, Tool_Bar_Area);
   for Tool_Bar_Area'Size use Interfaces.C.unsigned'Size;
   for Tool_Bar_Area use
     (No_Tool_Bar_Area     => 16#00000000#,
      Left_Tool_Bar_Area   => 16#00000001#,
      Right_Tool_Bar_Area  => 16#00000002#,
      Top_Tool_Bar_Area    => 16#00000004#,
      Bottom_Tool_Bar_Area => 16#00000008#,
      Tool_Bar_Area_Mask   => 16#0000000F#);

   All_Tool_Bar_Areas : constant Tool_Bar_Area := Tool_Bar_Area_Mask;

   package Tool_Bar_Area_Flags is new Qt4_Generic_Flags (Tool_Bar_Area);

   type Tool_Bar_Areas is new Tool_Bar_Area_Flags.Flags;

   --  Enumeration Tool Bar Area Sizes

   type Tool_Bar_Area_Sizes is (N_Tool_Bar_Areas);
   pragma Convention (C, Tool_Bar_Area_Sizes);
   for Tool_Bar_Area_Sizes'Size use Interfaces.C.unsigned'Size;
   for Tool_Bar_Area_Sizes use (N_Tool_Bar_Areas => 4);

   --  Drop Actions

   type Drop_Action is
     (Ignore_Action,
      Copy_Action,
      Move_Action,
      Link_Action,
      Action_Mask,
      Target_Move_Action);
   pragma Convention (C, Drop_Action);
   for Drop_Action'Size use Interfaces.C.unsigned'Size;
   for Drop_Action use
     (Ignore_Action      => 16#00000000#,
      Copy_Action        => 16#00000001#,
      Move_Action        => 16#00000002#,
      Link_Action        => 16#00000004#,
      Action_Mask        => 16#000000FF#,
      Target_Move_Action => 16#00008002#);

   package Drop_Action_Flags is new Qt4_Generic_Flags (Drop_Action);

   type Drop_Actions is new Drop_Action_Flags.Flags;

   --  Item Flags

   type Item_Flag is
     (Item_Is_Selectable,
      Item_Is_Editable,
      Item_Is_Drag_Enabled,
      Item_Is_Drop_Enabled,
      Item_Is_User_Checkable,
      Item_Is_Enabled,
      Item_Is_Tristate);
   pragma Convention (C, Item_Flag);
   for Item_Flag'Size use Interfaces.C.unsigned'Size;
   for Item_Flag use
     (Item_Is_Selectable     => 16#00000001#,
      Item_Is_Editable       => 16#00000002#,
      Item_Is_Drag_Enabled   => 16#00000004#,
      Item_Is_Drop_Enabled   => 16#00000008#,
      Item_Is_User_Checkable => 16#00000010#,
      Item_Is_Enabled        => 16#00000020#,
      Item_Is_Tristate       => 16#00000040#);

   package Item_Flag_Flags is new Qt4_Generic_Flags (Item_Flag);

   type Item_Flags is new Item_Flag_Flags.Flags;

   --  Match Flags

   type Match_Flag is
    (Match_Exactly,
     Match_Contains,
     Match_Starts_With,
     Match_Ends_With,
     Match_Reg_Exp,
     Match_Wildcard,
     Match_Fixed_String,
     Match_Case_Sensitive,
     Match_Wrap,
     Match_Recursive);
   pragma Convention (C, Match_Flag);
     for Match_Flag'Size use Interfaces.C.unsigned'Size;
     for Match_Flag use
      (Match_Exactly        => 16#00000000#,
       Match_Contains       => 16#00000001#,
       Match_Starts_With    => 16#00000002#,
       Match_Ends_With      => 16#00000003#,
       Match_Reg_Exp        => 16#00000004#,
       Match_Wildcard       => 16#00000005#,
       Match_Fixed_String   => 16#00000008#,
       Match_Case_Sensitive => 16#00000010#,
       Match_Wrap           => 16#00000020#,
       Match_Recursive      => 16#00000040#);

   package Match_Flag_Flags is new Qt4_Generic_Flags (Match_Flag);

   type Match_Flags is new Match_Flag_Flags.Flags;

   --  Enumeration Window Modality

   type Window_Modality is (Non_Modal, Window_Modal, Application_Modal);
   pragma Convention (C, Window_Modality);
   for Window_Modality'Size use Interfaces.C.unsigned'Size;

   --  Text Interaction Flags

   type Text_Interaction_Flag is
    (No_Text_Interaction,
     Text_Selectable_By_Mouse,
     Text_Selectable_By_Keyboard,
     Links_Accessible_By_Mouse,
     Links_Accessible_By_Keyboard,
     Text_Browser_Interaction,
     Text_Editable,
     Text_Editor_Interaction);
   pragma Convention (C, Text_Interaction_Flag);
   for Text_Interaction_Flag'Size use Interfaces.C.unsigned'Size;
   for Text_Interaction_Flag use
    (No_Text_Interaction          => 16#00000000#,
     Text_Selectable_By_Mouse     => 16#00000001#,
     Text_Selectable_By_Keyboard  => 16#00000002#,
     Links_Accessible_By_Mouse    => 16#00000004#,
     Links_Accessible_By_Keyboard => 16#00000008#,
     Text_Browser_Interaction     => 16#0000000D#,
     --  TextSelectableByMouse | LinksAccessibleByMouse |
     --  LinksAccessibleByKeyboard

     Text_Editable                => 16#00000010#,
     Text_Editor_Interaction      => 16#00000013#);
     --  TextSelectableByMouse | TextSelectableByKeyboard | TextEditable

   package Text_Interaction_Flag_Flags is
     new Qt4_Generic_Flags (Text_Interaction_Flag);

   type Text_Interaction_Flags is new Text_Interaction_Flag_Flags.Flags;

   --  Enumeration Connection Type

   type Connection_Type is
    (Auto_Connection,
     Direct_Connection,
     Queued_Connection,
     Auto_Compat_Connection);
   pragma Convention (C, Connection_Type);

   --  Enumeration Input Method Query

   type Input_Method_Query is
    (Im_Micro_Focus,
     Im_Font,
     Im_Cursor_Position,
     Im_Surrounding_Text,
     Im_Current_Selection);
   pragma Convention (C, Input_Method_Query);

   --  Enumeration Focus Reason

   type Focus_Reason is
    (Mouse_Focus_Reason,
     Tab_Focus_Reason,
     Backtab_Focus_Reason,
     Active_Window_Focus_Reason,
     Popup_Focus_Reason,
     Shortcut_Focus_Reason,
     Menu_Bar_Focus_Reason,
     Other_Focus_Reason);
   pragma Convention (C, Focus_Reason);

   --  Enumeration Pen Style

   type Pen_Style is
    (No_Pen,
     Solid_Line,
     Dash_Line,
     Dot_Line,
     Dash_Dot_Line,
     Dash_Dot_Dot_Line,
     Custom_Dash_Line);
   pragma Convention (C, Pen_Style);

   --  enum Qt::PenCapStyle

   type Pen_Cap_Style is
    (Flat_Cap,
     Square_Cap,
     Round_Cap);
   pragma Convention (C, Pen_Cap_Style);
   for Pen_Cap_Style'Size use Interfaces.C.unsigned'Size;
   for Pen_Cap_Style use
    (Flat_Cap   => 16#00#,
     Square_Cap => 16#10#,
     Round_Cap  => 16#20#);

   --  enum Qt::PenJoinStyle

   type Pen_Join_Style is
    (Miter_Join,
     Bevel_Join,
     Round_Join,
     Svg_Miter_Join);
   pragma Convention (C, Pen_Join_Style);
   for Pen_Join_Style'Size use Interfaces.C.unsigned'Size;
   for Pen_Join_Style use
    (Miter_Join     => 16#0000#,
     Bevel_Join     => 16#0040#,
     Round_Join     => 16#0080#,
     Svg_Miter_Join => 16#0100#);

   --  enum Qt::SortOrder

   type Sort_Order is
    (Ascending_Order,
     Descending_Order);
   pragma Convention (C, Sort_Order);

   --  Enumeration Brush Style

   type Brush_Style is
    (No_Brush,
     Solid_Pattern,
     Dense_1_Pattern,
     Dense_2_Pattern,
     Dense_3_Pattern,
     Dense_4_Pattern,
     Dense_5_Pattern,
     Dense_6_Pattern,
     Dense_7_Pattern,
     Hor_Pattern,
     Ver_Pattern,
     Cross_Pattern,
     B_Diag_Pattern,
     F_Diag_Pattern,
     Diag_Cross_Pattern,
     Linear_Gradient_Pattern,
     Radial_Gradient_Pattern,
     Conical_Gradient_Pattern,
     Texture_Pattern);
   pragma Convention (C, Brush_Style);
   for Brush_Style'Size use Interfaces.C.unsigned'Size;
   for Brush_Style use
    (No_Brush                 => 0,
     Solid_Pattern            => 1,
     Dense_1_Pattern          => 2,
     Dense_2_Pattern          => 3,
     Dense_3_Pattern          => 4,
     Dense_4_Pattern          => 5,
     Dense_5_Pattern          => 6,
     Dense_6_Pattern          => 7,
     Dense_7_Pattern          => 8,
     Hor_Pattern              => 9,
     Ver_Pattern              => 10,
     Cross_Pattern            => 11,
     B_Diag_Pattern           => 12,
     F_Diag_Pattern           => 13,
     Diag_Cross_Pattern       => 14,
     Linear_Gradient_Pattern  => 15,
     Radial_Gradient_Pattern  => 16,
     Conical_Gradient_Pattern => 17,
     Texture_Pattern          => 24);

   --  Enumeration Global Color

   type Global_Color is
    (Color_0,
     Color_1,
     Black,
     White,
     Dark_Gray,
     Gray,
     Light_Gray,
     Red,
     Green,
     Blue,
     Cyan,
     Magenta,
     Yellow,
     Dark_Red,
     Dark_Green,
     Dark_Blue,
     Dark_Cyan,
     Dark_Magenta,
     Dark_Yellow,
     Transparent);
   pragma Convention (C, Global_Color);

   --  Enumeration ItemDataRole

   type Item_Data_Role is new Interfaces.C.int;
   Display_Role                : constant Item_Data_Role := 0;
   Decoration_Role             : constant Item_Data_Role := 1;
   Edit_Role                   : constant Item_Data_Role := 2;
   Tool_Tip_Role               : constant Item_Data_Role := 3;
   Status_Tip_Role             : constant Item_Data_Role := 4;
   Whats_This_Role             : constant Item_Data_Role := 5;
   Font_Role                   : constant Item_Data_Role := 6;
   Text_Alignment_Role         : constant Item_Data_Role := 7;
   Background_Color_Role       : constant Item_Data_Role := 8;
   Background_Role             : constant Item_Data_Role := 8;
   Text_Color_Role             : constant Item_Data_Role := 9;
   Foreground_Role             : constant Item_Data_Role := 9;
   Check_State_Role            : constant Item_Data_Role := 10;
   Accessible_Text_Role        : constant Item_Data_Role := 11;
   Accessible_Description_Role : constant Item_Data_Role := 12;
   Size_Hint_Role              : constant Item_Data_Role := 13;
   User_Role                   : constant Item_Data_Role := 32;

   --  Qt::CaseSensitivity

   type Case_Sensitivity is
    (Case_Insensitive,
     Case_Sensitive);
   pragma Convention (C, Case_Sensitivity);
   for Case_Sensitivity'Size use Interfaces.C.unsigned'Size;

   --  Qt::ContextMenuPolicy

   type Context_Menu_Policy is
    (No_Context_Menu,
     Default_Context_Menu,
     Actions_Context_Menu,
     Custom_Context_Menu,
     Prevent_Context_Menu);
   pragma Convention (C, Context_Menu_Policy);
   for Context_Menu_Policy'Size use Interfaces.C.unsigned'Size;

   --  enum Qt::FillRule

   type Fill_Rule is (Odd_Even_Fill, Winding_Fill);
   pragma Convention (C, Fill_Rule);

   --  enum Qt::ItemSelectionMode

   type Item_Selection_Mode is
    (Contains_Item_Shape,
     Intersects_Item_Shape,
     Contains_Item_Bounding_Rect,
     Intersects_Item_Bounding_Rect);
   pragma Convention (C, Item_Selection_Mode);
   for Item_Selection_Mode'Size use Interfaces.C.unsigned'Size;
   for Item_Selection_Mode use
    (Contains_Item_Shape           => 0,
     Intersects_Item_Shape         => 1,
     Contains_Item_Bounding_Rect   => 2,
     Intersects_Item_Bounding_Rect => 3);

   --  Qt::Axis

   type Axis is
    (X_Axis,
     Y_Axis,
     Z_Axis);
   pragma Convention (C, Axis);
   for Axis'Size use Interfaces.C.unsigned'Size;

   --  Qt::ToolButtonStyle

   type Tool_Button_Style is
    (Tool_Button_Icon_Only,
     Tool_Button_Text_Only,
     Tool_Button_Text_Beside_Icon,
     Tool_Button_Text_Under_Icon);
   pragma Convention (C, Tool_Button_Style);
   for Tool_Button_Style'Size use Interfaces.C.unsigned'Size;

   --  Qt::FocusPolicy

   type Focus_Policy is
    (No_Focus,
     Tab_Focus,
     Click_Focus,
     Strong_Focus,
     Wheel_Focus);
   pragma Convention (C, Focus_Policy);
   for Focus_Policy'Size use Interfaces.C.unsigned'Size;
   for Focus_Policy use
    (No_Focus     => 0,
     Tab_Focus    => 1,
     Click_Focus  => 2,
     Strong_Focus => 11,
     Wheel_Focus  => 15);

   type Widget_Attribute is
    (WA_Disabled,
     WA_Under_Mouse,
     WA_Mouse_Tracking,
     WA_Contents_Propagated,
     WA_Opaque_Paint_Event,
     WA_Static_Contents,
--     WA_Laid_Out,
     WA_Paint_On_Screen,
     WA_No_System_Background,
     WA_Updates_Disabled,
     WA_Mapped,
     WA_Mac_No_Click_Through,
     WA_Paint_Outside_Paint_Event,
     WA_Input_Method_Enabled,
--     WA_W_State_Visible,
--     WA_W_State_Hidden,
     WA_Force_Disabled,
     WA_Key_Compression,
     WA_Pending_Move_Event,
     WA_Pending_Resize_Event,
     WA_Set_Palette,
     WA_Set_Font,
     WA_Set_Cursor,
     WA_No_Child_Events_From_Children,
     WA_Window_Modified,
     WA_Resized,
     WA_Moved,
--     WA_Pending_Update,
--     WA_Invalid_Size,
     WA_Mac_Brushed_Metal,
     WA_Custom_Whats_This,
     WA_Layout_On_Entire_Rect,
     WA_Outside_WS_Range,
--     WA_Grabbed_Shortcut,
--     WA_Transparent_For_Mouse_Events,
     WA_Paint_Unclipped,
--     WA_Set_Window_Icon,
     WA_No_Mouse_Replay,
     WA_Delete_On_Close,
     WA_Right_To_Left,
--     WA_Set_Layout_Direction,
     WA_No_Child_Events_For_Parent,
     WA_Force_Updates_Disabled,
--     WA_W_State_Created,
--     WA_W_State_Compress_Keys,
--     WA_W_State_In_Paint_Event,
--     WA_W_State_Reparented,
--     WA_W_State_Config_Pending,
--     WA_W_State_Polished,
--     WA_W_State_DND,
--     WA_W_State_Own_Size_Policy,
--     WA_W_State_Explicit_Show_Hide,
     WA_Show_Modal,
     WA_Mouse_No_Mask,
     WA_Group_Leader,
     WA_No_Mouse_Propagation,
     WA_Hover,
--     WA_Input_Method_Transparent,
     WA_Quit_On_Close,
     WA_Keyboard_Focus_Change,
     WA_Accept_Drops,
--     WA_Drop_Site_Registered,
     WA_Window_Propagation,
--     WA_No_X11_Event_Compression,
--     WA_Tinted_Background,
--     WA_X11_Open_GL_Overlay,
     WA_Always_Show_Tool_Tips,
     WA_Mac_Opaque_Size_Grip,
     WA_Set_Style,
     WA_Set_Locale,
     WA_Mac_Show_Focus_Rect,
     WA_Mac_Normal_Size,
     WA_Mac_Small_Size,
     WA_Mac_Mini_Size,
     WA_Layout_Uses_Widget_Rect,
     WA_Styled_Background,
     WA_MS_Windows_Use_Direct_3D,
--     WA_Can_Host_Q_Mdi_Sub_Window_Title_Bar,
     WA_Mac_Always_Show_Tool_Window);
--     WA_StyleSheet);
   pragma Convention (C, Widget_Attribute);
   for Widget_Attribute'Size use Interfaces.C.unsigned'Size;
   for Widget_Attribute use
    (WA_Disabled                            => 0,
     WA_Under_Mouse                         => 1,
     WA_Mouse_Tracking                      => 2,
     WA_Contents_Propagated                 => 3,
     WA_Opaque_Paint_Event                  => 4,
     WA_Static_Contents                     => 5,
--     WA_Laid_Out                            => 7,
     WA_Paint_On_Screen                     => 8,
     WA_No_System_Background                => 9,
     WA_Updates_Disabled                    => 10,
     WA_Mapped                              => 11,
     WA_Mac_No_Click_Through                => 12,
     WA_Paint_Outside_Paint_Event           => 13,
     WA_Input_Method_Enabled                => 14,
--     WA_W_State_Visible                     => 15,
--     WA_W_State_Hidden                      => 16,
     WA_Force_Disabled                      => 32,
     WA_Key_Compression                     => 33,
     WA_Pending_Move_Event                  => 34,
     WA_Pending_Resize_Event                => 35,
     WA_Set_Palette                         => 36,
     WA_Set_Font                            => 37,
     WA_Set_Cursor                          => 38,
     WA_No_Child_Events_From_Children       => 39,
     WA_Window_Modified                     => 41,
     WA_Resized                             => 42,
     WA_Moved                               => 43,
--     WA_Pending_Update                      => 44,
--     WA_Invalid_Size                        => 45,
     WA_Mac_Brushed_Metal                   => 46,
     WA_Custom_Whats_This                   => 47,
     WA_Layout_On_Entire_Rect               => 48,
     WA_Outside_WS_Range                    => 49,
--     WA_Grabbed_Shortcut                    => 50,
--     WA_Transparent_For_Mouse_Events        => 51,
     WA_Paint_Unclipped                     => 52,
--     WA_Set_Window_Icon                     => 53,
     WA_No_Mouse_Replay                     => 54,
     WA_Delete_On_Close                     => 55,
     WA_Right_To_Left                       => 56,
--     WA_Set_Layout_Direction                => 57,
     WA_No_Child_Events_For_Parent          => 58,
     WA_Force_Updates_Disabled              => 59,
--     WA_W_State_Created                     => 60,
--     WA_W_State_Compress_Keys               => 61,
--     WA_W_State_In_Paint_Event              => 62,
--     WA_W_State_Reparented                  => 63,
--     WA_W_State_Config_Pending              => 64,
--     WA_W_State_Polished                    => 66,
--     WA_W_State_DND                         => 67,
--     WA_W_State_Own_Size_Policy             => 68,
--     WA_W_State_Explicit_Show_Hide          => 69,
     WA_Show_Modal                          => 70,
     WA_Mouse_No_Mask                       => 71,
     WA_Group_Leader                        => 72,
     WA_No_Mouse_Propagation                => 73,
     WA_Hover                               => 74,
--     WA_Input_Method_Transparent            => 75,
     WA_Quit_On_Close                       => 76,
     WA_Keyboard_Focus_Change               => 77,
     WA_Accept_Drops                        => 78,
--     WA_Drop_Site_Registered                => 79,
     WA_Window_Propagation                  => 80,
--     WA_No_X11_Event_Compression            => 81,
--     WA_Tinted_Background                   => 82,
--     WA_X11_Open_GL_Overlay                 => 83,
     WA_Always_Show_Tool_Tips               => 84,
     WA_Mac_Opaque_Size_Grip                => 85,
     WA_Set_Style                           => 86,
     WA_Set_Locale                          => 87,
     WA_Mac_Show_Focus_Rect                 => 88,
     WA_Mac_Normal_Size                     => 89,
     WA_Mac_Small_Size                      => 90,
     WA_Mac_Mini_Size                       => 91,
     WA_Layout_Uses_Widget_Rect             => 92,
     WA_Styled_Background                   => 93,
     WA_MS_Windows_Use_Direct_3D            => 94,
--     WA_Can_Host_Q_Mdi_Sub_Window_Title_Bar => 95,
     WA_Mac_Always_Show_Tool_Window         => 96);
--     WA_StyleSheet                          => 97);

     WA_NoBackground : constant Widget_Attribute := WA_Opaque_Paint_Event;
--     WA_Mac_Metal_Style = WA_Mac_Brushed_Metal,
--     WA_Force_Accept_Drops = WA_Drop_Site_Registered,

   --  Qt::DateFormat

   type Date_Format is
    (Text_Date,
     ISO_Date,
     System_Locale_Date,
     Locale_Date);
   pragma Convention (C, Date_Format);
   for Date_Format'Size use Interfaces.C.unsigned'Size;

   Local_Date : constant Date_Format := System_Locale_Date;

   --  Qt::DayOfWeek

   type Day_Of_Week is
    (Monday,
     Tuesday,
     Wednesday,
     Thursday,
     Friday,
     Saturday,
     Sunday);
   pragma Convention (C, Day_Of_Week);
   for Day_Of_Week'Size use Interfaces.C.unsigned'Size;
   for Day_Of_Week use
    (Monday    => 1,
     Tuesday   => 2,
     Wednesday => 3,
     Thursday  => 4,
     Friday    => 5,
     Saturday  => 6,
     Sunday    => 7);

   --  Qt::TimeSpec

   type Time_Spec is
    (Local_Time,
     UTC);
   pragma Convention (C, Time_Spec);
   for Time_Spec'Size use Interfaces.C.unsigned'Size;

   --  Qt::MaskMode

   type Mask_Mode is
    (Mask_In_Color,
     Mask_Out_Color);
   pragma Convention (C, Mask_Mode);
   for Mask_Mode'Size use Interfaces.C.unsigned'Size;

   --  Qt::TransformationMode

   type Transformation_Mode is
    (Fast_Transformation,
     Smooth_Transformation);
   pragma Convention (C, Transformation_Mode);
   for Transformation_Mode'Size use Interfaces.C.unsigned'Size;

   --  Qt::BGMode

   type BG_Mode is
    (Transparent_Mode,
     Opaque_Mode);
   pragma Convention (C, BG_Mode);
   for BG_Mode'Size use Interfaces.C.unsigned'Size;

   --  Qt::LayoutDirection

   type Layout_Direction is
    (Left_To_Right,
     Right_To_Left);
   pragma Convention (C, Layout_Direction);
   for Layout_Direction'Size use Interfaces.C.unsigned'Size;

   --  Qt::ClipOperation

   type Clip_Operation is
    (No_Clip,
     Replace_Clip,
     Intersect_Clip,
     Unite_Clip);
   pragma Convention (C, Clip_Operation);
   for Clip_Operation'Size use Interfaces.C.unsigned'Size;

   --  Qt::TextFormat

   type Text_Format is
    (Plain_Text,
     Rich_Text,
     Auto_Text,
     Log_Text);
   pragma Convention (C, Text_Format);
   for Text_Format'Size use Interfaces.C.unsigned'Size;

   --  Qt::CheckState

   type Check_State is
    (Unchecked,
     Partially_Checked,
     Checked);
   pragma Convention (C, Check_State);
   for Check_State'Size use Interfaces.C.unsigned'Size;

   --  Qt::ShortcutContext

   type Shortcut_Context is
    (Widget_Shortcut,
     Window_Shortcut,
     Application_Shortcut);
   pragma Convention (C, Shortcut_Context);
   for Shortcut_Context'Size use Interfaces.C.unsigned'Size;

   --  Qt::SizeMode

   type Size_Mode is
    (Absolute_Size,
     Relative_Size);
   pragma Convention (C, Size_Mode);
   for Size_Mode'Size use Interfaces.C.unsigned'Size;

   --  Qt:HitTestAccuracy

   type Hit_Test_Accuracy is
    (Exact_Hit,
     Fuzzy_Hit);
   pragma Convention (C, Hit_Test_Accuracy);
   for Hit_Test_Accuracy'Size use Interfaces.C.unsigned'Size;

   --  Qt::ImageConversionFlag

   type Image_Conversion_Flag is
    (Mono_Only,
     Color_Only,
     Ordered_Alpha_Dither,
     Diffuse_Alpha_Dither,
     Ordered_Dither,
     Threshold_Dither,
     Prefer_Dither,
     Avoid_Dither);
   pragma Convention (C, Image_Conversion_Flag);
   for Image_Conversion_Flag'Size use Interfaces.C.unsigned'Size;
   for Image_Conversion_Flag use
    (Mono_Only            => 2,
     Color_Only           => 3,
     Ordered_Alpha_Dither => 4,
     Diffuse_Alpha_Dither => 8,
     Ordered_Dither       => 16,
     Threshold_Dither     => 32,
     Prefer_Dither        => 64,
     Avoid_Dither         => 128);

   --  Qt::ImageConversionFlags

   package Q_Flags_Of_Image_Conversion_Flag is
     new Qt_Ada.Internals.Generic_Q_Flags (Image_Conversion_Flag);

   type Image_Conversion_Flags is new Q_Flags_Of_Image_Conversion_Flag.Flags;

   Auto_Color : constant Image_Conversion_Flags
     := Image_Conversion_Flags (Q_Flags_Of_Image_Conversion_Flag.Empty);

   --  XXX Только для внутреннего использования! Возможно имеет смысл вынести
   --  в отдельный пакет, например Qt4.Internals.

   type bool is new Boolean;
   pragma Convention (C, bool);
   for bool'Size use 1;
   --  Объявление типа, эквивалентного типу bool в C++. Справедливо только для
   --  GCC 3.4.6.

   function To_Boolean (Item : bool) return Boolean;
   pragma Inline (To_Boolean);

   function To_bool (Item : Boolean) return bool;
   pragma Inline (To_bool);

   --  Для передачи аргументов в qt_metacall невозможно типизировать значения,
   --  поэтому используется тип System.Address.

   type Address_Array is array (Natural range <>) of aliased System.Address;
   pragma Convention (C, Address_Array);

   package Address_Pointers is
     new Interfaces.C.Pointers
          (Natural, System.Address, Address_Array, System.Null_Address);

   type Address_Pointer is new Address_Pointers.Pointer;

private

   type Signal_Name is new String;

   type Slot_Name is new String;

   function Q_Integer_Image (Item : Q_Integer) return String;
   --  Returns image of the value without leading space.

   function Q_Real_Image (Item : Q_Real) return String;
   --  Returns image of the value without leading space.

end Qt4;
