| 1 |
/* Copyright (C) 2002 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library; if not, see <https://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
#include <gtk/gtk.h> |
| 18 |
|
| 19 |
namespace Gtk |
| 20 |
{ |
| 21 |
|
| 22 |
TextView::TextView(const Glib::RefPtr<TextBuffer>& buffer) |
| 23 |
: |
| 24 |
_CONSTRUCT() |
| 25 |
{ |
| 26 |
set_buffer(buffer); |
| 27 |
} |
| 28 |
|
| 29 |
bool TextView::scroll_to(TextBuffer::iterator& iter, double within_margin) |
| 30 |
{ |
| 31 |
//The last 2 arguments are ignored if use_align is FALSE. |
| 32 |
return gtk_text_view_scroll_to_iter(gobj(), (iter).gobj(), within_margin, FALSE, 0.0, 0.0); |
| 33 |
} |
| 34 |
|
| 35 |
bool TextView::scroll_to(TextBuffer::iterator& iter, double within_margin, double xalign, double yalign) |
| 36 |
{ |
| 37 |
return gtk_text_view_scroll_to_iter(gobj(), (iter).gobj(), within_margin, TRUE /* use_align */, xalign, yalign); |
| 38 |
} |
| 39 |
|
| 40 |
void TextView::scroll_to(const Glib::RefPtr<TextBuffer::Mark>& mark, double within_margin) |
| 41 |
{ |
| 42 |
//The last 2 arguments are ignored if use_align is FALSE. |
| 43 |
gtk_text_view_scroll_to_mark(gobj(), Glib::unwrap(mark), within_margin, FALSE, 0.0, 0.0); |
| 44 |
} |
| 45 |
|
| 46 |
void TextView::scroll_to(const Glib::RefPtr<TextBuffer::Mark>& mark, double within_margin, double xalign, double yalign) |
| 47 |
{ |
| 48 |
gtk_text_view_scroll_to_mark(gobj(), Glib::unwrap(mark), within_margin, TRUE /* use_align */, xalign, yalign); |
| 49 |
} |
| 50 |
|
| 51 |
} // namespace Gtk |