1. ------------------------------------------------------------------------------ 
  2. --                  GtkAda - Ada95 binding for Gtk+/Gnome                   -- 
  3. --                                                                          -- 
  4. --                       Copyright (C) 2013-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. --  This object adds support for opening files from OS commands, using the 
  26. --  standard Glib Application mechanism for opening those files. 
  27. -- 
  28. --  This requires some support that is system-specific: 
  29. -- 
  30. --  On windows, this registers a DDE server using the application's Id as name. 
  31. --  So for example com.adacore.TestGtk will register a DDE server whose name 
  32. --  is TestGtk. 
  33. -- 
  34. --  On OSX, this requires the application to be part of a bundle. This bundle 
  35. --  needs to declare the file patterns that are supported by the application. 
  36. --  </description> 
  37. --  <group>Layout containers</group> 
  38.  
  39. with System; 
  40.  
  41. with Glib;             use Glib; 
  42. with Glib.Application; 
  43.  
  44. with Gtk.Application;  use Gtk.Application; 
  45.  
  46. package Gtkada.Application is 
  47.  
  48.    type Gtkada_Application_Record is new Gtk_Application_Record 
  49.      with private; 
  50.    type Gtkada_Application is access all Gtkada_Application_Record'Class; 
  51.  
  52.    type Gtkada_Application_Flags is mod 2 ** Integer'Size; 
  53.    pragma Convention (C, Gtkada_Application_Flags); 
  54.    --  Flags used to define the behaviour of a Glib.Application.Gapplication. 
  55.  
  56.    Gtkada_Application_Flags_None     : constant Gtkada_Application_Flags := 0; 
  57.    Gtkada_Application_Handles_Open   : constant Gtkada_Application_Flags := 1; 
  58.    Gtkada_Application_OSX_FullScreen : constant Gtkada_Application_Flags := 2; 
  59.  
  60.    procedure Gtk_New 
  61.       (Self           : out Gtkada_Application; 
  62.        Application_Id : UTF8_String := ""; 
  63.        Flags          : Glib.Application.GApplication_Flags; 
  64.        Gtkada_Flags   : Gtkada_Application_Flags); 
  65.    procedure Initialize 
  66.       (Self           : not null access Gtkada_Application_Record'Class; 
  67.        Application_Id : UTF8_String := ""; 
  68.        Flags          : Glib.Application.GApplication_Flags; 
  69.        Gtkada_Flags   : Gtkada_Application_Flags); 
  70.    function Gtk_Application_New 
  71.       (Application_Id : UTF8_String := ""; 
  72.        Flags          : Glib.Application.GApplication_Flags; 
  73.        Gtkada_Flags   : Gtkada_Application_Flags) 
  74.        return Gtkada_Application; 
  75.  
  76.    type GFile is private; 
  77.    type GFile_Array is array (Positive range <>) of GFile; 
  78.  
  79.    function Get_Path (File : GFile) return UTF8_String; 
  80.  
  81.    type Cb_Gtkada_Application_Files is access procedure 
  82.      (Application : Gtkada_Application; 
  83.       Files       : GFile_Array); 
  84.  
  85.    procedure On_Open 
  86.      (Self      : not null access Gtkada_Application_Record; 
  87.       Call      : Cb_Gtkada_Application_Files); 
  88. private 
  89.  
  90.    type Gtkada_Application_Record is new Gtk_Application_Record 
  91.      with null record; 
  92.  
  93.    type GFile is new System.Address; 
  94.  
  95.    pragma Convention (C, GFile_Array); 
  96.  
  97. end Gtkada.Application;