1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --   Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet   -- 
  5. --                Copyright (C) 2000-2013, AdaCore                   -- 
  6. --                                                                   -- 
  7. -- This library is free software; you can redistribute it and/or     -- 
  8. -- modify it under the terms of the GNU General Public               -- 
  9. -- License as published by the Free Software Foundation; either      -- 
  10. -- version 2 of the License, or (at your option) any later version.  -- 
  11. --                                                                   -- 
  12. -- This library is distributed in the hope that it will be useful,   -- 
  13. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  14. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  15. -- General Public License for more details.                          -- 
  16. --                                                                   -- 
  17. -- You should have received a copy of the GNU General Public         -- 
  18. -- License along with this library; if not, write to the             -- 
  19. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  20. -- Boston, MA 02111-1307, USA.                                       -- 
  21. --                                                                   -- 
  22. -- As a special exception, if other files instantiate generics from  -- 
  23. -- this unit, or you link this unit with other files to produce an   -- 
  24. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  25. -- executable to be covered by the GNU General Public License. This  -- 
  26. -- exception does not however invalidate any other reasons why the   -- 
  27. -- executable file  might be covered by the  GNU Public License.     -- 
  28. ----------------------------------------------------------------------- 
  29.  
  30. --  <description> 
  31. -- 
  32. -- 
  33. --  </description> 
  34. --  <group>Obsolescent widgets</group> 
  35. --  <testgtk>create_list.adb</testgtk> 
  36.  
  37. pragma Warnings (Off, "*is already use-visible*"); 
  38. with Glib;          use Glib; 
  39. with Glib.Types;    use Glib.Types; 
  40. with Gtk.Buildable; use Gtk.Buildable; 
  41. with Gtk.Container; use Gtk.Container; 
  42. with Gtk.Enums;     use Gtk.Enums; 
  43. with Gtk.Widget;    use Gtk.Widget; 
  44.  
  45. package Gtk.List is 
  46.  
  47.    pragma Obsolescent; 
  48.  
  49.    type Gtk_List_Record is new Gtk_Container_Record with null record; 
  50.    type Gtk_List is access all Gtk_List_Record'Class; 
  51.  
  52.    ------------------ 
  53.    -- Constructors -- 
  54.    ------------------ 
  55.  
  56.    procedure Gtk_New (List : out Gtk_List); 
  57.    procedure Initialize (List : access Gtk_List_Record'Class); 
  58.  
  59.    function Get_Type return Glib.GType; 
  60.    pragma Import (C, Get_Type, "gtk_list_get_type"); 
  61.  
  62.    ------------- 
  63.    -- Methods -- 
  64.    ------------- 
  65.  
  66.    procedure Append_Items 
  67.       (List  : access Gtk_List_Record; 
  68.        Items : Gtk.Widget.Widget_List.Glist); 
  69.  
  70.    function Child_Position 
  71.       (List  : access Gtk_List_Record; 
  72.        Child : access Gtk.Widget.Gtk_Widget_Record'Class) return Gint; 
  73.  
  74.    procedure Clear_Items 
  75.       (List    : access Gtk_List_Record; 
  76.        Start   : Gint; 
  77.        The_End : Gint); 
  78.    --  Remove some items from the list. If The_End is negative, it means the 
  79.    --  end of the list. The first item in the list has an index of 0 
  80.  
  81.    procedure End_Drag_Selection (List : access Gtk_List_Record); 
  82.  
  83.    procedure End_Selection (List : access Gtk_List_Record); 
  84.  
  85.    procedure Extend_Selection 
  86.       (List                 : access Gtk_List_Record; 
  87.        Scroll_Type          : Gtk.Enums.Gtk_Scroll_Type; 
  88.        Position             : Gfloat; 
  89.        Auto_Start_Selection : Boolean); 
  90.  
  91.    procedure Insert_Items 
  92.       (List     : access Gtk_List_Record; 
  93.        Items    : Gtk.Widget.Widget_List.Glist; 
  94.        Position : Gint); 
  95.  
  96.    procedure Prepend_Items 
  97.       (List  : access Gtk_List_Record; 
  98.        Items : Gtk.Widget.Widget_List.Glist); 
  99.  
  100.    procedure Remove_Items 
  101.       (List  : access Gtk_List_Record; 
  102.        Items : Gtk.Widget.Widget_List.Glist); 
  103.  
  104.    procedure Remove_Items_No_Unref 
  105.       (List  : access Gtk_List_Record; 
  106.        Items : Gtk.Widget.Widget_List.Glist); 
  107.  
  108.    procedure Scroll_Horizontal 
  109.       (List        : access Gtk_List_Record; 
  110.        Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  111.        Position    : Gfloat); 
  112.  
  113.    procedure Scroll_Vertical 
  114.       (List        : access Gtk_List_Record; 
  115.        Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  116.        Position    : Gfloat); 
  117.  
  118.    procedure Select_All (List : access Gtk_List_Record); 
  119.  
  120.    procedure Select_Child 
  121.       (List  : access Gtk_List_Record; 
  122.        Child : access Gtk.Widget.Gtk_Widget_Record'Class); 
  123.  
  124.    procedure Select_Item (List : access Gtk_List_Record; Item : Gint); 
  125.  
  126.    procedure Set_Selection_Mode 
  127.       (List : access Gtk_List_Record; 
  128.        Mode : Gtk.Enums.Gtk_Selection_Mode); 
  129.  
  130.    procedure Start_Selection (List : access Gtk_List_Record); 
  131.  
  132.    procedure Toggle_Add_Mode (List : access Gtk_List_Record); 
  133.  
  134.    procedure Toggle_Focus_Row (List : access Gtk_List_Record); 
  135.  
  136.    procedure Toggle_Row 
  137.       (List : access Gtk_List_Record; 
  138.        Item : access Gtk.Widget.Gtk_Widget_Record'Class); 
  139.  
  140.    procedure Undo_Selection (List : access Gtk_List_Record); 
  141.  
  142.    procedure Unselect_All (List : access Gtk_List_Record); 
  143.  
  144.    procedure Unselect_Child 
  145.       (List  : access Gtk_List_Record; 
  146.        Child : access Gtk.Widget.Gtk_Widget_Record'Class); 
  147.  
  148.    procedure Unselect_Item (List : access Gtk_List_Record; Item : Gint); 
  149.  
  150.    ---------------------- 
  151.    -- GtkAda additions -- 
  152.    ---------------------- 
  153.  
  154.    function Get_Selection (Widget : access Gtk.List.Gtk_List_Record) 
  155.    return Widget_List.Glist; 
  156.  
  157.    ---------------- 
  158.    -- Interfaces -- 
  159.    ---------------- 
  160.    --  This class implements several interfaces. See Glib.Types 
  161.    -- 
  162.    --  - "Buildable" 
  163.  
  164.    package Implements_Buildable is new Glib.Types.Implements 
  165.      (Gtk.Buildable.Gtk_Buildable, Gtk_List_Record, Gtk_List); 
  166.    function "+" 
  167.      (Widget : access Gtk_List_Record'Class) 
  168.    return Gtk.Buildable.Gtk_Buildable 
  169.    renames Implements_Buildable.To_Interface; 
  170.    function "-" 
  171.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  172.    return Gtk_List 
  173.    renames Implements_Buildable.To_Object; 
  174.  
  175.    ---------------- 
  176.    -- Properties -- 
  177.    ---------------- 
  178.    --  The following properties are defined for this widget. See 
  179.    --  Glib.Properties for more information on properties) 
  180.    -- 
  181.    --  Name: Selection_Mode_Property 
  182.    --  Type: Gtk.Enums.Gtk_Selection_Mode 
  183.    --  Flags: read-write 
  184.  
  185.    Selection_Mode_Property : constant Gtk.Enums.Property_Gtk_Selection_Mode; 
  186.  
  187.    ------------- 
  188.    -- Signals -- 
  189.    ------------- 
  190.    --  The following new signals are defined for this widget: 
  191.    -- 
  192.    --  "select-child" 
  193.    --     procedure Handler 
  194.    --       (Self   : access Gtk_List_Record'Class; 
  195.    --        Object : Gtk.Widget.Gtk_Widget); 
  196.    -- 
  197.    --  "selection-changed" 
  198.    --     procedure Handler (Self : access Gtk_List_Record'Class); 
  199.    -- 
  200.    --  "unselect-child" 
  201.    --     procedure Handler 
  202.    --       (Self   : access Gtk_List_Record'Class; 
  203.    --        Object : Gtk.Widget.Gtk_Widget); 
  204.  
  205.    Signal_Select_Child : constant Glib.Signal_Name := "select-child"; 
  206.    Signal_Selection_Changed : constant Glib.Signal_Name := "selection-changed"; 
  207.    Signal_Unselect_Child : constant Glib.Signal_Name := "unselect-child"; 
  208.  
  209. private 
  210.    Selection_Mode_Property : constant Gtk.Enums.Property_Gtk_Selection_Mode := 
  211.      Gtk.Enums.Build ("selection-mode"); 
  212. end Gtk.List;