13
0
livetrax/libs/gtkmm2/gtk/src/textmark.hg
David Robillard 35fc31a1de Remove ancient/unused flowcanvas and libglademm from repository.
Update libraries to latest stable released version (except gnomecanvasmm, which is strangely packaged...).
Fixes building (at least here).


git-svn-id: svn://localhost/ardour2/trunk@2790 d708f5d6-7413-0410-9779-e7cbd77b26cf
2007-12-18 06:05:55 +00:00

144 lines
6.6 KiB
Plaintext

/* $Id: textmark.hg,v 1.3 2006/04/12 11:11:25 murrayc Exp $ */
/* textmark.h
*
* Copyright (C) 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/object.h>
_DEFS(gtkmm,gtk)
_PINCLUDE(glibmm/private/object_p.h)
namespace Gtk
{
class TextBuffer;
class TextIter;
/** Typedefed as Gtk::TextBuffer::Mark. A position in the buffer, preserved across buffer modifications.
*
* A Mark is like a bookmark in a text buffer; it preserves a position in the text. Unlike iterators, marks remain valid across buffer mutations, because
* their behavior is defined when text is inserted or deleted. When text containing a mark is deleted, the mark remains in
* the position originally occupied by the deleted text. When text is inserted at a mark, a mark with left gravity will be
* moved to the beginning of the newly-inserted text, and a mark with right gravity will be moved to the end.
* The standard text cursor in left-to-right languages is a mark with right gravity, because it stays to the right of inserted
* text.
*
* Like tags, marks can be either named or anonymous. There are two marks built-in to Gtk::TextBuffer; these are named "insert" and
* "selection_bound" and refer to the insertion point and the boundary of the selection which is not the insertion point,
* respectively. If no text is selected, these two marks will be in the same position. You can manipulate what is selected and
* where the cursor appears by moving these marks around.
*
* "left" and "right" here refer to logical direction (left is the toward the start of the buffer); in some languages such as
* Hebrew the logically-leftmost text is not actually on the left when displayed.
*
* You can convert the mark to an @link Gtk::TextIter iterator@endlink using Gtk::TextBuffer::get_iter_at_mark().
*
* Marks can be deleted from the buffer at any time with Gtk::TextBuffer::delete_mark(). Once deleted from the buffer, a mark is essentially useless.
*
* Marks optionally have names; these can be convenient to avoid passing the Gtk::TextBuffer::Mark object around.
*
* Marks are typically created using the Gtk::TextBuffer::create_mark() function.
*
* @ingroup TextView
*/
class TextMark : public Glib::Object
{
_CLASS_GOBJECT(TextMark, GtkTextMark, GTK_TEXT_MARK, Glib::Object, GObject)
protected:
/** Creates an anoymous text mark. Add it to a buffer using Gtk::TextBuffer::add_mark().
* If a mark has left
* gravity, and text is inserted at the mark's current location, the mark
* will be moved to the left of the newly-inserted text. If the mark has
* right gravity (@a left_gravity = false), the mark will end up on the
* right of newly-inserted text. The standard left-to-right cursor is a
* mark with right gravity (when you type, the cursor stays on the right
* side of the text you're typing).
* @param name mark name.
* @param left_gravity Whether the mark should have left gravity.
* @newin2p12
*/
explicit TextMark(bool left_gravity = true);
/** Creates a text mark. Add it to a buffer using Gtk::TextBuffer::add_mark().
* The mark can be retrieved by name using Gtk::TextBuffer::get_mark(). If a mark has left
* gravity, and text is inserted at the mark's current location, the mark
* will be moved to the left of the newly-inserted text. If the mark has
* right gravity (@a left_gravity = false), the mark will end up on the
* right of newly-inserted text. The standard left-to-right cursor is a
* mark with right gravity (when you type, the cursor stays on the right
* side of the text you're typing).
* @param name mark name.
* @param left_gravity Whether the mark should have left gravity.
* @newin2p12
*/
_WRAP_CTOR(TextMark(const Glib::ustring& name, bool left_gravity = true), gtk_text_mark_new)
public:
/** Creates an anoymous text mark. Add it to a buffer using Gtk::TextBuffer::add_mark().
* If a mark has left
* gravity, and text is inserted at the mark's current location, the mark
* will be moved to the left of the newly-inserted text. If the mark has
* right gravity (@a left_gravity = false), the mark will end up on the
* right of newly-inserted text. The standard left-to-right cursor is a
* mark with right gravity (when you type, the cursor stays on the right
* side of the text you're typing).
* @param name mark name.
* @param left_gravity Whether the mark should have left gravity.
* @result A RefPtr to a new text mark.
* @newin2p12
*/
_WRAP_CREATE(bool left_gravity = true)
/** Creates a text mark. Add it to a buffer using Gtk::TextBuffer::add_mark().
* The mark can be retrieved by name using Gtk::TextBuffer::get_mark(). If a mark has left
* gravity, and text is inserted at the mark's current location, the mark
* will be moved to the left of the newly-inserted text. If the mark has
* right gravity (@a left_gravity = false), the mark will end up on the
* right of newly-inserted text. The standard left-to-right cursor is a
* mark with right gravity (when you type, the cursor stays on the right
* side of the text you're typing).
* @param name mark name.
* @param left_gravity Whether the mark should have left gravity.
* @result A RefPtr to a new text mark.
* @newin2p12
*/
_WRAP_CREATE(const Glib::ustring& name, bool left_gravity = true)
_WRAP_METHOD(void set_visible(bool setting = true), gtk_text_mark_set_visible)
_WRAP_METHOD(bool get_visible() const, gtk_text_mark_get_visible)
_WRAP_METHOD(Glib::ustring get_name() const, gtk_text_mark_get_name)
_WRAP_METHOD(bool get_deleted() const, gtk_text_mark_get_deleted)
_WRAP_METHOD(Glib::RefPtr<TextBuffer> get_buffer(), gtk_text_mark_get_buffer, refreturn)
_WRAP_METHOD(Glib::RefPtr<const TextBuffer> get_buffer() const, gtk_text_mark_get_buffer, refreturn, constversion)
_WRAP_METHOD(bool get_left_gravity() const, gtk_text_mark_get_left_gravity)
//TODO: Add a const overload, if we have a ConstTextIter.
TextIter get_iter();
};
} /* namespace Gtk */