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.File_Chooser_Widget.Gtk_File_Chooser_Widget is a widget suitable for 
  26. --  selecting files. It is the main building block of a 
  27. --  Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog. Most applications will 
  28. --  only need to use the latter; you can use 
  29. --  Gtk.File_Chooser_Widget.Gtk_File_Chooser_Widget as part of a larger window 
  30. --  if you have special needs. 
  31. -- 
  32. --  Note that Gtk.File_Chooser_Widget.Gtk_File_Chooser_Widget does not have 
  33. --  any methods of its own. Instead, you should use the functions that work on 
  34. --  a Gtk.File_Chooser.Gtk_File_Chooser. 
  35. -- 
  36. --  </description> 
  37. pragma Ada_2005; 
  38.  
  39. pragma Warnings (Off, "*is already use-visible*"); 
  40. with Glib;             use Glib; 
  41. with Glib.Object;      use Glib.Object; 
  42. with Glib.Types;       use Glib.Types; 
  43. with Gtk.Box;          use Gtk.Box; 
  44. with Gtk.Buildable;    use Gtk.Buildable; 
  45. with Gtk.Enums;        use Gtk.Enums; 
  46. with Gtk.File_Chooser; use Gtk.File_Chooser; 
  47. with Gtk.File_Filter;  use Gtk.File_Filter; 
  48. with Gtk.Orientable;   use Gtk.Orientable; 
  49. with Gtk.Widget;       use Gtk.Widget; 
  50.  
  51. package Gtk.File_Chooser_Widget is 
  52.  
  53.    type Gtk_File_Chooser_Widget_Record is new Gtk_Box_Record with null record; 
  54.    type Gtk_File_Chooser_Widget is access all Gtk_File_Chooser_Widget_Record'Class; 
  55.  
  56.    ------------------ 
  57.    -- Constructors -- 
  58.    ------------------ 
  59.  
  60.    procedure Gtk_New 
  61.       (Self   : out Gtk_File_Chooser_Widget; 
  62.        Action : Gtk.File_Chooser.Gtk_File_Chooser_Action); 
  63.    procedure Initialize 
  64.       (Self   : not null access Gtk_File_Chooser_Widget_Record'Class; 
  65.        Action : Gtk.File_Chooser.Gtk_File_Chooser_Action); 
  66.    --  Creates a new Gtk.File_Chooser_Widget.Gtk_File_Chooser_Widget. This is 
  67.    --  a file chooser widget that can be embedded in custom windows, and it is 
  68.    --  the same widget that is used by 
  69.    --  Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog. 
  70.    --  Since: gtk+ 2.4 
  71.    --  "action": Open or save mode for the widget 
  72.  
  73.    function Gtk_File_Chooser_Widget_New 
  74.       (Action : Gtk.File_Chooser.Gtk_File_Chooser_Action) 
  75.        return Gtk_File_Chooser_Widget; 
  76.    --  Creates a new Gtk.File_Chooser_Widget.Gtk_File_Chooser_Widget. This is 
  77.    --  a file chooser widget that can be embedded in custom windows, and it is 
  78.    --  the same widget that is used by 
  79.    --  Gtk.File_Chooser_Dialog.Gtk_File_Chooser_Dialog. 
  80.    --  Since: gtk+ 2.4 
  81.    --  "action": Open or save mode for the widget 
  82.  
  83.    function Get_Type return Glib.GType; 
  84.    pragma Import (C, Get_Type, "gtk_file_chooser_widget_get_type"); 
  85.  
  86.    --------------------------------------------- 
  87.    -- Inherited subprograms (from interfaces) -- 
  88.    --------------------------------------------- 
  89.    --  Methods inherited from the Buildable interface are not duplicated here 
  90.    --  since they are meant to be used by tools, mostly. If you need to call 
  91.    --  them, use an explicit cast through the "-" operator below. 
  92.  
  93.    procedure Add_Filter 
  94.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  95.        Filter  : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class); 
  96.  
  97.    function Add_Shortcut_Folder 
  98.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  99.        Folder  : UTF8_String) return Boolean; 
  100.  
  101.    function Add_Shortcut_Folder_Uri 
  102.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  103.        URI     : UTF8_String) return Boolean; 
  104.  
  105.    function Get_Action 
  106.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  107.        return Gtk.File_Chooser.Gtk_File_Chooser_Action; 
  108.  
  109.    procedure Set_Action 
  110.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  111.        Action  : Gtk.File_Chooser.Gtk_File_Chooser_Action); 
  112.  
  113.    function Get_Create_Folders 
  114.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  115.        return Boolean; 
  116.  
  117.    procedure Set_Create_Folders 
  118.       (Chooser        : not null access Gtk_File_Chooser_Widget_Record; 
  119.        Create_Folders : Boolean); 
  120.  
  121.    function Get_Current_Folder 
  122.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  123.        return UTF8_String; 
  124.  
  125.    function Set_Current_Folder 
  126.       (Chooser  : not null access Gtk_File_Chooser_Widget_Record; 
  127.        Filename : UTF8_String) return Boolean; 
  128.  
  129.    function Get_Current_Folder_Uri 
  130.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  131.        return UTF8_String; 
  132.  
  133.    function Set_Current_Folder_Uri 
  134.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  135.        URI     : UTF8_String) return Boolean; 
  136.  
  137.    function Get_Do_Overwrite_Confirmation 
  138.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  139.        return Boolean; 
  140.  
  141.    procedure Set_Do_Overwrite_Confirmation 
  142.       (Chooser                   : not null access Gtk_File_Chooser_Widget_Record; 
  143.        Do_Overwrite_Confirmation : Boolean); 
  144.  
  145.    function Get_Extra_Widget 
  146.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  147.        return Gtk.Widget.Gtk_Widget; 
  148.  
  149.    procedure Set_Extra_Widget 
  150.       (Chooser      : not null access Gtk_File_Chooser_Widget_Record; 
  151.        Extra_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  152.  
  153.    function Get_Filename 
  154.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  155.        return UTF8_String; 
  156.  
  157.    function Set_Filename 
  158.       (Chooser  : not null access Gtk_File_Chooser_Widget_Record; 
  159.        Filename : UTF8_String) return Boolean; 
  160.  
  161.    function Get_Filenames 
  162.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  163.        return Gtk.Enums.String_SList.GSlist; 
  164.  
  165.    function Get_Filter 
  166.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  167.        return Gtk.File_Filter.Gtk_File_Filter; 
  168.  
  169.    procedure Set_Filter 
  170.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  171.        Filter  : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class); 
  172.  
  173.    function Get_Local_Only 
  174.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  175.        return Boolean; 
  176.  
  177.    procedure Set_Local_Only 
  178.       (Chooser    : not null access Gtk_File_Chooser_Widget_Record; 
  179.        Local_Only : Boolean); 
  180.  
  181.    function Get_Preview_Filename 
  182.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  183.        return UTF8_String; 
  184.  
  185.    function Get_Preview_Uri 
  186.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  187.        return UTF8_String; 
  188.  
  189.    function Get_Preview_Widget 
  190.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  191.        return Gtk.Widget.Gtk_Widget; 
  192.  
  193.    procedure Set_Preview_Widget 
  194.       (Chooser        : not null access Gtk_File_Chooser_Widget_Record; 
  195.        Preview_Widget : not null access Gtk.Widget.Gtk_Widget_Record'Class); 
  196.  
  197.    function Get_Preview_Widget_Active 
  198.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  199.        return Boolean; 
  200.  
  201.    procedure Set_Preview_Widget_Active 
  202.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  203.        Active  : Boolean); 
  204.  
  205.    function Get_Select_Multiple 
  206.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  207.        return Boolean; 
  208.  
  209.    procedure Set_Select_Multiple 
  210.       (Chooser         : not null access Gtk_File_Chooser_Widget_Record; 
  211.        Select_Multiple : Boolean); 
  212.  
  213.    function Get_Show_Hidden 
  214.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  215.        return Boolean; 
  216.  
  217.    procedure Set_Show_Hidden 
  218.       (Chooser     : not null access Gtk_File_Chooser_Widget_Record; 
  219.        Show_Hidden : Boolean); 
  220.  
  221.    function Get_Uri 
  222.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  223.        return UTF8_String; 
  224.  
  225.    function Set_Uri 
  226.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  227.        URI     : UTF8_String) return Boolean; 
  228.  
  229.    function Get_Uris 
  230.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  231.        return Gtk.Enums.String_SList.GSlist; 
  232.  
  233.    function Get_Use_Preview_Label 
  234.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  235.        return Boolean; 
  236.  
  237.    procedure Set_Use_Preview_Label 
  238.       (Chooser   : not null access Gtk_File_Chooser_Widget_Record; 
  239.        Use_Label : Boolean); 
  240.  
  241.    function List_Filters 
  242.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  243.        return Glib.Object.Object_List.GSlist; 
  244.  
  245.    function List_Shortcut_Folder_Uris 
  246.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  247.        return Gtk.Enums.String_SList.GSlist; 
  248.  
  249.    function List_Shortcut_Folders 
  250.       (Chooser : not null access Gtk_File_Chooser_Widget_Record) 
  251.        return Gtk.Enums.String_SList.GSlist; 
  252.  
  253.    procedure Remove_Filter 
  254.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  255.        Filter  : not null access Gtk.File_Filter.Gtk_File_Filter_Record'Class); 
  256.  
  257.    function Remove_Shortcut_Folder 
  258.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  259.        Folder  : UTF8_String) return Boolean; 
  260.  
  261.    function Remove_Shortcut_Folder_Uri 
  262.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  263.        URI     : UTF8_String) return Boolean; 
  264.  
  265.    procedure Select_All 
  266.       (Chooser : not null access Gtk_File_Chooser_Widget_Record); 
  267.  
  268.    function Select_Filename 
  269.       (Chooser  : not null access Gtk_File_Chooser_Widget_Record; 
  270.        Filename : UTF8_String) return Boolean; 
  271.  
  272.    function Select_Uri 
  273.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  274.        URI     : UTF8_String) return Boolean; 
  275.  
  276.    procedure Set_Current_Name 
  277.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  278.        Name    : UTF8_String); 
  279.  
  280.    procedure Unselect_All 
  281.       (Chooser : not null access Gtk_File_Chooser_Widget_Record); 
  282.  
  283.    procedure Unselect_Filename 
  284.       (Chooser  : not null access Gtk_File_Chooser_Widget_Record; 
  285.        Filename : UTF8_String); 
  286.  
  287.    procedure Unselect_Uri 
  288.       (Chooser : not null access Gtk_File_Chooser_Widget_Record; 
  289.        URI     : UTF8_String); 
  290.  
  291.    function Get_Orientation 
  292.       (Self : not null access Gtk_File_Chooser_Widget_Record) 
  293.        return Gtk.Enums.Gtk_Orientation; 
  294.  
  295.    procedure Set_Orientation 
  296.       (Self        : not null access Gtk_File_Chooser_Widget_Record; 
  297.        Orientation : Gtk.Enums.Gtk_Orientation); 
  298.  
  299.    ---------------- 
  300.    -- Interfaces -- 
  301.    ---------------- 
  302.    --  This class implements several interfaces. See Glib.Types 
  303.    -- 
  304.    --  - "Buildable" 
  305.    -- 
  306.    --  - "FileChooser" 
  307.    -- 
  308.    --  - "Orientable" 
  309.  
  310.    package Implements_Gtk_Buildable is new Glib.Types.Implements 
  311.      (Gtk.Buildable.Gtk_Buildable, Gtk_File_Chooser_Widget_Record, Gtk_File_Chooser_Widget); 
  312.    function "+" 
  313.      (Widget : access Gtk_File_Chooser_Widget_Record'Class) 
  314.    return Gtk.Buildable.Gtk_Buildable 
  315.    renames Implements_Gtk_Buildable.To_Interface; 
  316.    function "-" 
  317.      (Interf : Gtk.Buildable.Gtk_Buildable) 
  318.    return Gtk_File_Chooser_Widget 
  319.    renames Implements_Gtk_Buildable.To_Object; 
  320.  
  321.    package Implements_Gtk_File_Chooser is new Glib.Types.Implements 
  322.      (Gtk.File_Chooser.Gtk_File_Chooser, Gtk_File_Chooser_Widget_Record, Gtk_File_Chooser_Widget); 
  323.    function "+" 
  324.      (Widget : access Gtk_File_Chooser_Widget_Record'Class) 
  325.    return Gtk.File_Chooser.Gtk_File_Chooser 
  326.    renames Implements_Gtk_File_Chooser.To_Interface; 
  327.    function "-" 
  328.      (Interf : Gtk.File_Chooser.Gtk_File_Chooser) 
  329.    return Gtk_File_Chooser_Widget 
  330.    renames Implements_Gtk_File_Chooser.To_Object; 
  331.  
  332.    package Implements_Gtk_Orientable is new Glib.Types.Implements 
  333.      (Gtk.Orientable.Gtk_Orientable, Gtk_File_Chooser_Widget_Record, Gtk_File_Chooser_Widget); 
  334.    function "+" 
  335.      (Widget : access Gtk_File_Chooser_Widget_Record'Class) 
  336.    return Gtk.Orientable.Gtk_Orientable 
  337.    renames Implements_Gtk_Orientable.To_Interface; 
  338.    function "-" 
  339.      (Interf : Gtk.Orientable.Gtk_Orientable) 
  340.    return Gtk_File_Chooser_Widget 
  341.    renames Implements_Gtk_Orientable.To_Object; 
  342.  
  343. end Gtk.File_Chooser_Widget;