------------------------------------------------------------------------------
--                                                                          --
--                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: 3225 $ $Date: 2009-04-03 17:20:32 +0400 (Fri, 03 Apr 2009) $
------------------------------------------------------------------------------
with Qt4.Graphics_Views;
private with Qt4.Graphics_Views.Directors;
private with Qt4.Key_Events;
private with Qt4.Painters;
private with Qt4.Rect_Fs;
private with Qt4.Timer_Events;
private with Qt4.Wheel_Events;

private with Edges;
private with Nodes;

package Graph_Widgets is

   type Graph_Widget is limited
     new Qt4.Graphics_Views.Q_Graphics_View with private;

   type Graph_Widget_Access is access all Graph_Widget'Class;

   procedure Item_Moved (Self : not null access Graph_Widget'Class);

private

   type Graph_Widget is
     new Qt4.Graphics_Views.Directors.Q_Graphics_View_Director with
   record
      Timer_Id    : Qt4.Q_Integer := 0;

      Node_1      : access Nodes.Node'Class;
      Node_2      : access Nodes.Node'Class;
      Node_3      : access Nodes.Node'Class;
      Node_4      : access Nodes.Node'Class;
      Center_Node : access Nodes.Node'Class;
      Node_6      : access Nodes.Node'Class;
      Node_7      : access Nodes.Node'Class;
      Node_8      : access Nodes.Node'Class;
      Node_9      : access Nodes.Node'Class;

      Edge_1_2    : access Edges.Edge'Class;
      Edge_2_3    : access Edges.Edge'Class;
      Edge_2_C    : access Edges.Edge'Class;
      Edge_3_6    : access Edges.Edge'Class;
      Edge_4_1    : access Edges.Edge'Class;
      Edge_4_C    : access Edges.Edge'Class;
      Edge_C_6    : access Edges.Edge'Class;
      Edge_C_8    : access Edges.Edge'Class;
      Edge_6_9    : access Edges.Edge'Class;
      Edge_7_4    : access Edges.Edge'Class;
      Edge_8_7    : access Edges.Edge'Class;
      Edge_9_8    : access Edges.Edge'Class;
   end record;

   overriding
   procedure Key_Press_Event
    (Self  : not null access Graph_Widget;
     Event : not null access Qt4.Key_Events.Q_Key_Event'Class);

   overriding
   procedure Timer_Event
    (Self  : not null access Graph_Widget;
     Event : not null access Qt4.Timer_Events.Q_Timer_Event'Class);

   overriding
   procedure Wheel_Event
    (Self  : not null access Graph_Widget;
     Event : not null access Qt4.Wheel_Events.Q_Wheel_Event'Class);

   overriding
   procedure Draw_Background
    (Self    : not null access Graph_Widget;
     Painter : in out Qt4.Painters.Q_Painter'Class;
     Rect    : Qt4.Rect_Fs.Q_Rect_F);

   procedure Scale_View
    (Self         : not null access Graph_Widget'Class;
     Scale_Factor : Qt4.Q_Real);

end Graph_Widgets;
