Class SearchSettings

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class SearchSettings extends GObject

Search settings.

A GtkSourceSearchSettings object represents the settings of a search. The search settings can be associated with one or several SearchContexts.

  • Constructor Details

    • SearchSettings

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

      public SearchSettings()
      Create a new SearchSettings.
  • Method Details

    • getType

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

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

      protected SearchSettings asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class GObject
      Returns:
      the instance as if it were its parent type
    • getAtWordBoundaries

      public boolean getAtWordBoundaries()
    • getCaseSensitive

      public boolean getCaseSensitive()
    • getRegexEnabled

      public boolean getRegexEnabled()
    • getSearchText

      public @Nullable String getSearchText()

      Gets the text to search.

      The return value must not be freed.

      You may be interested to call GtkSource.utilsEscapeSearchText(String) after this function.

      Returns:
      the text to search, or null if the search is disabled.
    • getVisibleOnly

      public boolean getVisibleOnly()
    • getWrapAround

      public boolean getWrapAround()
    • setAtWordBoundaries

      public void setAtWordBoundaries(boolean atWordBoundaries)

      Change whether the search is done at word boundaries.

      If atWordBoundaries is true, a search match must start and end a word. The match can span multiple words. See also TextIter#startsWord and TextIter#endsWord.

      Parameters:
      atWordBoundaries - the setting.
    • setCaseSensitive

      public void setCaseSensitive(boolean caseSensitive)
      Enables or disables the case sensitivity for the search.
      Parameters:
      caseSensitive - the setting.
    • setRegexEnabled

      public void setRegexEnabled(boolean regexEnabled)

      Enables or disables whether to search by regular expressions.

      If enabled, the SearchSettings:search-text property contains the pattern of the regular expression.

      SearchContext uses GRegex when regex search is enabled. See the Regular expression syntax page in the GLib reference manual.

      Parameters:
      regexEnabled - the setting.
    • setSearchText

      public void setSearchText(@Nullable String searchText)

      Sets the text to search.

      If searchText is null or is empty, the search will be disabled. A copy of searchText will be made, so you can safely free searchText after a call to this function.

      You may be interested to call GtkSource.utilsUnescapeSearchText(String) before this function.

      Parameters:
      searchText - the nul-terminated text to search, or null to disable the search.
    • setVisibleOnly

      public void setVisibleOnly(boolean visibleOnly)

      Enables or disables whether to exclude invisible text from the search.

      If enabled, only visible text will be searched. A search match may have invisible text interspersed.

      Parameters:
      visibleOnly - the setting.
      Since:
      5.12
    • setWrapAround

      public void setWrapAround(boolean wrapAround)

      Enables or disables the wrap around search.

      If wrapAround is true, the forward search continues at the beginning of the buffer if no search occurrences are found. Similarly, the backward search continues to search at the end of the buffer.

      Parameters:
      wrapAround - the setting.
    • builder

      public static SearchSettings.Builder<? extends SearchSettings.Builder> builder()
      A SearchSettings.Builder object constructs a SearchSettings with the specified properties. Use the various set...() methods to set properties, and finish construction with SearchSettings.Builder.build().
      Returns:
      the builder object