------------------------------------------------------------------------------
--                                                                          --
--                An Ada2005 binding to the Qt C++ framework                --
--                                                                          --
------------------------------------------------------------------------------
--                                                                          --
-- Copyright © 2008, 2009 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.                                              --
--                                                                          --
------------------------------------------------------------------------------
--  $Revision: 3244 $ $Date: 2009-04-15 12:30:41 +0400 (Wed, 15 Apr 2009) $
------------------------------------------------------------------------------
with Qt4.Graphics_Items.Directors;
with Qt4.Point_Fs;
with Qt4.Painters;
with Qt4.Rect_Fs;
with Qt4.Style_Option_Graphics_Items;
with Qt4.Widgets;

with Nodes;

package Edges.Impl is

   type Edge_Impl is
     new Qt4.Graphics_Items.Directors.Q_Graphics_Item_Director and Edge with
   record
      Source       : access Nodes.Node'Class;
      Dest         : access Nodes.Node'Class;
      Source_Point : Qt4.Point_Fs.Q_Point_F;
      Dest_Point   : Qt4.Point_Fs.Q_Point_F;
      Arrow_Size   : Qt4.Q_Real;
   end record;

   --  Public Functions

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Adjust
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   procedure Adjust_1 (Self : not null access Edge_Impl);

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Dest_Node
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   function Dest_Node (Self : not null access Edge_Impl)
     return access Nodes.Node'Class;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Source_Node
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   function Source_Node (Self : not null access Edge_Impl)
     return access Nodes.Node'Class;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Set_Source_Node
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   procedure Set_Source_Node (Self : not null access Edge_Impl;
                              Node : not null        Nodes.Node_Access);

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Set_Dest_Node
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   procedure Set_Dest_Node (Self : not null access Edge_Impl;
                            Node : not null        Nodes.Node_Access);

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Item_Type
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   function Item_Type (Self : not null access Edge_Impl)
     return Qt4.Graphics_Items.Graphics_Item_Type;

    --  Protected Functions

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Bounding_Rect
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   function Bounding_Rect (Self : not null access constant Edge_Impl)
     return Qt4.Rect_Fs.Q_Rect_F;

   ---------------------------------------------------------------------------
   --! <Subprogram>
   --!    <Unit> Paint
   --!    <Purpose>
   --!    <Exceptions>
   ---------------------------------------------------------------------------
   overriding
   procedure Paint
    (Self    : not null access Edge_Impl;
     Painter : in out Qt4.Painters.Q_Painter'Class;
     Option  :
       Qt4.Style_Option_Graphics_Items.Q_Style_Option_Graphics_Item'Class;
     Widget  : access Qt4.Widgets.Q_Widget'Class := null);

end Edges.Impl;
