1. ------------------------------------------------------------------------------ 
  2. --                                                                          -- 
  3. --      Copyright (C) 1998-2000 E. Briot, J. Brobecker and A. Charlet       -- 
  4. --                     Copyright (C) 2000-2014, AdaCore                     -- 
  5. --                                                                          -- 
  6. -- This library is free software;  you can redistribute it and/or modify it -- 
  7. -- under terms of the  GNU General Public License  as published by the Free -- 
  8. -- Software  Foundation;  either version 3,  or (at your  option) any later -- 
  9. -- version. This library is distributed in the hope that it will be useful, -- 
  10. -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- -- 
  11. -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE.                            -- 
  12. --                                                                          -- 
  13. -- As a special exception under Section 7 of GPL version 3, you are granted -- 
  14. -- additional permissions described in the GCC Runtime Library Exception,   -- 
  15. -- version 3.1, as published by the Free Software Foundation.               -- 
  16. --                                                                          -- 
  17. -- You should have received a copy of the GNU General Public License and    -- 
  18. -- a copy of the GCC Runtime Library Exception along with this program;     -- 
  19. -- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    -- 
  20. -- <http://www.gnu.org/licenses/>.                                          -- 
  21. --                                                                          -- 
  22. ------------------------------------------------------------------------------ 
  23.  
  24. --  <description> 
  25. --  Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget is a widget suitable 
  26. --  for selecting recently used files. It is the main building block of a 
  27. --  Gtk.Recent_Chooser_Dialog.Gtk_Recent_Chooser_Dialog. Most applications will 
  28. --  only need to use the latter; you can use 
  29. --  Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget as part of a larger 
  30. --  window if you have special needs. 
  31. -- 
  32. --  Note that Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget does not 
  33. --  have any methods of its own. Instead, you should use the functions that 
  34. --  work on a Gtk.Recent_Chooser.Gtk_Recent_Chooser. 
  35. -- 
  36. --  Recently used files are supported since GTK+ 2.10. 
  37. -- 
  38. --  </description> 
  39. pragma Ada_2005; 
  40.  
  41. pragma Warnings (Off, "*is already use-visible*"); 
  42. with Glib;               use Glib; 
  43. with Glib.Types;         use Glib.Types; 
  44. with Gtk.Box;            use Gtk.Box; 
  45. with Gtk.Buildable;      use Gtk.Buildable; 
  46. with Gtk.Enums;          use Gtk.Enums; 
  47. with Gtk.Orientable;     use Gtk.Orientable; 
  48. with Gtk.Recent_Chooser; use Gtk.Recent_Chooser; 
  49. with Gtk.Recent_Filter;  use Gtk.Recent_Filter; 
  50. with Gtk.Recent_Info;    use Gtk.Recent_Info; 
  51. with Gtk.Recent_Manager; use Gtk.Recent_Manager; 
  52.  
  53. package Gtk.Recent_Chooser_Widget is 
  54.  
  55.    type Gtk_Recent_Chooser_Widget_Record is new Gtk_Box_Record with null record; 
  56.    type Gtk_Recent_Chooser_Widget is access all Gtk_Recent_Chooser_Widget_Record'Class; 
  57.  
  58.    --------------- 
  59.    -- Callbacks -- 
  60.    --------------- 
  61.  
  62.    type Gtk_Recent_Sort_Func is access function 
  63.      (A : Gtk.Recent_Info.Gtk_Recent_Info; 
  64.       B : Gtk.Recent_Info.Gtk_Recent_Info) return Gint; 
  65.  
  66.    ------------------ 
  67.    -- Constructors -- 
  68.    ------------------ 
  69.  
  70.    procedure Gtk_New (Widget : out Gtk_Recent_Chooser_Widget); 
  71.    procedure Initialize 
  72.       (Widget : not null access Gtk_Recent_Chooser_Widget_Record'Class); 
  73.    --  Creates a new Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget 
  74.    --  object. This is an embeddable widget used to access the recently used 
  75.    --  resources list. 
  76.    --  Since: gtk+ 2.10 
  77.  
  78.    function Gtk_Recent_Chooser_Widget_New return Gtk_Recent_Chooser_Widget; 
  79.    --  Creates a new Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget 
  80.    --  object. This is an embeddable widget used to access the recently used 
  81.    --  resources list. 
  82.    --  Since: gtk+ 2.10 
  83.  
  84.    procedure Gtk_New_For_Manager 
  85.       (Widget  : out Gtk_Recent_Chooser_Widget; 
  86.        Manager : not null access Gtk.Recent_Manager.Gtk_Recent_Manager_Record'Class); 
  87.    procedure Initialize_For_Manager 
  88.       (Widget  : not null access Gtk_Recent_Chooser_Widget_Record'Class; 
  89.        Manager : not null access Gtk.Recent_Manager.Gtk_Recent_Manager_Record'Class); 
  90.    --  Creates a new Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget with 
  91.    --  a specified recent manager. 
  92.    --  This is useful if you have implemented your own recent manager, or if 
  93.    --  you have a customized instance of a 
  94.    --  Gtk.Recent_Manager.Gtk_Recent_Manager object. 
  95.    --  Since: gtk+ 2.10 
  96.    --  "manager": a Gtk.Recent_Manager.Gtk_Recent_Manager 
  97.  
  98.    function Gtk_Recent_Chooser_Widget_New_For_Manager 
  99.       (Manager : not null access Gtk.Recent_Manager.Gtk_Recent_Manager_Record'Class) 
  100.        return Gtk_Recent_Chooser_Widget; 
  101.    --  Creates a new Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget with 
  102.    --  a specified recent manager. 
  103.    --  This is useful if you have implemented your own recent manager, or if 
  104.    --  you have a customized instance of a 
  105.    --  Gtk.Recent_Manager.Gtk_Recent_Manager object. 
  106.    --  Since: gtk+ 2.10 
  107.    --  "manager": a Gtk.Recent_Manager.Gtk_Recent_Manager 
  108.  
  109.    function Get_Type return Glib.GType; 
  110.    pragma Import (C, Get_Type, "gtk_recent_chooser_widget_get_type"); 
  111.  
  112.    ------------- 
  113.    -- Methods -- 
  114.    ------------- 
  115.  
  116.    procedure Set_Sort_Func 
  117.       (Chooser      : not null access Gtk_Recent_Chooser_Widget_Record; 
  118.        Sort_Func    : Gtk_Recent_Sort_Func; 
  119.        Data_Destroy : Glib.G_Destroy_Notify_Address); 
  120.    --  Sets the comparison function used when sorting to be Sort_Func. If the 
  121.    --  Chooser has the sort type set to GTK_RECENT_SORT_CUSTOM then the chooser 
  122.    --  will sort using this function. 
  123.    --  To the comparison function will be passed two 
  124.    --  Gtk.Recent_Info.Gtk_Recent_Info structs and Sort_Data; Sort_Func should 
  125.    --  return a positive integer if the first item comes before the second, 
  126.    --  zero if the two items are equal and a negative integer if the first item 
  127.    --  comes after the second. 
  128.    --  Since: gtk+ 2.10 
  129.    --  "sort_func": the comparison function 
  130.    --  "data_destroy": destroy notifier for Sort_Data, or null 
  131.  
  132.    generic 
  133.       type User_Data_Type (<>) is private; 
  134.       with procedure Destroy (Data : in out User_Data_Type) is null; 
  135.    package Set_Sort_Func_User_Data is 
  136.  
  137.       type Gtk_Recent_Sort_Func is access function 
  138.         (A         : Gtk.Recent_Info.Gtk_Recent_Info; 
  139.          B         : Gtk.Recent_Info.Gtk_Recent_Info; 
  140.          User_Data : User_Data_Type) return Gint; 
  141.  
  142.       procedure Set_Sort_Func 
  143.          (Chooser      : not null access Gtk.Recent_Chooser_Widget.Gtk_Recent_Chooser_Widget_Record'Class; 
  144.           Sort_Func    : Gtk_Recent_Sort_Func; 
  145.           Sort_Data    : User_Data_Type; 
  146.           Data_Destroy : Glib.G_Destroy_Notify_Address); 
  147.       --  Sets the comparison function used when sorting to be Sort_Func. If 
  148.       --  the Chooser has the sort type set to GTK_RECENT_SORT_CUSTOM then the 
  149.       --  chooser will sort using this function. 
  150.       --  To the comparison function will be passed two 
  151.       --  Gtk.Recent_Info.Gtk_Recent_Info structs and Sort_Data; Sort_Func 
  152.       --  should return a positive integer if the first item comes before the 
  153.       --  second, zero if the two items are equal and a negative integer if the 
  154.       --  first item comes after the second. 
  155.       --  Since: gtk+ 2.10 
  156.       --  "sort_func": the comparison function 
  157.       --  "sort_data": user data to pass to Sort_Func, or null 
  158.       --  "data_destroy": destroy notifier for Sort_Data, or null 
  159.  
  160.    end Set_Sort_Func_User_Data; 
  161.  
  162.    --------------------------------------------- 
  163.    -- Inherited subprograms (from interfaces) -- 
  164.    --------------------------------------------- 
  165.    --  Methods inherited from the Buildable interface are not duplicated here 
  166.    --  since they are meant to be used by tools, mostly. If you need to call 
  167.    --  them, use an explicit cast through the "-" operator below. 
  168.  
  169.    function Get_Orientation 
  170.       (Self : not null access Gtk_Recent_Chooser_Widget_Record) 
  171.        return Gtk.Enums.Gtk_Orientation; 
  172.  
  173.    procedure Set_Orientation 
  174.       (Self        : not null access Gtk_Recent_Chooser_Widget_Record; 
  175.        Orientation : Gtk.Enums.Gtk_Orientation); 
  176.  
  177.    procedure Add_Filter 
  178.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  179.        Filter  : not null access Gtk.Recent_Filter.Gtk_Recent_Filter_Record'Class); 
  180.  
  181.    function Get_Current_Item 
  182.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  183.        return Gtk.Recent_Info.Gtk_Recent_Info; 
  184.  
  185.    function Get_Current_Uri 
  186.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  187.        return UTF8_String; 
  188.  
  189.    function Set_Current_Uri 
  190.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  191.        URI     : UTF8_String) return Boolean; 
  192.  
  193.    function Get_Filter 
  194.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  195.        return Gtk.Recent_Filter.Gtk_Recent_Filter; 
  196.  
  197.    procedure Set_Filter 
  198.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  199.        Filter  : not null access Gtk.Recent_Filter.Gtk_Recent_Filter_Record'Class); 
  200.  
  201.    function Get_Items 
  202.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  203.        return Gtk.Recent_Manager.Gtk_Recent_Info_List.Glist; 
  204.  
  205.    function Get_Limit 
  206.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  207.        return Gint; 
  208.  
  209.    procedure Set_Limit 
  210.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  211.        Limit   : Gint); 
  212.  
  213.    function Get_Local_Only 
  214.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  215.        return Boolean; 
  216.  
  217.    procedure Set_Local_Only 
  218.       (Chooser    : not null access Gtk_Recent_Chooser_Widget_Record; 
  219.        Local_Only : Boolean); 
  220.  
  221.    function Get_Select_Multiple 
  222.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  223.        return Boolean; 
  224.  
  225.    procedure Set_Select_Multiple 
  226.       (Chooser         : not null access Gtk_Recent_Chooser_Widget_Record; 
  227.        Select_Multiple : Boolean); 
  228.  
  229.    function Get_Show_Icons 
  230.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  231.        return Boolean; 
  232.  
  233.    procedure Set_Show_Icons 
  234.       (Chooser    : not null access Gtk_Recent_Chooser_Widget_Record; 
  235.        Show_Icons : Boolean); 
  236.  
  237.    function Get_Show_Not_Found 
  238.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  239.        return Boolean; 
  240.  
  241.    procedure Set_Show_Not_Found 
  242.       (Chooser        : not null access Gtk_Recent_Chooser_Widget_Record; 
  243.        Show_Not_Found : Boolean); 
  244.  
  245.    function Get_Show_Private 
  246.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  247.        return Boolean; 
  248.  
  249.    procedure Set_Show_Private 
  250.       (Chooser      : not null access Gtk_Recent_Chooser_Widget_Record; 
  251.        Show_Private : Boolean); 
  252.  
  253.    function Get_Show_Tips 
  254.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  255.        return Boolean; 
  256.  
  257.    procedure Set_Show_Tips 
  258.       (Chooser   : not null access Gtk_Recent_Chooser_Widget_Record; 
  259.        Show_Tips : Boolean); 
  260.  
  261.    function Get_Sort_Type 
  262.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  263.        return Gtk.Recent_Chooser.Gtk_Recent_Sort_Type; 
  264.  
  265.    procedure Set_Sort_Type 
  266.       (Chooser   : not null access Gtk_Recent_Chooser_Widget_Record; 
  267.        Sort_Type : Gtk.Recent_Chooser.Gtk_Recent_Sort_Type); 
  268.  
  269.    function List_Filters 
  270.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record) 
  271.        return Gtk.Recent_Filter.Gtk_Recent_Filter_List.GSlist; 
  272.  
  273.    procedure Remove_Filter 
  274.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  275.        Filter  : not null access Gtk.Recent_Filter.Gtk_Recent_Filter_Record'Class); 
  276.  
  277.    procedure Select_All 
  278.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record); 
  279.  
  280.    function Select_Uri 
  281.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  282.        URI     : UTF8_String) return Boolean; 
  283.  
  284.    procedure Unselect_All 
  285.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record); 
  286.  
  287.    procedure Unselect_Uri 
  288.       (Chooser : not null access Gtk_Recent_Chooser_Widget_Record; 
  289.        URI     : UTF8_String); 
  290.  
  291.    ---------------- 
  292.    -- Interfaces -- 
  293.    ---------------- 
  294.    --  This class implements several interfaces. See Glib.Types 
  295.    -- 
  296.    --  - "Buildable" 
  297.    -- 
  298.    --  - "Orientable" 
  299.    -- 
  300.    --  - "RecentChooser" 
  301.  
  302.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  303.      (Gtk.Buildable.Gtk_Buildable, Gtk_Recent_Chooser_Widget_Record, Gtk_Recent_Chooser_Widget); 
  304.    function "+" 
  305.      (Widget : access Gtk_Recent_Chooser_Widget_Record'Class) 
  306.    return Gtk.Buildable.Gtk_Buildable 
  307.    renames Implements_Gtk_Buildable.To_Interface; 
  308.    function "-" 
  309.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  310.    return Gtk_Recent_Chooser_Widget 
  311.    renames Implements_Gtk_Buildable.To_Object; 
  312.  
  313.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  314.      (Gtk.Orientable.Gtk_Orientable, Gtk_Recent_Chooser_Widget_Record, Gtk_Recent_Chooser_Widget); 
  315.    function "+" 
  316.      (Widget : access Gtk_Recent_Chooser_Widget_Record'Class) 
  317.    return Gtk.Orientable.Gtk_Orientable 
  318.    renames Implements_Gtk_Orientable.To_Interface; 
  319.    function "-" 
  320.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  321.    return Gtk_Recent_Chooser_Widget 
  322.    renames Implements_Gtk_Orientable.To_Object; 
  323.  
  324.    package Implements_Gtk_Recent_Chooser is new Glib.Types.Implements 
  325.      (Gtk.Recent_Chooser.Gtk_Recent_Chooser, Gtk_Recent_Chooser_Widget_Record, Gtk_Recent_Chooser_Widget); 
  326.    function "+" 
  327.      (Widget : access Gtk_Recent_Chooser_Widget_Record'Class) 
  328.    return Gtk.Recent_Chooser.Gtk_Recent_Chooser 
  329.    renames Implements_Gtk_Recent_Chooser.To_Interface; 
  330.    function "-" 
  331.      (Interf : Gtk.Recent_Chooser.Gtk_Recent_Chooser) 
  332.    return Gtk_Recent_Chooser_Widget 
  333.    renames Implements_Gtk_Recent_Chooser.To_Object; 
  334.  
  335. end Gtk.Recent_Chooser_Widget;