Class CssSection

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class CssSection extends ProxyInstance

Defines a part of a CSS document.

Because sections are nested into one another, you can use getParent() to get the containing region.

  • Constructor Details

    • CssSection

      public CssSection(MemorySegment address)
      Create a CssSection proxy instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • CssSection

      public CssSection(@Nullable File file, CssLocation start, CssLocation end)
      Creates a new GtkCssSection referring to the section in the given file from the start location to the end location.
      Parameters:
      file - The file this section refers to
      start - The start location
      end - The end location
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the CssSection class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • withBytes

      public static CssSection withBytes(@Nullable File file, byte @Nullable [] bytes, CssLocation start, CssLocation end)
      Creates a new GtkCssSection referring to the section in the given file or the given bytes from the start location to the end location.
      Parameters:
      file - The file this section refers to
      bytes - The bytes this sections refers to
      start - The start location
      end - The end location
      Returns:
      a new GtkCssSection
      Since:
      4.16
    • getBytes

      public byte @Nullable [] getBytes()
      Gets the bytes that this CssSection was parsed from.
      Returns:
      the GBytes from which the section was parsed
      Since:
      4.16
    • getEndLocation

      public CssLocation getEndLocation()
      Returns the location in the CSS document where this section ends.
      Returns:
      The end location of this section
    • getFile

      public @Nullable File getFile()

      Gets the file that this CssSection was parsed from.

      If no such file exists, for example because the CSS was loaded via CssProvider.loadFromData(String, long), then NULL is returned.

      Returns:
      the GFile from which the section was parsed
    • getParent

      public @Nullable CssSection getParent()

      Gets the parent section for the given section.

      The parent section is the section that contains this section. A special case are sections of type GTK_CSS_SECTION_DOCUMENT. Their parent will either be NULL if they are the original CSS document that was loaded by CssProvider.loadFromFile(File) or a section of type GTK_CSS_SECTION_IMPORT if it was loaded with an @import rule from a different file.

      Returns:
      the parent section
    • getStartLocation

      public CssLocation getStartLocation()
      Returns the location in the CSS document where this section starts.
      Returns:
      The start location of this section
    • print

      public void print(String string)

      Prints the section into string in a human-readable form.

      This is a form like gtk.css:32:1-23 to denote line 32, characters 1 to 23 in the file gtk.css.

      Parameters:
      string - a GString to print to
    • ref

      public CssSection ref()
      Increments the reference count on section.
      Returns:
      the CSS section itself.
    • toString

      public String toString()
      Prints the section into a human-readable text form using print(String).
      Overrides:
      toString in class Object
      Returns:
      A new string.
    • unref

      public void unref()
      Decrements the reference count on section, freeing the structure if the reference count reaches 0.