------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008-2011 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 Qt4.Text_Objects;
with Qt_Ada.Internals.Object_Registry;
with Qt_Ada.Internals.Objects;

with Qt_Ada.Internals.Objects.Text_Document_Proxies;
pragma Warnings (Off, Qt_Ada.Internals.Objects.Text_Document_Proxies);
--  Elaboration of the proxy tagged type package register proxy object
--  constructor. Bindings must be able to create proxy object of the
--  corresponding tagged type for works properly.

package body Qt4.Text_Documents is

   procedure adjustSize_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, adjustSize_0_wrapper,
                     "__Qt4Ada_QTextDocument_adjustSize_0_wrapper");

   procedure begin_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : out Qt4.Text_Blocks.Thin.QTextBlock);
   pragma Import (C, begin_0_wrapper,
                     "__Qt4Ada_QTextDocument_begin_0_wrapper");

   function blockCount_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.Q_Integer;
   pragma Import (C, blockCount_0_wrapper,
                     "__Qt4Ada_QTextDocument_blockCount_0_wrapper");

   procedure characterAt_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Pos : Qt4.Q_Integer;
     Returns : not null access Qt4.Chars.Internals.QChar);
   pragma Import (C, characterAt_0_wrapper,
                     "__Qt4Ada_QTextDocument_characterAt_0_wrapper");

   procedure defaultFont_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Fonts.Internals.QFont);
   pragma Import (C, defaultFont_0_wrapper,
                     "__Qt4Ada_QTextDocument_defaultFont_0_wrapper");

   procedure defaultStyleSheet_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Strings.Internals.QString);
   pragma Import (C, defaultStyleSheet_0_wrapper,
                     "__Qt4Ada_QTextDocument_defaultStyleSheet_0_wrapper");

   procedure end_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : out Qt4.Text_Blocks.Thin.QTextBlock);
   pragma Import (C, end_0_wrapper,
                     "__Qt4Ada_QTextDocument_end_0_wrapper");

   procedure findBlock_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Pos : Qt4.Q_Integer;
     Returns : out Qt4.Text_Blocks.Thin.QTextBlock);
   pragma Import (C, findBlock_0_wrapper,
                     "__Qt4Ada_QTextDocument_findBlock_0_wrapper");

   function isEmpty_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isEmpty_0_wrapper,
                     "__Qt4Ada_QTextDocument_isEmpty_0_wrapper");

   function isModified_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isModified_0_wrapper,
                     "__Qt4Ada_QTextDocument_isModified_0_wrapper");

   function isRedoAvailable_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isRedoAvailable_0_wrapper,
                     "__Qt4Ada_QTextDocument_isRedoAvailable_0_wrapper");

   function isUndoAvailable_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isUndoAvailable_0_wrapper,
                     "__Qt4Ada_QTextDocument_isUndoAvailable_0_wrapper");

   function isUndoRedoEnabled_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, isUndoRedoEnabled_0_wrapper,
                     "__Qt4Ada_QTextDocument_isUndoRedoEnabled_0_wrapper");

   procedure markContentsDirty_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     From : Qt4.Q_Integer;
     Length : Qt4.Q_Integer);
   pragma Import (C, markContentsDirty_0_wrapper,
                     "__Qt4Ada_QTextDocument_markContentsDirty_0_wrapper");

   function maximumBlockCount_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.Q_Integer;
   pragma Import (C, maximumBlockCount_0_wrapper,
                     "__Qt4Ada_QTextDocument_maximumBlockCount_0_wrapper");

   function object_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Object_Index : Qt4.Q_Integer)
       return not null access Qt_Ada.Internals.Objects.QObject;
   pragma Import (C, object_0_wrapper,
                     "__Qt4Ada_QTextDocument_object_0_wrapper");

   function pageCount_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.Q_Integer;
   pragma Import (C, pageCount_0_wrapper,
                     "__Qt4Ada_QTextDocument_pageCount_0_wrapper");

   procedure setDefaultFont_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Font : not null access constant Qt4.Fonts.Internals.QFont);
   pragma Import (C, setDefaultFont_0_wrapper,
                     "__Qt4Ada_QTextDocument_setDefaultFont_0_wrapper");

   procedure setDefaultStyleSheet_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Sheet : not null access constant Qt4.Strings.Internals.QString);
   pragma Import (C, setDefaultStyleSheet_0_wrapper,
                     "__Qt4Ada_QTextDocument_setDefaultStyleSheet_0_wrapper");

   procedure setHtml_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Html : not null access constant Qt4.Strings.Internals.QString);
   pragma Import (C, setHtml_0_wrapper,
                     "__Qt4Ada_QTextDocument_setHtml_0_wrapper");

   procedure setMaximumBlockCount_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Maximum : Qt4.Q_Integer);
   pragma Import (C, setMaximumBlockCount_0_wrapper,
                     "__Qt4Ada_QTextDocument_setMaximumBlockCount_0_wrapper");

   procedure setPlainText_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Text : not null access constant Qt4.Strings.Internals.QString);
   pragma Import (C, setPlainText_0_wrapper,
                     "__Qt4Ada_QTextDocument_setPlainText_0_wrapper");

   procedure setUndoRedoEnabled_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Enable : Qt4.bool);
   pragma Import (C, setUndoRedoEnabled_0_wrapper,
                     "__Qt4Ada_QTextDocument_setUndoRedoEnabled_0_wrapper");

   procedure setUseDesignMetrics_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     B : Qt4.bool);
   pragma Import (C, setUseDesignMetrics_0_wrapper,
                     "__Qt4Ada_QTextDocument_setUseDesignMetrics_0_wrapper");

   procedure toHtml_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Encoding : not null access constant Qt4.Byte_Arrays.Internals.QByteArray;
     Returns : not null access Qt4.Strings.Internals.QString);
   pragma Import (C, toHtml_0_wrapper,
                     "__Qt4Ada_QTextDocument_toHtml_0_wrapper");

   procedure toPlainText_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     Returns : not null access Qt4.Strings.Internals.QString);
   pragma Import (C, toPlainText_0_wrapper,
                     "__Qt4Ada_QTextDocument_toPlainText_0_wrapper");

   function useDesignMetrics_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject)
       return Qt4.bool;
   pragma Import (C, useDesignMetrics_0_wrapper,
                     "__Qt4Ada_QTextDocument_useDesignMetrics_0_wrapper");

   procedure redo_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, redo_0_wrapper,
                     "__Qt4Ada_QTextDocument_redo_0_wrapper");

   procedure setModified_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject;
     M : Qt4.bool);
   pragma Import (C, setModified_0_wrapper,
                     "__Qt4Ada_QTextDocument_setModified_0_wrapper");

   procedure undo_0_wrapper
    (Self : not null access Qt_Ada.Internals.Objects.QObject);
   pragma Import (C, undo_0_wrapper,
                     "__Qt4Ada_QTextDocument_undo_0_wrapper");

   procedure find_1_wrapper
    (Self       : not null access Qt_Ada.Internals.Objects.QObject;
     Sub_String : not null access Qt4.Strings.Internals.QString;
     Position   : Interfaces.C.int;
     Options    : Find_Flags;
     Result     : not null access Qt4.Text_Cursors.Thin.QTextCursor);
   pragma Import (C, find_1_wrapper, "__Qt4Ada_QTextDocument_find_1_wrapper");

   procedure print_wrapper
    (Self    : not null access Qt_Ada.Internals.Objects.QObject;
     Printer : not null Qt4.Printers.Internals.QPrinter_Access);
   pragma Import (C, print_wrapper, "__Qt4Ada_QTextDocument_print_wrapper");

   ----------
   -- Find --
   ----------

   function Find
    (Self       : not null access Qt4.Text_Documents.Q_Text_Document'Class;
     Sub_String : Qt4.Strings.Q_String;
     Position   : Q_Integer := 0;
     Options    : Find_Flags := +Find_Default)
       return Qt4.Text_Cursors.Q_Text_Cursor is
   begin
      return Result : Qt4.Text_Cursors.Q_Text_Cursor do
         find_1_wrapper
          (Self.QObject_View,
           Qt4.Strings.Internals.QString_View (Sub_String),
           Interfaces.C.int (Position),
           Options,
           Qt4.Text_Cursors.Internals.QTextCursor_View (Result));
      end return;
   end Find;

   -----------
   -- Print --
   -----------

   procedure Print
    (Self    : not null access constant Qt4.Text_Documents.Q_Text_Document'Class;
     Printer : in out Qt4.Printers.Q_Printer'Class) is
   begin
      print_wrapper
       (Self.QObject_View,
        Qt4.Printers.Internals.QPrinter_View (Printer));
   end Print;

   pragma Style_Checks ("N");

   -----------------
   -- Adjust_Size --
   -----------------

   procedure Adjust_Size
    (Self : not null access Q_Text_Document'Class)
   is
   begin
      adjustSize_0_wrapper
       (Self.QObject_View);
   end Adjust_Size;

   -----------------
   -- Begin_Block --
   -----------------

   function Begin_Block
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Text_Blocks.Q_Text_Block
   is
      Returns : Qt4.Text_Blocks.Q_Text_Block;

   begin
      begin_0_wrapper
       (Self.QObject_View,
        Qt4.Text_Blocks.Internals.QTextBlock_View (Returns).all);

      return Returns;
   end Begin_Block;

   -----------------
   -- Block_Count --
   -----------------

   function Block_Count
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Q_Integer
   is
   begin
      return
        blockCount_0_wrapper
         (Self.QObject_View);
   end Block_Count;

   ------------------
   -- Character_At --
   ------------------

   function Character_At
    (Self : not null access Q_Text_Document'Class;
     Pos : Qt4.Q_Integer)
       return Qt4.Chars.Q_Char
   is
      Returns : Qt4.Chars.Q_Char;

   begin
      characterAt_0_wrapper
       (Self.QObject_View,
        Pos,
        Qt4.Chars.Internals.QChar_View (Returns));

      return Returns;
   end Character_At;

   ------------------
   -- Default_Font --
   ------------------

   function Default_Font
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Fonts.Q_Font
   is
      Returns : Qt4.Fonts.Q_Font;

   begin
      defaultFont_0_wrapper
       (Self.QObject_View,
        Qt4.Fonts.Internals.QFont_View (Returns));

      return Returns;
   end Default_Font;

   -------------------------
   -- Default_Style_Sheet --
   -------------------------

   function Default_Style_Sheet
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Strings.Q_String
   is
      Returns : Qt4.Strings.Q_String;

   begin
      defaultStyleSheet_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Returns));

      return Returns;
   end Default_Style_Sheet;

   ---------------
   -- End_Block --
   ---------------

   function End_Block
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Text_Blocks.Q_Text_Block
   is
      Returns : Qt4.Text_Blocks.Q_Text_Block;

   begin
      end_0_wrapper
       (Self.QObject_View,
        Qt4.Text_Blocks.Internals.QTextBlock_View (Returns).all);

      return Returns;
   end End_Block;

   ----------------
   -- Find_Block --
   ----------------

   function Find_Block
    (Self : not null access constant Q_Text_Document'Class;
     Pos : Qt4.Q_Integer)
       return Qt4.Text_Blocks.Q_Text_Block
   is
      Returns : Qt4.Text_Blocks.Q_Text_Block;

   begin
      findBlock_0_wrapper
       (Self.QObject_View,
        Pos,
        Qt4.Text_Blocks.Internals.QTextBlock_View (Returns).all);

      return Returns;
   end Find_Block;

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

   function Is_Empty
    (Self : not null access constant Q_Text_Document'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isEmpty_0_wrapper
           (Self.QObject_View));
   end Is_Empty;

   -----------------
   -- Is_Modified --
   -----------------

   function Is_Modified
    (Self : not null access constant Q_Text_Document'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isModified_0_wrapper
           (Self.QObject_View));
   end Is_Modified;

   -----------------------
   -- Is_Redo_Available --
   -----------------------

   function Is_Redo_Available
    (Self : not null access constant Q_Text_Document'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isRedoAvailable_0_wrapper
           (Self.QObject_View));
   end Is_Redo_Available;

   -----------------------
   -- Is_Undo_Available --
   -----------------------

   function Is_Undo_Available
    (Self : not null access constant Q_Text_Document'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isUndoAvailable_0_wrapper
           (Self.QObject_View));
   end Is_Undo_Available;

   --------------------------
   -- Is_Undo_Redo_Enabled --
   --------------------------

   function Is_Undo_Redo_Enabled
    (Self : not null access constant Q_Text_Document'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (isUndoRedoEnabled_0_wrapper
           (Self.QObject_View));
   end Is_Undo_Redo_Enabled;

   -------------------------
   -- Mark_Contents_Dirty --
   -------------------------

   procedure Mark_Contents_Dirty
    (Self : not null access Q_Text_Document'Class;
     From : Qt4.Q_Integer;
     Length : Qt4.Q_Integer)
   is
   begin
      markContentsDirty_0_wrapper
       (Self.QObject_View,
        From,
        Length);
   end Mark_Contents_Dirty;

   -------------------------
   -- Maximum_Block_Count --
   -------------------------

   function Maximum_Block_Count
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Q_Integer
   is
   begin
      return
        maximumBlockCount_0_wrapper
         (Self.QObject_View);
   end Maximum_Block_Count;

   ------------
   -- Object --
   ------------

   function Object
    (Self : not null access constant Q_Text_Document'Class;
     Object_Index : Qt4.Q_Integer)
       return not null access Qt4.Text_Objects.Q_Text_Object'Class
   is
   begin
      return
        Qt4.Text_Objects.Q_Text_Object'Class
         (Qt_Ada.Internals.Object_Registry.To_Q_Object
           (object_0_wrapper
             (Self.QObject_View,
              Object_Index)).all)'Access;
   end Object;

   ----------------
   -- Page_Count --
   ----------------

   function Page_Count
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Q_Integer
   is
   begin
      return
        pageCount_0_wrapper
         (Self.QObject_View);
   end Page_Count;

   ----------------------
   -- Set_Default_Font --
   ----------------------

   procedure Set_Default_Font
    (Self : not null access Q_Text_Document'Class;
     Font : Qt4.Fonts.Q_Font)
   is
   begin
      setDefaultFont_0_wrapper
       (Self.QObject_View,
        Qt4.Fonts.Internals.QFont_View (Font));
   end Set_Default_Font;

   -----------------------------
   -- Set_Default_Style_Sheet --
   -----------------------------

   procedure Set_Default_Style_Sheet
    (Self : not null access Q_Text_Document'Class;
     Sheet : Qt4.Strings.Q_String)
   is
   begin
      setDefaultStyleSheet_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Sheet));
   end Set_Default_Style_Sheet;

   --------------
   -- Set_Html --
   --------------

   procedure Set_Html
    (Self : not null access Q_Text_Document'Class;
     Html : Qt4.Strings.Q_String)
   is
   begin
      setHtml_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Html));
   end Set_Html;

   -----------------------------
   -- Set_Maximum_Block_Count --
   -----------------------------

   procedure Set_Maximum_Block_Count
    (Self : not null access Q_Text_Document'Class;
     Maximum : Qt4.Q_Integer)
   is
   begin
      setMaximumBlockCount_0_wrapper
       (Self.QObject_View,
        Maximum);
   end Set_Maximum_Block_Count;

   --------------------
   -- Set_Plain_Text --
   --------------------

   procedure Set_Plain_Text
    (Self : not null access Q_Text_Document'Class;
     Text : Qt4.Strings.Q_String)
   is
   begin
      setPlainText_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Text));
   end Set_Plain_Text;

   ---------------------------
   -- Set_Undo_Redo_Enabled --
   ---------------------------

   procedure Set_Undo_Redo_Enabled
    (Self : not null access Q_Text_Document'Class;
     Enable : Standard.Boolean)
   is
   begin
      setUndoRedoEnabled_0_wrapper
       (Self.QObject_View,
        Qt4.To_bool (Enable));
   end Set_Undo_Redo_Enabled;

   ----------------------------
   -- Set_Use_Design_Metrics --
   ----------------------------

   procedure Set_Use_Design_Metrics
    (Self : not null access Q_Text_Document'Class;
     B : Standard.Boolean)
   is
   begin
      setUseDesignMetrics_0_wrapper
       (Self.QObject_View,
        Qt4.To_bool (B));
   end Set_Use_Design_Metrics;

   -------------
   -- To_Html --
   -------------

   function To_Html
    (Self : not null access constant Q_Text_Document'Class;
     Encoding : Qt4.Byte_Arrays.Q_Byte_Array
       := Qt4.Byte_Arrays.Create)
       return Qt4.Strings.Q_String
   is
      Returns : Qt4.Strings.Q_String;

   begin
      toHtml_0_wrapper
       (Self.QObject_View,
        Qt4.Byte_Arrays.Internals.QByteArray_View (Encoding),
        Qt4.Strings.Internals.QString_View (Returns));

      return Returns;
   end To_Html;

   -------------------
   -- To_Plain_Text --
   -------------------

   function To_Plain_Text
    (Self : not null access constant Q_Text_Document'Class)
       return Qt4.Strings.Q_String
   is
      Returns : Qt4.Strings.Q_String;

   begin
      toPlainText_0_wrapper
       (Self.QObject_View,
        Qt4.Strings.Internals.QString_View (Returns));

      return Returns;
   end To_Plain_Text;

   ------------------------
   -- Use_Design_Metrics --
   ------------------------

   function Use_Design_Metrics
    (Self : not null access constant Q_Text_Document'Class)
       return Standard.Boolean
   is
   begin
      return
        Qt4.To_Boolean
         (useDesignMetrics_0_wrapper
           (Self.QObject_View));
   end Use_Design_Metrics;

   ----------
   -- Redo --
   ----------

   procedure Redo
    (Self : not null access Q_Text_Document'Class)
   is
   begin
      redo_0_wrapper
       (Self.QObject_View);
   end Redo;

   ------------------
   -- Set_Modified --
   ------------------

   procedure Set_Modified
    (Self : not null access Q_Text_Document'Class;
     M : Standard.Boolean
       := True)
   is
   begin
      setModified_0_wrapper
       (Self.QObject_View,
        Qt4.To_bool (M));
   end Set_Modified;

   ----------
   -- Undo --
   ----------

   procedure Undo
    (Self : not null access Q_Text_Document'Class)
   is
   begin
      undo_0_wrapper
       (Self.QObject_View);
   end Undo;

end Qt4.Text_Documents;
