------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2007-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: 3769 $ $Date: 2010-10-24 03:16:28 +0400 (Sun, 24 Oct 2010) $
------------------------------------------------------------------------------
pragma Style_Checks ("NM32766");
with Qt_Ada.Internals.Boolean_Conversions;
with System.Address_To_Access_Conversions;

package body Qt4.Fonts is

   function initialize_QFont
    (Storage : System.Address)
      return Internals.QFont_Access;
   pragma Import (C, initialize_QFont, "__QtAda_inititialize_QFont");

   function initialize_QFont_QStringCR_int_Weight_bool
    (Storage : System.Address;
     Family : Qt4.Strings.Internals.QString_Access;
     Point_Size : Qt4.Q_Integer;
     Weight : Font_Weight;
     Italic : Interfaces.C.unsigned)
      return Internals.QFont_Access;
   pragma Import (C, initialize_QFont_QStringCR_int_Weight_bool, "__QtAda_inititialize_QFont_QStringCR_int_Weight_bool");

   function adjust_QFont
    (Storage : System.Address;
     From    : Internals.QFont_Access)
       return Internals.QFont_Access;
   pragma Import (C, adjust_QFont, "__QtAda_adjust_QFont");

   procedure finalize_QFont (Object : Internals.QFont_Access);
   pragma Import (C, finalize_QFont, "__QtAda_finalize_QFont");

   function QFont_bold
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_bold, "__QtAda_QFont_bold_Q");

   procedure QFont_defaultFamily
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_defaultFamily, "__QtAda_QFont_defaultFamily_Q");

   function QFont_exactMatch
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_exactMatch, "__QtAda_QFont_exactMatch_Q");

   procedure QFont_family
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_family, "__QtAda_QFont_family_Q");

   function QFont_fixedPitch
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_fixedPitch, "__QtAda_QFont_fixedPitch_Q");

   function QFont_fromString_QStringCR
    (Self : Internals.QFont_Access;
     Descrip : Qt4.Strings.Internals.QString_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_fromString_QStringCR, "__QtAda_QFont_fromString_QStringCR");

   function QFont_isCopyOf_QFontCR
    (Self : Internals.QFont_Access;
     F : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_isCopyOf_QFontCR, "__QtAda_QFont_isCopyOf_QFontCR_Q");

   function QFont_italic
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_italic, "__QtAda_QFont_italic_Q");

   function QFont_kerning
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_kerning, "__QtAda_QFont_kerning_Q");

   procedure QFont_key
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_key, "__QtAda_QFont_key_Q");

   procedure QFont_lastResortFamily
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_lastResortFamily, "__QtAda_QFont_lastResortFamily_Q");

   procedure QFont_lastResortFont
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_lastResortFont, "__QtAda_QFont_lastResortFont_Q");

   function QFont_overline
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_overline, "__QtAda_QFont_overline_Q");

   function QFont_pixelSize
    (Self : Internals.QFont_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QFont_pixelSize, "__QtAda_QFont_pixelSize_Q");

   function QFont_pointSize
    (Self : Internals.QFont_Access)
       return Qt4.Q_Integer;
   pragma Import (C, QFont_pointSize, "__QtAda_QFont_pointSize_Q");

   function QFont_pointSizeF
    (Self : Internals.QFont_Access)
       return Qt4.Q_Real;
   pragma Import (C, QFont_pointSizeF, "__QtAda_QFont_pointSizeF_Q");

   function QFont_rawMode
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_rawMode, "__QtAda_QFont_rawMode_Q");

   procedure QFont_rawName
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_rawName, "__QtAda_QFont_rawName_Q");

   procedure QFont_resolve_QFontCR
    (Returns : Internals.QFont_Access;
     Self : Internals.QFont_Access;
     F : Internals.QFont_Access);
   pragma Import (C, QFont_resolve_QFontCR, "__QtAda_QFont_resolve_QFontCR_Q");

   procedure QFont_setBold_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setBold_bool, "__QtAda_QFont_setBold_bool");

   procedure QFont_setFamily_QStringCR
    (Self : Internals.QFont_Access;
     Family : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QFont_setFamily_QStringCR, "__QtAda_QFont_setFamily_QStringCR");

   procedure QFont_setFixedPitch_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setFixedPitch_bool, "__QtAda_QFont_setFixedPitch_bool");

   procedure QFont_setItalic_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setItalic_bool, "__QtAda_QFont_setItalic_bool");

   procedure QFont_setKerning_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setKerning_bool, "__QtAda_QFont_setKerning_bool");

   procedure QFont_setOverline_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setOverline_bool, "__QtAda_QFont_setOverline_bool");

   procedure QFont_setPixelSize_int
    (Self : Internals.QFont_Access;
     Size : Qt4.Q_Integer);
   pragma Import (C, QFont_setPixelSize_int, "__QtAda_QFont_setPixelSize_int");

   procedure QFont_setPointSize_int
    (Self : Internals.QFont_Access;
     Size : Qt4.Q_Integer);
   pragma Import (C, QFont_setPointSize_int, "__QtAda_QFont_setPointSize_int");

   procedure QFont_setPointSizeF_qreal
    (Self : Internals.QFont_Access;
     Size : Qt4.Q_Real);
   pragma Import (C, QFont_setPointSizeF_qreal, "__QtAda_QFont_setPointSizeF_qreal");

   procedure QFont_setRawMode_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setRawMode_bool, "__QtAda_QFont_setRawMode_bool");

   procedure QFont_setRawName_QStringCR
    (Self : Internals.QFont_Access;
     Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QFont_setRawName_QStringCR, "__QtAda_QFont_setRawName_QStringCR");

   procedure QFont_setStretch_Stretch
    (Self : Internals.QFont_Access;
     Factor : Font_Stretch);
   pragma Import (C, QFont_setStretch_Stretch, "__QtAda_QFont_setStretch_Stretch");

   procedure QFont_setStrikeOut_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setStrikeOut_bool, "__QtAda_QFont_setStrikeOut_bool");

   procedure QFont_setStyle_Style
    (Self : Internals.QFont_Access;
     Style : Font_Style);
   pragma Import (C, QFont_setStyle_Style, "__QtAda_QFont_setStyle_Style");

   procedure QFont_setUnderline_bool
    (Self : Internals.QFont_Access;
     Enable : Interfaces.C.unsigned);
   pragma Import (C, QFont_setUnderline_bool, "__QtAda_QFont_setUnderline_bool");

   procedure QFont_setWeight_Weight
    (Self : Internals.QFont_Access;
     Weight : Font_Weight);
   pragma Import (C, QFont_setWeight_Weight, "__QtAda_QFont_setWeight_Weight");

   function QFont_stretch
    (Self : Internals.QFont_Access)
       return Font_Stretch;
   pragma Import (C, QFont_stretch, "__QtAda_QFont_stretch_Q");

   function QFont_strikeOut
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_strikeOut, "__QtAda_QFont_strikeOut_Q");

   function QFont_style
    (Self : Internals.QFont_Access)
       return Font_Style;
   pragma Import (C, QFont_style, "__QtAda_QFont_style_Q");

   function QFont_styleHint
    (Self : Internals.QFont_Access)
       return Font_Style_Hint;
   pragma Import (C, QFont_styleHint, "__QtAda_QFont_styleHint_Q");

   procedure QFont_toString
    (Returns : Qt4.Strings.Internals.QString_Access;
     Self : Internals.QFont_Access);
   pragma Import (C, QFont_toString, "__QtAda_QFont_toString_Q");

   function QFont_underline
    (Self : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, QFont_underline, "__QtAda_QFont_underline_Q");

   function QFont_weight
    (Self : Internals.QFont_Access)
       return Font_Weight;
   pragma Import (C, QFont_weight, "__QtAda_QFont_weight_Q");

   function eq_QFontCR
    (Self : Internals.QFont_Access;
     F : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, eq_QFontCR, "__QtAda_QFont_eq_QFontCR_Q");

   function lt_QFontCR
    (Self : Internals.QFont_Access;
     F : Internals.QFont_Access)
       return Interfaces.C.unsigned;
   pragma Import (C, lt_QFontCR, "__QtAda_QFont_lt_QFontCR_Q");

   procedure QFont_insertSubstitution_QStringCR_QStringCR
    (Family_Name : Qt4.Strings.Internals.QString_Access;
     Substitute_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QFont_insertSubstitution_QStringCR_QStringCR, "__QtAda_QFont_insertSubstitution_QStringCR_QStringCR_S");

   procedure QFont_insertSubstitutions_QStringCR_QStringListCR
    (Family_Name : Qt4.Strings.Internals.QString_Access;
     Substitute_Names : Qt4.String_Lists.Internals.QStringList_Access);
   pragma Import (C, QFont_insertSubstitutions_QStringCR_QStringListCR, "__QtAda_QFont_insertSubstitutions_QStringCR_QStringListCR_S");

   procedure QFont_removeSubstitution_QStringCR
    (Family_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QFont_removeSubstitution_QStringCR, "__QtAda_QFont_removeSubstitution_QStringCR_S");

   procedure QFont_substitute_QStringCR
    (Returns : Qt4.Strings.Internals.QString_Access;
     Family_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QFont_substitute_QStringCR, "__QtAda_QFont_substitute_QStringCR_S");

   procedure QFont_substitutes_QStringCR
    (Returns : Qt4.String_Lists.Internals.QStringList_Access;
     Family_Name : Qt4.Strings.Internals.QString_Access);
   pragma Import (C, QFont_substitutes_QStringCR, "__QtAda_QFont_substitutes_QStringCR_S");

   procedure QFont_substitutions
    (Returns : Qt4.String_Lists.Internals.QStringList_Access);
   pragma Import (C, QFont_substitutions, "__QtAda_QFont_substitutions_S");

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

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

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

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

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

   overriding
   procedure Initialize (Self : in out Q_Font) is
      use type Internals.QFont_Access;

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

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

   function Create
     return Q_Font
   is
   begin
      return Self : Q_Font
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QFont (Self.Storage'Address);
      end return;
   end Create;

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

   function Create
    (Family : Qt4.Strings.Q_String'Class;
     Point_Size : Qt4.Q_Integer
       := -1;
     Weight : Font_Weight
       := Weight_Unspecified;
     Italic : Boolean
       := False)
       return Q_Font
   is
   begin
      return Self : Q_Font
        := (Ada.Finalization.Controlled with others => <>)
      do
         Self.Object := initialize_QFont_QStringCR_int_Weight_bool (Self.Storage'Address, Qt4.Strings.Internals.QString_View (Family), Point_Size, Weight, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Italic));
      end return;
   end Create;

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

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

   --------------------
   -- Default_Family --
   --------------------

   function Default_Family
    (Self : Q_Font'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_defaultFamily (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Default_Family;

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

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

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

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

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

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

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

   function From_String
    (Self : not null access Q_Font'Class;
     Descrip : Qt4.Strings.Q_String'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFont_fromString_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Descrip)), 0);
   end From_String;

   ----------------
   -- Is_Copy_Of --
   ----------------

   function Is_Copy_Of
    (Self : Q_Font'Class;
     F : Q_Font'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFont_isCopyOf_QFontCR (Self.Object, F.Object), 0);
   end Is_Copy_Of;

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

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

   -------------
   -- Kerning --
   -------------

   function Kerning
    (Self : Q_Font'Class)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (QFont_kerning (Self.Object), 0);
   end Kerning;

   ---------
   -- Key --
   ---------

   function Key
    (Self : Q_Font'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_key (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Key;

   ------------------------
   -- Last_Resort_Family --
   ------------------------

   function Last_Resort_Family
    (Self : Q_Font'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_lastResortFamily (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Last_Resort_Family;

   ----------------------
   -- Last_Resort_Font --
   ----------------------

   function Last_Resort_Font
    (Self : Q_Font'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_lastResortFont (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Last_Resort_Font;

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

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

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

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

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

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

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

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

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

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

   --------------
   -- Raw_Name --
   --------------

   function Raw_Name
    (Self : Q_Font'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_rawName (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end Raw_Name;

   -------------
   -- Resolve --
   -------------

   function Resolve
    (Self : Q_Font'Class;
     F : Q_Font'Class)
       return Q_Font
   is
   begin
      return Returns : Q_Font do
         QFont_resolve_QFontCR (Returns.Object, Self.Object, F.Object);
      end return;
   end Resolve;

   --------------
   -- Set_Bold --
   --------------

   procedure Set_Bold
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setBold_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Bold;

   ----------------
   -- Set_Family --
   ----------------

   procedure Set_Family
    (Self : in out Q_Font'Class;
     Family : Qt4.Strings.Q_String'Class)
   is
   begin
      QFont_setFamily_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Family));
   end Set_Family;

   ---------------------
   -- Set_Fixed_Pitch --
   ---------------------

   procedure Set_Fixed_Pitch
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setFixedPitch_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Fixed_Pitch;

   ----------------
   -- Set_Italic --
   ----------------

   procedure Set_Italic
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setItalic_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Italic;

   -----------------
   -- Set_Kerning --
   -----------------

   procedure Set_Kerning
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setKerning_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Kerning;

   ------------------
   -- Set_Overline --
   ------------------

   procedure Set_Overline
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setOverline_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Overline;

   --------------------
   -- Set_Pixel_Size --
   --------------------

   procedure Set_Pixel_Size
    (Self : in out Q_Font'Class;
     Size : Qt4.Q_Integer)
   is
   begin
      QFont_setPixelSize_int (Self.Object, Size);
   end Set_Pixel_Size;

   --------------------
   -- Set_Point_Size --
   --------------------

   procedure Set_Point_Size
    (Self : in out Q_Font'Class;
     Size : Qt4.Q_Integer)
   is
   begin
      QFont_setPointSize_int (Self.Object, Size);
   end Set_Point_Size;

   ----------------------
   -- Set_Point_Size_F --
   ----------------------

   procedure Set_Point_Size_F
    (Self : in out Q_Font'Class;
     Size : Qt4.Q_Real)
   is
   begin
      QFont_setPointSizeF_qreal (Self.Object, Size);
   end Set_Point_Size_F;

   ------------------
   -- Set_Raw_Mode --
   ------------------

   procedure Set_Raw_Mode
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setRawMode_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Raw_Mode;

   ------------------
   -- Set_Raw_Name --
   ------------------

   procedure Set_Raw_Name
    (Self : in out Q_Font'Class;
     Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QFont_setRawName_QStringCR (Self.Object, Qt4.Strings.Internals.QString_View (Name));
   end Set_Raw_Name;

   -----------------
   -- Set_Stretch --
   -----------------

   procedure Set_Stretch
    (Self : in out Q_Font'Class;
     Factor : Font_Stretch)
   is
   begin
      QFont_setStretch_Stretch (Self.Object, Factor);
   end Set_Stretch;

   --------------------
   -- Set_Strike_Out --
   --------------------

   procedure Set_Strike_Out
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setStrikeOut_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Strike_Out;

   ---------------
   -- Set_Style --
   ---------------

   procedure Set_Style
    (Self : in out Q_Font'Class;
     Style : Font_Style)
   is
   begin
      QFont_setStyle_Style (Self.Object, Style);
   end Set_Style;

   -------------------
   -- Set_Underline --
   -------------------

   procedure Set_Underline
    (Self : in out Q_Font'Class;
     Enable : Boolean)
   is
   begin
      QFont_setUnderline_bool (Self.Object, Qt_Ada.Internals.Boolean_Conversions.To_unsigned (Enable));
   end Set_Underline;

   ----------------
   -- Set_Weight --
   ----------------

   procedure Set_Weight
    (Self : in out Q_Font'Class;
     Weight : Font_Weight)
   is
   begin
      QFont_setWeight_Weight (Self.Object, Weight);
   end Set_Weight;

   -------------
   -- Stretch --
   -------------

   function Stretch
    (Self : Q_Font'Class)
       return Font_Stretch
   is
   begin
      return QFont_stretch (Self.Object);
   end Stretch;

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

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

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

   function Style
    (Self : Q_Font'Class)
       return Font_Style
   is
   begin
      return QFont_style (Self.Object);
   end Style;

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

   function Style_Hint
    (Self : Q_Font'Class)
       return Font_Style_Hint
   is
   begin
      return QFont_styleHint (Self.Object);
   end Style_Hint;

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

   function To_String
    (Self : Q_Font'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_toString (Qt4.Strings.Internals.QString_View (Returns), Self.Object);
      end return;
   end To_String;

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

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

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

   function Weight
    (Self : Q_Font'Class)
       return Font_Weight
   is
   begin
      return QFont_weight (Self.Object);
   end Weight;

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

   function "="
    (Self : Q_Font;
     F : Q_Font)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (eq_QFontCR (Self.Object, F.Object), 0);
   end "=";

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

   function "<"
    (Self : Q_Font;
     F : Q_Font)
       return Boolean
   is
   begin
      return Interfaces.C."/=" (lt_QFontCR (Self.Object, F.Object), 0);
   end "<";

   -------------------------
   -- Insert_Substitution --
   -------------------------

   procedure Insert_Substitution
    (Family_Name : Qt4.Strings.Q_String'Class;
     Substitute_Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QFont_insertSubstitution_QStringCR_QStringCR (Qt4.Strings.Internals.QString_View (Family_Name), Qt4.Strings.Internals.QString_View (Substitute_Name));
   end Insert_Substitution;

   --------------------------
   -- Insert_Substitutions --
   --------------------------

   procedure Insert_Substitutions
    (Family_Name : Qt4.Strings.Q_String'Class;
     Substitute_Names : Qt4.String_Lists.Q_String_List'Class)
   is
   begin
      QFont_insertSubstitutions_QStringCR_QStringListCR (Qt4.Strings.Internals.QString_View (Family_Name), Qt4.String_Lists.Internals.QStringList_View (Substitute_Names));
   end Insert_Substitutions;

   -------------------------
   -- Remove_Substitution --
   -------------------------

   procedure Remove_Substitution
    (Family_Name : Qt4.Strings.Q_String'Class)
   is
   begin
      QFont_removeSubstitution_QStringCR (Qt4.Strings.Internals.QString_View (Family_Name));
   end Remove_Substitution;

   ----------------
   -- Substitute --
   ----------------

   function Substitute
    (Family_Name : Qt4.Strings.Q_String'Class)
       return Qt4.Strings.Q_String
   is
   begin
      return Returns : Qt4.Strings.Q_String do
         QFont_substitute_QStringCR (Qt4.Strings.Internals.QString_View (Returns), Qt4.Strings.Internals.QString_View (Family_Name));
      end return;
   end Substitute;

   -----------------
   -- Substitutes --
   -----------------

   function Substitutes
    (Family_Name : Qt4.Strings.Q_String'Class)
       return Qt4.String_Lists.Q_String_List
   is
   begin
      return Returns : Qt4.String_Lists.Q_String_List do
         QFont_substitutes_QStringCR (Qt4.String_Lists.Internals.QStringList_View (Returns), Qt4.Strings.Internals.QString_View (Family_Name));
      end return;
   end Substitutes;

   -------------------
   -- Substitutions --
   -------------------

   function Substitutions
     return Qt4.String_Lists.Q_String_List
   is
   begin
      return Returns : Qt4.String_Lists.Q_String_List do
         QFont_substitutions (Qt4.String_Lists.Internals.QStringList_View (Returns));
      end return;
   end Substitutions;

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

   package body Internals is

   ----------------
   -- QFont_View --
   ----------------

      function QFont_View
       (Item : Q_Font'Class)
          return QFont_Access
      is
      begin
         return Item.Object;
      end QFont_View;

      package QFont_Conversions is
        new System.Address_To_Access_Conversions
             (QFont);

   ---------------------
   -- QFontTo_Pointer --
   ---------------------

      function To_Pointer
       (Address : System.Address)
          return QFont_Access
      is
      begin
         return
           QFont_Access
            (QFont_Conversions.To_Pointer
            (Address));
      end To_Pointer;

   ---------------------
   -- QFontTo_Address --
   ---------------------

      function To_Address
       (Pointer : QFont_Access)
          return System.Address
      is
      begin
         return
           QFont_Conversions.To_Address
            (QFont_Conversions.Object_Pointer
              (Pointer));
      end To_Address;

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

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

   end Internals;

end Qt4.Fonts;
