------------------------------------------------------------------------------
--                                                                          --
--                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.     --
------------------------------------------------------------------------------
private with Ada.Finalization;
with Interfaces.C;
with System;

with Qt4.Pixmaps;
with Qt4.Sizes;
limited with Qt4.Strings;
with Qt4.Variants;
private with Qt_Ada.Internals.Value_Class_Sizes;

package Qt4.Icons is

   --  QIcon::Mode

   type Mode is
    (Normal,
     Disabled,
     Active,
     Selected);
   pragma Convention (C, Mode);
   for Mode'Size use Interfaces.C.unsigned'Size;

   --  QIcon::State

   type State is
    (On,
     Off);
   pragma Convention (C, State);
   for State'Size use Interfaces.C.unsigned'Size;

   type Q_Icon is tagged private;

   function Create
    (Pixmap : Qt4.Pixmaps.Q_Pixmap'Class)
       return Q_Icon;

   function Create
    (File_Name : Qt4.Strings.Q_String'Class)
       return Q_Icon;

   function Actual_Size
    (Self : Q_Icon'Class;
     Size : Qt4.Sizes.Q_Size'Class;
     Mode : Qt4.Icons.Mode
       := Normal;
     State : Qt4.Icons.State
       := Off)
       return Qt4.Sizes.Q_Size;

   procedure Add_File
    (Self : in out Q_Icon'Class;
     File_Name : Qt4.Strings.Q_String'Class;
     Size : Qt4.Sizes.Q_Size'Class;
     Mode : Qt4.Icons.Mode
       := Normal;
     State : Qt4.Icons.State
       := Off);

   procedure Add_Pixmap
    (Self : in out Q_Icon'Class;
     Pixmap : Qt4.Pixmaps.Q_Pixmap'Class;
     Mode : Qt4.Icons.Mode
       := Normal;
     State : Qt4.Icons.State
       := Off);

   function Is_Null
    (Self : Q_Icon'Class)
       return Boolean;

   function Pixmap
    (Self : Q_Icon'Class;
     Size : Qt4.Sizes.Q_Size'Class;
     Mode : Qt4.Icons.Mode
       := Normal;
     State : Qt4.Icons.State
       := Off)
       return Qt4.Pixmaps.Q_Pixmap;

   function Pixmap
    (Self : Q_Icon'Class;
     W : Qt4.Q_Integer;
     H : Qt4.Q_Integer;
     Mode : Qt4.Icons.Mode
       := Normal;
     State : Qt4.Icons.State
       := Off)
       return Qt4.Pixmaps.Q_Pixmap;

   function Pixmap
    (Self : Q_Icon'Class;
     Extent : Qt4.Q_Integer;
     Mode : Qt4.Icons.Mode
       := Normal;
     State : Qt4.Icons.State
       := Off)
       return Qt4.Pixmaps.Q_Pixmap;

   function To_Q_Variant
    (Self : Q_Icon'Class)
       return Qt4.Variants.Q_Variant;

   function To_Q_Icon
    (Self : Qt4.Variants.Q_Variant)
       return Q_Icon;

   package Internals is

      type QIcon is private;

      type QIcon_Access is access all QIcon;
      pragma Convention (C, QIcon_Access);

      function QIcon_View
       (Item : Q_Icon'Class)
          return QIcon_Access;
      pragma Inline (QIcon_View);

      function To_Pointer
       (Address : System.Address)
          return QIcon_Access;
      pragma Inline (To_Pointer);

      function To_Address
       (Pointer : QIcon_Access)
          return System.Address;
      pragma Inline (To_Address);

      function Create_Wrapper
       (Item : Internals.QIcon_Access)
          return Q_Icon;

   private

      type QIcon is record
         Placeholder : Interfaces.C.char_array (1 .. Qt_Ada.Internals.Value_Class_Sizes.QIcon_C_Size_Of);
      end record;
      pragma Convention (C, QIcon);

   end Internals;

private

   type Q_Icon is new Ada.Finalization.Controlled with record
      Storage : aliased Internals.QIcon;
      Object  : Internals.QIcon_Access := null;
      Wrapper : Boolean := False;
   end record;

   overriding
   procedure Adjust (Self : in out Q_Icon);

   overriding
   procedure Finalize (Self : in out Q_Icon);

   overriding
   procedure Initialize (Self : in out Q_Icon);

end Qt4.Icons;
