------------------------------------------------------------------------------
--                                                                          --
--                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.                                      --
--                                                                          --
------------------------------------------------------------------------------
--    This file has been generated automatically. Please don't edit it.     --
------------------------------------------------------------------------------
with System.Address_To_Access_Conversions;

package body Qt4.Font_Infos is

   function initialize_QFontInfo_QFontCR
    (Storage : System.Address;
     Font : Qt4.Fonts.Internals.QFont_Access)
      return Internals.QFontInfo_Access;
   pragma Import (C, initialize_QFontInfo_QFontCR, "__QtAda_inititialize_QFontInfo_QFontCR");

   function adjust_QFontInfo
    (Storage : System.Address;
     From    : Internals.QFontInfo_Access)
       return Internals.QFontInfo_Access;
   pragma Import (C, adjust_QFontInfo, "__QtAda_adjust_QFontInfo");

   procedure finalize_QFontInfo (Object : Internals.QFontInfo_Access);
   pragma Import (C, finalize_QFontInfo, "__QtAda_finalize_QFontInfo");

   function QFontInfo_bold
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_bold, "__QtAda_QFontInfo_bold_Q");

   function QFontInfo_exactMatch
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_exactMatch, "__QtAda_QFontInfo_exactMatch_Q");

   procedure QFontInfo_family
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFontInfo_Access);
   pragma Import (C, QFontInfo_family, "__QtAda_QFontInfo_family_Q");

   function QFontInfo_fixedPitch
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_fixedPitch, "__QtAda_QFontInfo_fixedPitch_Q");

   function QFontInfo_italic
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_italic, "__QtAda_QFontInfo_italic_Q");

   function QFontInfo_pixelSize
    (Self : Internals.QFontInfo_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QFontInfo_pixelSize, "__QtAda_QFontInfo_pixelSize_Q");

   function QFontInfo_pointSize
    (Self : Internals.QFontInfo_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QFontInfo_pointSize, "__QtAda_QFontInfo_pointSize_Q");

   function QFontInfo_pointSizeF
    (Self : Internals.QFontInfo_Access)
       return Qt4.Q_Real;
   pragma Import (C, QFontInfo_pointSizeF, "__QtAda_QFontInfo_pointSizeF_Q");

   function QFontInfo_rawMode
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_rawMode, "__QtAda_QFontInfo_rawMode_Q");

   function QFontInfo_style
    (Self : Internals.QFontInfo_Access)
       return Qt4.Fonts.Font_Style;
   pragma Import (C, QFontInfo_style, "__QtAda_QFontInfo_style_Q");

   function QFontInfo_styleHint
    (Self : Internals.QFontInfo_Access)
       return Qt4.Fonts.Font_Style_Hint;
   pragma Import (C, QFontInfo_styleHint, "__QtAda_QFontInfo_styleHint_Q");

   function QFontInfo_weight
    (Self : Internals.QFontInfo_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QFontInfo_weight, "__QtAda_QFontInfo_weight_Q");

   function QFontInfo_overline
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_overline, "__QtAda_QFontInfo_overline_Q");

   function QFontInfo_strikeOut
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_strikeOut, "__QtAda_QFontInfo_strikeOut_Q");

   function QFontInfo_underline
    (Self : Internals.QFontInfo_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFontInfo_underline, "__QtAda_QFontInfo_underline_Q");

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

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

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

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

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

   function Create
    (Font : Qt4.Fonts.Q_Font'Class)
       return Q_Font_Info
   is
   begin
      return Self : Q_Font_Info
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QFontInfo_QFontCR (Self.Storage'Address, Qt4.Fonts.Internals.QFont_View (Font));
      end return;
   end Create;

   ----------
   -- Bold --
   ----------

   function Bold
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_bold (Self.Object), 0);
   end Bold;

   -----------------
   -- Exact_Match --
   -----------------

   function Exact_Match
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_exactMatch (Self.Object), 0);
   end Exact_Match;

   ------------
   -- Family --
   ------------

   function Family
    (Self : Q_Font_Info'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFontInfo_family (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Family;

   -----------------
   -- Fixed_Pitch --
   -----------------

   function Fixed_Pitch
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_fixedPitch (Self.Object), 0);
   end Fixed_Pitch;

   ------------
   -- Italic --
   ------------

   function Italic
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_italic (Self.Object), 0);
   end Italic;

   ----------------
   -- Pixel_Size --
   ----------------

   function Pixel_Size
    (Self : Q_Font_Info'Class)
       return Qt4.Q_Integer
   is
   begin
      return QFontInfo_pixelSize (Self.Object);
   end Pixel_Size;

   ----------------
   -- Point_Size --
   ----------------

   function Point_Size
    (Self : Q_Font_Info'Class)
       return Qt4.Q_Integer
   is
   begin
      return QFontInfo_pointSize (Self.Object);
   end Point_Size;

   ------------------
   -- Point_Size_F --
   ------------------

   function Point_Size_F
    (Self : Q_Font_Info'Class)
       return Qt4.Q_Real
   is
   begin
      return QFontInfo_pointSizeF (Self.Object);
   end Point_Size_F;

   --------------
   -- Raw_Mode --
   --------------

   function Raw_Mode
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_rawMode (Self.Object), 0);
   end Raw_Mode;

   -----------
   -- Style --
   -----------

   function Style
    (Self : Q_Font_Info'Class)
       return Qt4.Fonts.Font_Style
   is
   begin
      return QFontInfo_style (Self.Object);
   end Style;

   ----------------
   -- Style_Hint --
   ----------------

   function Style_Hint
    (Self : Q_Font_Info'Class)
       return Qt4.Fonts.Font_Style_Hint
   is
   begin
      return QFontInfo_styleHint (Self.Object);
   end Style_Hint;

   ------------
   -- Weight --
   ------------

   function Weight
    (Self : Q_Font_Info'Class)
       return Qt4.Q_Integer
   is
   begin
      return QFontInfo_weight (Self.Object);
   end Weight;

   --------------
   -- Overline --
   --------------

   function Overline
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_overline (Self.Object), 0);
   end Overline;

   ----------------
   -- Strike_Out --
   ----------------

   function Strike_Out
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_strikeOut (Self.Object), 0);
   end Strike_Out;

   ---------------
   -- Underline --
   ---------------

   function Underline
    (Self : Q_Font_Info'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFontInfo_underline (Self.Object), 0);
   end Underline;

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

   package body Internals is

      --------------------
      -- QFontInfo_View --
      --------------------

      function QFontInfo_View
       (Item : Q_Font_Info'Class)
          return QFontInfo_Access
      is
      begin
         return Item.Object;
      end QFontInfo_View;

      package QFontInfo_Conversions is
        new System.Address_To_Access_Conversions
             (QFontInfo);

      -------------------------
      -- QFontInfoTo_Pointer --
      -------------------------

      function To_Pointer
       (Address : System.Address)
          return QFontInfo_Access
      is
      begin
         return
           QFontInfo_Access
            (QFontInfo_Conversions.To_Pointer
            (Address));
      end To_Pointer;

      -------------------------
      -- QFontInfoTo_Address --
      -------------------------

      function To_Address
       (Pointer : QFontInfo_Access)
          return System.Address
      is
      begin
         return
           QFontInfo_Conversions.To_Address
            (QFontInfo_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

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

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

      --------------------------
      -- Create_Uninitialized --
      --------------------------

      function Create_Uninitialized return Q_Font_Info is
      begin
         return Q_Font_Info'
          (Ada.Finalization.Controlled with others => <>);
      end Create_Uninitialized;

      -------------
      -- Storage --
      -------------

      function Storage
       (Item : Q_Font_Info'Class)
          return System.Address
      is
      begin
         return Item.Storage'Address;
      end Storage;

      ------------------------
      -- Set_QFontInfo_View --
      ------------------------

      procedure Set_QFontInfo_View
       (Item : in out Q_Font_Info'Class;
        View : QFontInfo_Access)
      is
      begin
         Item.Object := View;
      end Set_QFontInfo_View;

   end Internals;

end Qt4.Font_Infos;
