/* Copyright 1998-2002 The gtkmm Development Team
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glibmm/vectorutils.h>

#include <gtkmm/texttag.h>
#include <gtkmm/textbuffer.h>

namespace Gtk
{

/**** Gtk::TextIter ********************************************************/



bool TextIter::get_attributes(TextAttributes& values) const
{
  // The initialization is not strictly necessary and omitting it
  // prevents a gcc-3.2 warning since { 0, } doesn't specifically
  // initialize all members.
  GtkTextAttributes gattributes; // = { 0, }

  const bool result = gtk_text_iter_get_attributes(gobj(), &gattributes);
  values = TextAttributes(&gattributes, true); //true = take_copy.
  return result;
}

bool TextIter::starts_tag() const
{
  return gtk_text_iter_starts_tag(const_cast<GtkTextIter*>(gobj()), nullptr /* see C docs */);
}
_DEPRECATE_IFDEF_START
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
bool TextIter::begins_tag() const
{
  return gtk_text_iter_begins_tag(const_cast<GtkTextIter*>(gobj()), nullptr /* see C docs */);
}
G_GNUC_END_IGNORE_DEPRECATIONS
_DEPRECATE_IFDEF_END

bool TextIter::ends_tag() const
{
  return gtk_text_iter_ends_tag(const_cast<GtkTextIter*>(gobj()), nullptr /* see C docs */);
}

bool TextIter::toggles_tag() const
{
  return gtk_text_iter_toggles_tag(const_cast<GtkTextIter*>(gobj()), nullptr /* see C docs */);
}

bool TextIter::has_tag() const
{
  return gtk_text_iter_has_tag(const_cast<GtkTextIter*>(gobj()), nullptr /* see C docs */);
}

bool TextIter::forward_search(const Glib::ustring& str, TextSearchFlags flags, TextIter& match_start, TextIter& match_end) const
{
  return gtk_text_iter_forward_search(const_cast<GtkTextIter*>(gobj()), str.c_str(), ((GtkTextSearchFlags)(flags)), (match_start).gobj(), (match_end).gobj(), nullptr /* means end() - see C docs */);
}

bool TextIter::backward_search(const Glib::ustring& str, TextSearchFlags flags, TextIter& match_start, TextIter& match_end) const
{
  return gtk_text_iter_backward_search(const_cast<GtkTextIter*>(gobj()), str.c_str(), ((GtkTextSearchFlags)(flags)), (match_start).gobj(), (match_end).gobj(), nullptr /* means end - see C docs */);
}


} // namespace Gtk

