------------------------------------------------------------------------------
--                                                                          --
--                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: 3658 $ $Date: 2009-12-20 19:32:15 +0300 (Sun, 20 Dec 2009) $
------------------------------------------------------------------------------
with Qt4.Graphics_Items.Directors;

with Nodes.Impl;

package body Nodes.Constructors is

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

   function Create
    (Graph_Widget : not null access Graph_Widgets.Graph_Widget'Class)
       return not null Node_Access
   is
      use type Qt4.Q_Real;

   begin
      return Result : constant not null Node_Access
        := new Nodes.Impl.Node_Impl
      do
         Qt4.Graphics_Items.Directors.Constructors.Initialize
           (Qt4.Graphics_Items.Directors.Q_Graphics_Item_Director'Class
             (Result.all)'Access);

         declare
            R : Nodes.Impl.Node_Impl'Class
              renames Nodes.Impl.Node_Impl'Class (Result.all);

         begin
            R.Graph := Graph_Widget;

            Result.Set_Flag (Qt4.Graphics_Items.Item_Is_Movable);
            Result.Set_Flag (Qt4.Graphics_Items.Item_Sends_Geometry_Changes);
            Result.Set_Cache_Mode (Qt4.Graphics_Items.Device_Coordinate_Cache);
            Result.Set_Z_Value (-1.0);
         end;
      end return;
   end Create;

end Nodes.Constructors;
