/* mark.h
 *
 * Copyright (C) 2008 Jonathon Jongsma
 * Copyright (C) 2010, 2011 Krzesimir Nowak
 *
 * 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/textmark.h>

_DEFS(gtksourceviewmm,gtksourceview)
_PINCLUDE(gtkmm/private/textmark_p.h)

namespace Gsv
{

/** Mark class for Buffer.
 *
 * @newin{2,2}
 */
class Mark : public Gtk::TextMark
{
  _CLASS_GOBJECT(Mark, GtkSourceMark, GTK_SOURCE_MARK, Gtk::TextMark, GtkTextMark)

protected:

  explicit Mark(const Glib::ustring& category);
  explicit Mark(const Glib::ustring& name, const Glib::ustring& category);
  _IGNORE(gtk_source_mark_new)

public:
  /** Creates an anonymous text mark.
   *
   * Add it to a buffer using Gtk::TextBuffer::add_mark(). Note that such marks
   * cannot be retrieved by using Gtk::TextBuffer::get_mark(). Normally marks
   * are created using the utility function
   * Gsv::Buffer::create_source_mark().
   *
   * @param category Is used to classify marks according to common
   * characteristics (e.g. all the marks representing a bookmark could belong to
   * the "bookmark" category, or all the marks representing a compilation error
   * could belong to "error" category).
   *
   * @return A new anonymous Mark that can be added using
   * GtkTextBuffer::add_mark().
   */
  _WRAP_CREATE(const Glib::ustring& category)

  /** Creates a text mark.
   *
   * Add it to a buffer using Gtk::TextBuffer::add_mark(). The mark can be
   * retrieved by name by using Gtk::TextBuffer::get_mark(). Normally marks are
   * created using the utility function Buffer::create_source_mark().
   *
   * @param category Is used to classify marks according to common
   * characteristics (e.g. all the marks representing a bookmark could belong to
   * the "bookmark" category, or all the marks representing a compilation error
   * could belong to "error" category).
   * @param name Name of the Mark.
   *
   * @return A new Mark that can be added using GtkTextBuffer::add_mark().
   */
  _WRAP_CREATE(const Glib::ustring& name, const Glib::ustring& category)

  /** Returns the mark category.
   *
   * @return The category of the Mark.
   *
   * @newin{2,2}
   */
  _WRAP_METHOD(Glib::ustring get_category() const, gtk_source_mark_get_category)

  /** Returns the next Mark in the buffer.
   *
   * If there is no next mark, empty refptr will be returned.
   *
   * @param category A string specifying the mark category.
   *
   * @return The next Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  _WRAP_METHOD(Glib::RefPtr<Gsv::Mark> next(const Glib::ustring& category), gtk_source_mark_next, refreturn)

  /** Returns the next Mark in the buffer.
   *
   * If there is no next mark, empty refptr will be returned.
   *
   * @param category A string specifying the mark category.
   *
   * @return The next Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  _WRAP_METHOD(Glib::RefPtr<const Gsv::Mark> next(const Glib::ustring& category) const, gtk_source_mark_next, refreturn, constversion)

  /** Returns the next Mark of any category in the buffer.
   *
   * If there is no next mark, empty refptr will be returned.
   *
   * @return The next Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  Glib::RefPtr<Gsv::Mark> next();

  /** Returns the next Mark of any category in the buffer.
   *
   * If there is no next mark, empty refptr will be returned.
   *
   * @return The next Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  Glib::RefPtr<const Gsv::Mark> next() const;

  /** Returns the previous Mark in the buffer.
   *
   * If there is no previous mark, empty refptr will be returned.
   *
   * @param category A string specifying the mark category.
   *
   * @return The previous Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  _WRAP_METHOD(Glib::RefPtr<Gsv::Mark> prev(const Glib::ustring& category), gtk_source_mark_prev, refreturn)

  /** Returns the previous Mark in the buffer.
   *
   * If there is no previous mark, empty refptr will be returned.
   *
   * @param category A string specifying the mark category.
   *
   * @return The previous Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  _WRAP_METHOD(Glib::RefPtr<const Gsv::Mark> prev(const Glib::ustring& category) const, gtk_source_mark_prev, refreturn, constversion)

  /** Returns the previous Mark of any category in the buffer.
   *
   * If there is no previous mark, empty refptr will be returned.
   *
   * @return The previous Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  Glib::RefPtr<Gsv::Mark> prev();

  /** Returns the previous Mark of any category in the buffer.
   *
   * If there is no previous mark, empty refptr will be returned.
   *
   * @return The previous Mark or empty Glib::RefPtr.
   *
   * @newin{2,2}
   */
  Glib::RefPtr<const Gsv::Mark> prev() const;

  _WRAP_PROPERTY("category", Glib::ustring)

};//end class Mark

}//end namespace Gsv


