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-2011, 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. -- -- -- -- -- -- -- -- -- -- -- --
  23. ----------------------------------------------------------------------- 
  24.  
  25. --  <description> 
  26. -- 
  27. -- 
  28. --  </description> 
  29. --  <group>Obsolescent widgets</group> 
  30. --  <testgtk>create_list.adb</testgtk> 
  31.  
  32. pragma Warnings (Off, "*is already use-visible*"); 
  33. with Glib;          use Glib; 
  34. with Glib.Types;    use Glib.Types; 
  35. with Gtk.Buildable; use Gtk.Buildable; 
  36. with Gtk.Container; use Gtk.Container; 
  37. with Gtk.Enums;     use Gtk.Enums; 
  38. with Gtk.Widget;    use Gtk.Widget; 
  39.  
  40. package Gtk.List is 
  41.  
  42.    pragma Obsolescent; 
  43.  
  44.    type Gtk_List_Record is new Gtk_Container_Record with null record; 
  45.    type Gtk_List is access all Gtk_List_Record'Class; 
  46.  
  47.    ------------------ 
  48.    -- Constructors -- 
  49.    ------------------ 
  50.  
  51.    procedure Gtk_New (List : out Gtk_List); 
  52.    procedure Initialize (List : access Gtk_List_Record'Class); 
  53.  
  54.    function Get_Type return Glib.GType; 
  55.    pragma Import (C, Get_Type, "gtk_list_get_type"); 
  56.  
  57.    ------------- 
  58.    -- Methods -- 
  59.    ------------- 
  60.  
  61.    procedure Append_Items 
  62.       (List  : access Gtk_List_Record; 
  63.        Items : Gtk.Widget.Widget_List.GList); 
  64.  
  65.    function Child_Position 
  66.       (List  : access Gtk_List_Record; 
  67.        Child : access Gtk.Widget.Gtk_Widget_Record'Class) return Gint; 
  68.  
  69.    procedure Clear_Items 
  70.       (List    : access Gtk_List_Record; 
  71.        Start   : Gint; 
  72.        The_End : Gint); 
  73.    --  Remove some items from the list. If The_End is negative, it means the 
  74.    --  end of the list. The first item in the list has an index of 0 
  75.  
  76.    procedure End_Drag_Selection (List : access Gtk_List_Record); 
  77.  
  78.    procedure End_Selection (List : access Gtk_List_Record); 
  79.  
  80.    procedure Extend_Selection 
  81.       (List                 : access Gtk_List_Record; 
  82.        Scroll_Type          : Gtk.Enums.Gtk_Scroll_Type; 
  83.        Position             : Gfloat; 
  84.        Auto_Start_Selection : Boolean); 
  85.  
  86.    procedure Insert_Items 
  87.       (List     : access Gtk_List_Record; 
  88.        Items    : Gtk.Widget.Widget_List.GList; 
  89.        Position : Gint); 
  90.  
  91.    procedure Prepend_Items 
  92.       (List  : access Gtk_List_Record; 
  93.        Items : Gtk.Widget.Widget_List.GList); 
  94.  
  95.    procedure Remove_Items 
  96.       (List  : access Gtk_List_Record; 
  97.        Items : Gtk.Widget.Widget_List.GList); 
  98.  
  99.    procedure Remove_Items_No_Unref 
  100.       (List  : access Gtk_List_Record; 
  101.        Items : Gtk.Widget.Widget_List.GList); 
  102.  
  103.    procedure Scroll_Horizontal 
  104.       (List        : access Gtk_List_Record; 
  105.        Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  106.        Position    : Gfloat); 
  107.  
  108.    procedure Scroll_Vertical 
  109.       (List        : access Gtk_List_Record; 
  110.        Scroll_Type : Gtk.Enums.Gtk_Scroll_Type; 
  111.        Position    : Gfloat); 
  112.  
  113.    procedure Select_All (List : access Gtk_List_Record); 
  114.  
  115.    procedure Select_Child 
  116.       (List  : access Gtk_List_Record; 
  117.        Child : access Gtk.Widget.Gtk_Widget_Record'Class); 
  118.  
  119.    procedure Select_Item (List : access Gtk_List_Record; Item : Gint); 
  120.  
  121.    procedure Set_Selection_Mode 
  122.       (List : access Gtk_List_Record; 
  123.        Mode : Gtk.Enums.Gtk_Selection_Mode); 
  124.  
  125.    procedure Start_Selection (List : access Gtk_List_Record); 
  126.  
  127.    procedure Toggle_Add_Mode (List : access Gtk_List_Record); 
  128.  
  129.    procedure Toggle_Focus_Row (List : access Gtk_List_Record); 
  130.  
  131.    procedure Toggle_Row 
  132.       (List : access Gtk_List_Record; 
  133.        Item : access Gtk.Widget.Gtk_Widget_Record'Class); 
  134.  
  135.    procedure Undo_Selection (List : access Gtk_List_Record); 
  136.  
  137.    procedure Unselect_All (List : access Gtk_List_Record); 
  138.  
  139.    procedure Unselect_Child 
  140.       (List  : access Gtk_List_Record; 
  141.        Child : access Gtk.Widget.Gtk_Widget_Record'Class); 
  142.  
  143.    procedure Unselect_Item (List : access Gtk_List_Record; Item : Gint); 
  144.  
  145.    ---------------------- 
  146.    -- GtkAda additions -- 
  147.    ---------------------- 
  148.  
  149.    function Get_Selection (Widget : access Gtk.List.Gtk_List_Record) 
  150.    return Widget_List.Glist; 
  151.  
  152.    ---------------- 
  153.    -- Interfaces -- 
  154.    ---------------- 
  155.    --  This class implements several interfaces. See Glib.Types 
  156.    -- 
  157.    --  - "Buildable" 
  158.  
  159.    package Implements_Buildable is new Glib.Types.Implements 
  160.      (Gtk.Buildable.Gtk_Buildable, Gtk_List_Record, Gtk_List); 
  161.    function "+" 
  162.      (Widget : access Gtk_List_Record'Class) 
  163.    return Gtk.Buildable.Gtk_Buildable 
  164.    renames Implements_Buildable.To_Interface; 
  165.    function "-" 
  166.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  167.    return Gtk_List 
  168.    renames Implements_Buildable.To_Object; 
  169.  
  170.    ---------------- 
  171.    -- Properties -- 
  172.    ---------------- 
  173.    --  The following properties are defined for this widget. See 
  174.    --  Glib.Properties for more information on properties) 
  175.    -- 
  176.    --  Name: Selection_Mode_Property 
  177.    --  Type: Gtk.Enums.Gtk_Selection_Mode 
  178.    --  Flags: read-write 
  179.  
  180.    Selection_Mode_Property : constant Gtk.Enums.Property_Gtk_Selection_Mode; 
  181.  
  182.    ------------- 
  183.    -- Signals -- 
  184.    ------------- 
  185.    --  The following new signals are defined for this widget: 
  186.    -- 
  187.    --  "select-child" 
  188.    --     procedure Handler 
  189.    --       (Self   : access Gtk_List_Record'Class; 
  190.    --        Object : Gtk.Widget.Gtk_Widget); 
  191.    -- 
  192.    --  "selection-changed" 
  193.    --     procedure Handler (Self : access Gtk_List_Record'Class); 
  194.    -- 
  195.    --  "unselect-child" 
  196.    --     procedure Handler 
  197.    --       (Self   : access Gtk_List_Record'Class; 
  198.    --        Object : Gtk.Widget.Gtk_Widget); 
  199.  
  200.    Signal_Select_Child : constant Glib.Signal_Name := "select-child"; 
  201.    Signal_Selection_Changed : constant Glib.Signal_Name := "selection-changed"; 
  202.    Signal_Unselect_Child : constant Glib.Signal_Name := "unselect-child"; 
  203.  
  204. private 
  205.    Selection_Mode_Property : constant Gtk.Enums.Property_Gtk_Selection_Mode := 
  206.      Gtk.Enums.Build ("selection-mode"); 
  207. end Gtk.List;