------------------------------------------------------------------------------
--                                                                          --
--                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: 3266 $ $Date: 2009-04-18 13:27:41 +0400 (Sat, 18 Apr 2009) $
------------------------------------------------------------------------------
with Qt4.Abstract_Item_Views;
private with Qt4.Abstract_Item_Views.Directors;
private with Qt4.Events;
private with Qt4.Item_Selection_Models;
private with Qt4.Item_Selections;
private with Qt4.Model_Indices;
private with Qt4.Mouse_Events;
private with Qt4.Paint_Events;
private with Qt4.Points;
private with Qt4.Rects;
private with Qt4.Regions;
private with Qt4.Resize_Events;
private with Qt4.Rubber_Bands;

package Pie_Views is

   type Pie_View is limited
     new Qt4.Abstract_Item_Views.Q_Abstract_Item_View with private;

   type Pie_View_Access is access all Pie_View'Class;

   package Constructors is

      function Create return not null Pie_View_Access;

   end Constructors;

private

   type Pie_View is
     new Qt4.Abstract_Item_Views.Directors.Q_Abstract_Item_View_Director with
   record
      Margin      : Qt4.Q_Integer;
      Pie_Size    : Qt4.Q_Integer;
      Total_Size  : Qt4.Q_Integer;
      Total_Value : Qt4.Q_Real;
      Valid_Items : Qt4.Q_Integer;
      Rubber_Band : Qt4.Rubber_Bands.Q_Rubber_Band_Access;
      Origin      : Qt4.Points.Q_Point;
   end record;

   overriding procedure Data_Changed
    (Self         : not null access Pie_View;
     Top_Left     : Qt4.Model_Indices.Q_Model_Index;
     Bottom_Right : Qt4.Model_Indices.Q_Model_Index);

   overriding function Edit
    (Self    : not null access Pie_View;
     Index   : Qt4.Model_Indices.Q_Model_Index;
     Trigger : Qt4.Abstract_Item_Views.Edit_Trigger;
     Event   : access Qt4.Events.Q_Event'Class)
       return Boolean;

   overriding function Horizontal_Offset
    (Self : not null access constant Pie_View)
       return Qt4.Q_Integer;

   overriding function Index_At
    (Self  : not null access constant Pie_View;
     Point : Qt4.Points.Q_Point)
       return Qt4.Model_Indices.Q_Model_Index;

   overriding function Is_Index_Hidden
    (Self  : not null access constant Pie_View;
     Index : Qt4.Model_Indices.Q_Model_Index)
       return Boolean;

   overriding procedure Mouse_Move_Event
    (Self  : not null access Pie_View;
     Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);

   overriding procedure Mouse_Press_Event
    (Self  : not null access Pie_View;
     Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);

   overriding procedure Mouse_Release_Event
    (Self  : not null access Pie_View;
     Event : not null access Qt4.Mouse_Events.Q_Mouse_Event'Class);

   overriding function Move_Cursor
    (Self      : not null access Pie_View;
     Action    : Qt4.Abstract_Item_Views.Cursor_Action;
     Modifiers : Qt4.Keyboard_Modifiers)
       return Qt4.Model_Indices.Q_Model_Index;

   overriding procedure Resize_Event
    (Self  : not null access Pie_View;
     Event : not null access Qt4.Resize_Events.Q_Resize_Event'Class);

   overriding procedure Scroll_Contents_By
    (Self : not null access Pie_View;
     Dx   : Qt4.Q_Integer;
     Dy   : Qt4.Q_Integer);

   overriding procedure Scroll_To
    (Self  : not null access Pie_View;
     Index : Qt4.Model_Indices.Q_Model_Index;
     Hint  : Qt4.Abstract_Item_Views.Abstract_Item_View_Scroll_Hint
       := Qt4.Abstract_Item_Views.Ensure_Visible);

   overriding procedure Set_Selection
    (Self  : not null access Pie_View;
     Rect  : Qt4.Rects.Q_Rect;
     Flags : Qt4.Item_Selection_Models.Selection_Flags);

   overriding function Vertical_Offset
    (Self : not null access constant Pie_View)
       return Qt4.Q_Integer;

   overriding function Visual_Rect
    (Self  : not null access constant Pie_View;
     Index : Qt4.Model_Indices.Q_Model_Index)
       return Qt4.Rects.Q_Rect;

   overriding function Visual_Region_For_Selection
    (Self      : not null access constant Pie_View;
     Selection : Qt4.Item_Selections.Q_Item_Selection)
       return Qt4.Regions.Q_Region;

   overriding procedure Paint_Event
    (Self  : not null access Pie_View;
     Event : not null access Qt4.Paint_Events.Q_Paint_Event'Class);

   overriding procedure Rows_About_To_Be_Removed
    (Self   : not null access Pie_View;
     Parent : Qt4.Model_Indices.Q_Model_Index;
     Start  : Qt4.Q_Integer;
     Stop   : Qt4.Q_Integer);

   overriding procedure Rows_Inserted
    (Self   : not null access Pie_View;
     Parent : Qt4.Model_Indices.Q_Model_Index;
     Start  : Qt4.Q_Integer;
     Stop   : Qt4.Q_Integer);

   function Item_Rect
    (Self  : not null access constant Pie_View'Class;
     Index : Qt4.Model_Indices.Q_Model_Index)
       return Qt4.Rects.Q_Rect;

   function Item_Region
    (Self  : not null access Pie_View'Class;
     Index : Qt4.Model_Indices.Q_Model_Index)
       return Qt4.Regions.Q_Region;

   function Rows
    (Self  : not null access Pie_View'Class;
     Index : Qt4.Model_Indices.Q_Model_Index)
       return Qt4.Q_Integer;

   procedure Update_Geometries (Self : not null access Pie_View'Class);

end Pie_Views;
