/* searchsettings.h
 *
 * Copyright (C) 2015 Christoph Brill
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

_DEFS(gtksourceviewmm,gtksourceview)
_PINCLUDE(glibmm/private/object_p.h)

namespace Gsv
{

/** A GtkSourceSearchSettings object represents the settings of a search. The search settings can be associated with one or
 * several GtkSourceSearchContexts.
 *
 * @newin{3,10}
 */
class SearchSettings : public Glib::Object
{
  _CLASS_GOBJECT(SearchSettings, GtkSourceSearchSettings, GTK_SOURCE_SEARCH_SETTINGS, Glib::Object, GObject)

protected:
  _CTOR_DEFAULT()

public:
  _WRAP_CREATE()

  /** Sets the text to search. If text is NULL or is empty, the search will be disabled. A copy of text will be made, so
   * you can safely free text after a call to this function.
   *
   * You may be interested to call gtk_source_utils_unescape_search_text() before this function.
   *
   * @param search_text the nul-terminated text to search, or NULL to disable the search.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(void set_search_text(const Glib::ustring& search_text), gtk_source_search_settings_set_search_text)

  /** Gets the text to search. The return value must not be freed.
   *
   * You may be interested to call gtk_source_utils_escape_search_text() after this function.
   *
   * @return the text to search, or NULL if the search is disabled.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(Glib::ustring get_search_text() const, gtk_source_search_settings_get_search_text)

  /** Enables or disables the case sensitivity for the search.
   *
   * @param case_sensitive the setting.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(void set_case_sensitive(bool case_sensitive = true), gtk_source_search_settings_set_case_sensitive)

  /**
   * @return whether the search is case sensitive.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(bool get_case_sensitive() const, gtk_source_search_settings_get_case_sensitive)

  /** Change whether the search is done at word boundaries. If at_word_boundaries is TRUE, a search match must start and end
   * a word. The match can span multiple words. See also gtk_text_iter_starts_word() and gtk_text_iter_ends_word().
   *
   * @param at_word_boundaries the setting.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(void set_at_word_boundaries(bool at_word_boundaries = true), gtk_source_search_settings_set_at_word_boundaries)

  /**
   * @return whether to search at word boundaries.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(bool get_at_word_boundaries() const, gtk_source_search_settings_get_at_word_boundaries)

  /** Enables or disables the wrap around search. If wrap_around 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.
   *
   * @param wrap_around the setting.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(void set_wrap_around(bool wrap_around = true), gtk_source_search_settings_set_wrap_around)

  /**
   * @return whether to wrap around the search.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(bool get_wrap_around() const, gtk_source_search_settings_get_wrap_around)

  /** Enables or disables whether to search by regular expressions. If enabled, the "search-text" property contains the pattern of
   * the regular expression.
   *
   * @param regex_enabled the setting.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(void set_regex_enabled(bool regex_enabled = true), gtk_source_search_settings_set_regex_enabled)

  /**
   * @param whether to search by regular expressions.
   *
   * @newin{3,10}
   */
  _WRAP_METHOD(bool get_regex_enabled() const, gtk_source_search_settings_get_regex_enabled)

  _WRAP_PROPERTY("at-word-boundaries", bool)
  _WRAP_PROPERTY("case-sensitive", bool)
  _WRAP_PROPERTY("regex-enabled", bool)
  _WRAP_PROPERTY("search-text", Glib::ustring)
  _WRAP_PROPERTY("wrap-around", bool)
};

} /* namespace Gsv */
