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. --  Defines a part of a CSS document. Because sections are nested into one 
  26. --  another, you can use Gtk.Css_Section.Get_Parent to get the containing 
  27. --  region. 
  28. -- 
  29. --  </description> 
  30. pragma Ada_2005; 
  31.  
  32. pragma Warnings (Off, "*is already use-visible*"); 
  33. with Glib;                    use Glib; 
  34. with Glib.Generic_Properties; use Glib.Generic_Properties; 
  35.  
  36. package Gtk.Css_Section is 
  37.  
  38.    type Gtk_Css_Section is new Glib.C_Boxed with null record; 
  39.    Null_Gtk_Css_Section : constant Gtk_Css_Section; 
  40.  
  41.    function From_Object (Object : System.Address) return Gtk_Css_Section; 
  42.    function From_Object_Free (B : access Gtk_Css_Section'Class) return Gtk_Css_Section; 
  43.    pragma Inline (From_Object_Free, From_Object); 
  44.  
  45.    type Gtk_Css_Section_Type is ( 
  46.       Css_Section_Document, 
  47.       Css_Section_Import, 
  48.       Css_Section_Color_Definition, 
  49.       Css_Section_Binding_Set, 
  50.       Css_Section_Ruleset, 
  51.       Css_Section_Selector, 
  52.       Css_Section_Declaration, 
  53.       Css_Section_Value, 
  54.       Css_Section_Keyframes); 
  55.    pragma Convention (C, Gtk_Css_Section_Type); 
  56.    --  The different types of sections indicate parts of a CSS document as 
  57.    --  parsed by GTK's CSS parser. They are oriented towards the CSS grammar 
  58.    --  <ulink url="http://www.w3.org/TR/CSS21/grammar.html">CSS 
  59.    --  grammer</ulink>, but may contain extensions. 
  60.    -- 
  61.    --  More types might be added in the future as the parser incorporates more 
  62.    --  features. 
  63.  
  64.    ---------------------------- 
  65.    -- Enumeration Properties -- 
  66.    ---------------------------- 
  67.  
  68.    package Gtk_Css_Section_Type_Properties is 
  69.       new Generic_Internal_Discrete_Property (Gtk_Css_Section_Type); 
  70.    type Property_Gtk_Css_Section_Type is new Gtk_Css_Section_Type_Properties.Property; 
  71.  
  72.    ------------------ 
  73.    -- Constructors -- 
  74.    ------------------ 
  75.  
  76.    function Get_Type return Glib.GType; 
  77.    pragma Import (C, Get_Type, "gtk_css_section_get_type"); 
  78.  
  79.    ------------- 
  80.    -- Methods -- 
  81.    ------------- 
  82.  
  83.    function Get_End_Line (Self : Gtk_Css_Section) return Guint; 
  84.    --  Returns the line in the CSS document where this section end. The line 
  85.    --  number is 0-indexed, so the first line of the document will return 0. 
  86.    --  This value may change in future invocations of this function if Section 
  87.    --  is not yet parsed completely. This will for example happen in the 
  88.    --  GtkCssProvider::parsing-error signal. The end position and line may be 
  89.    --  identical to the start position and line for sections which failed to 
  90.    --  parse anything successfully. 
  91.    --  Since: gtk+ 3.2 
  92.  
  93.    function Get_End_Position (Self : Gtk_Css_Section) return Guint; 
  94.    --  Returns the offset in bytes from the start of the current line returned 
  95.    --  via Gtk.Css_Section.Get_End_Line. This value may change in future 
  96.    --  invocations of this function if Section is not yet parsed completely. 
  97.    --  This will for example happen in the GtkCssProvider::parsing-error 
  98.    --  signal. The end position and line may be identical to the start position 
  99.    --  and line for sections which failed to parse anything successfully. 
  100.    --  Since: gtk+ 3.2 
  101.  
  102.    function Get_Parent (Self : Gtk_Css_Section) return Gtk_Css_Section; 
  103.    --  Gets the parent section for the given Section. The parent section is 
  104.    --  the section that contains this Section. A special case are sections of 
  105.    --  type GTK_CSS_SECTION_DOCUMENT. Their parent will either be null if they 
  106.    --  are the original CSS document that was loaded by 
  107.    --  gtk_css_provider_load_from_file or a section of type 
  108.    --  GTK_CSS_SECTION_IMPORT if it was loaded with an import rule from a 
  109.    --  different file. 
  110.    --  Since: gtk+ 3.2 
  111.  
  112.    function Get_Section_Type 
  113.       (Self : Gtk_Css_Section) return Gtk_Css_Section_Type; 
  114.    --  Gets the type of information that Section describes. 
  115.    --  Since: gtk+ 3.2 
  116.  
  117.    function Get_Start_Line (Self : Gtk_Css_Section) return Guint; 
  118.    --  Returns the line in the CSS document where this section starts. The 
  119.    --  line number is 0-indexed, so the first line of the document will return 
  120.    --  0. 
  121.    --  Since: gtk+ 3.2 
  122.  
  123.    function Get_Start_Position (Self : Gtk_Css_Section) return Guint; 
  124.    --  Returns the offset in bytes from the start of the current line returned 
  125.    --  via Gtk.Css_Section.Get_Start_Line. 
  126.    --  Since: gtk+ 3.2 
  127.  
  128.    function Ref (Self : Gtk_Css_Section) return Gtk_Css_Section; 
  129.    --  Increments the reference count on Section. 
  130.    --  Since: gtk+ 3.2 
  131.  
  132.    procedure Unref (Self : Gtk_Css_Section); 
  133.    --  Decrements the reference count on Section, freeing the structure if the 
  134.    --  reference count reaches 0. 
  135.    --  Since: gtk+ 3.2 
  136.  
  137. private 
  138.  
  139.    Null_Gtk_Css_Section : constant Gtk_Css_Section := (Glib.C_Boxed with null record); 
  140.  
  141. end Gtk.Css_Section;