// -*- c++ -*-
/* $Id: textiter.ccg,v 1.3 2005/01/06 20:49:07 murrayc Exp $ */

/* 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 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.
 */

#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::begins_tag() const
{
  return gtk_text_iter_begins_tag(const_cast<GtkTextIter*>(gobj()), 0 /* see C docs */);
}

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

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

bool TextIter::has_tag() const
{
  return gtk_text_iter_has_tag(const_cast<GtkTextIter*>(gobj()), 0 /* 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(), 0 /* 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(), 0 /* means end - see C docs */);
}
  

} // namespace Gtk

