summaryrefslogtreecommitdiff
path: root/libs/gtkmm2/gtk/gtkmm/textiter.cc
blob: 1881fa557468954ed5c6c6ae67d3e9f9d72dc097 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
// Generated by gtkmmproc -- DO NOT MODIFY!

#include <gtkmm/textiter.h>
#include <gtkmm/private/textiter_p.h>

#include <gtk/gtktypebuiltins.h>
// -*- c++ -*-
/* $Id$ */

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


namespace
{
} // anonymous namespace

// static
GType Glib::Value<Gtk::TextSearchFlags>::value_type()
{
  return gtk_text_search_flags_get_type();
}


namespace Glib
{

Gtk::TextIter& wrap(GtkTextIter* object)
{
  return *reinterpret_cast<Gtk::TextIter*>(object);
}

const Gtk::TextIter& wrap(const GtkTextIter* object)
{
  return *reinterpret_cast<const Gtk::TextIter*>(object);
}

} // namespace Glib


namespace Gtk
{


// static
GType TextIter::get_type()
{
  return gtk_text_iter_get_type();
}

TextIter::TextIter()
{
  GLIBMM_INITIALIZE_STRUCT(gobject_, GtkTextIter);
}

TextIter::TextIter(const GtkTextIter* gobject)
{
  if(gobject)
    gobject_ = *gobject;
  else
    GLIBMM_INITIALIZE_STRUCT(gobject_, GtkTextIter);
}


bool TextIter::forward_find_char_impl(GtkTextCharPredicate predicate, void* user_data, const GtkTextIter* limit)
{
  return gtk_text_iter_forward_find_char(gobj(), predicate, user_data, limit);
}

bool TextIter::backward_find_char_impl(GtkTextCharPredicate predicate, void* user_data, const GtkTextIter* limit)
{
  return gtk_text_iter_backward_find_char(gobj(), predicate, user_data, limit);
}

Glib::RefPtr<TextBuffer> TextIter::get_buffer() const
{

  Glib::RefPtr<TextBuffer> retvalue = Glib::wrap(gtk_text_iter_get_buffer(const_cast<GtkTextIter*>(gobj())));

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

int TextIter::get_offset() const
{
  return gtk_text_iter_get_offset(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_line() const
{
  return gtk_text_iter_get_line(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_line_offset() const
{
  return gtk_text_iter_get_line_offset(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_line_index() const
{
  return gtk_text_iter_get_line_index(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_visible_line_offset() const
{
  return gtk_text_iter_get_visible_line_offset(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_visible_line_index() const
{
  return gtk_text_iter_get_visible_line_index(const_cast<GtkTextIter*>(gobj()));
}

gunichar TextIter::get_char() const
{
  return gtk_text_iter_get_char(const_cast<GtkTextIter*>(gobj()));
}

Glib::ustring TextIter::get_slice(const TextIter& end) const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_text_iter_get_slice(const_cast<GtkTextIter*>(gobj()), (end).gobj()));
}

Glib::ustring TextIter::get_text(const TextIter& end) const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_text_iter_get_text(const_cast<GtkTextIter*>(gobj()), (end).gobj()));
}

Glib::ustring TextIter::get_visible_slice(const TextIter& end) const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_text_iter_get_visible_slice(const_cast<GtkTextIter*>(gobj()), (end).gobj()));
}

Glib::ustring TextIter::get_visible_text(const TextIter& end) const
{
  return Glib::convert_return_gchar_ptr_to_ustring(gtk_text_iter_get_visible_text(const_cast<GtkTextIter*>(gobj()), (end).gobj()));
}

Glib::RefPtr<Gdk::Pixbuf> TextIter::get_pixbuf() const
{

  Glib::RefPtr<Gdk::Pixbuf> retvalue = Glib::wrap(gtk_text_iter_get_pixbuf(const_cast<GtkTextIter*>(gobj())));

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::SListHandle< Glib::RefPtr<TextMark> > TextIter::get_marks()
{
  return Glib::SListHandle< Glib::RefPtr<TextMark> >(gtk_text_iter_get_marks(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle< Glib::RefPtr<const TextMark> > TextIter::get_marks() const
{
  return Glib::SListHandle< Glib::RefPtr<const TextMark> >(gtk_text_iter_get_marks(const_cast<GtkTextIter*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

Glib::RefPtr<TextChildAnchor> TextIter::get_child_anchor()
{

  Glib::RefPtr<TextChildAnchor> retvalue = Glib::wrap(gtk_text_iter_get_child_anchor(gobj()));

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::RefPtr<const TextChildAnchor> TextIter::get_child_anchor() const
{

  Glib::RefPtr<const TextChildAnchor> retvalue = Glib::wrap(gtk_text_iter_get_child_anchor(const_cast<GtkTextIter*>(gobj())));

  if(retvalue)
    retvalue->reference(); //The function does not do a ref for us.
  return retvalue;
}

Glib::SListHandle< Glib::RefPtr<TextTag> > TextIter::get_toggled_tags(bool toggled_on)
{
  return Glib::SListHandle< Glib::RefPtr<TextTag> >(gtk_text_iter_get_toggled_tags(gobj(), static_cast<int>(toggled_on)), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle< Glib::RefPtr<const TextTag> > TextIter::get_toggled_tags(bool toggled_on) const
{
  return Glib::SListHandle< Glib::RefPtr<const TextTag> >(gtk_text_iter_get_toggled_tags(const_cast<GtkTextIter*>(gobj()), static_cast<int>(toggled_on)), Glib::OWNERSHIP_SHALLOW);
}

bool TextIter::begins_tag(const Glib::RefPtr<const TextTag>& tag) const
{
  return gtk_text_iter_begins_tag(const_cast<GtkTextIter*>(gobj()), const_cast<GtkTextTag*>(Glib::unwrap<TextTag>(tag)));
}

bool TextIter::ends_tag(const Glib::RefPtr<const TextTag>& tag) const
{
  return gtk_text_iter_ends_tag(const_cast<GtkTextIter*>(gobj()), const_cast<GtkTextTag*>(Glib::unwrap<TextTag>(tag)));
}

bool TextIter::toggles_tag(const Glib::RefPtr<const TextTag>& tag) const
{
  return gtk_text_iter_toggles_tag(const_cast<GtkTextIter*>(gobj()), const_cast<GtkTextTag*>(Glib::unwrap<TextTag>(tag)));
}

bool TextIter::has_tag(const Glib::RefPtr<const TextTag>& tag) const
{
  return gtk_text_iter_has_tag(const_cast<GtkTextIter*>(gobj()), const_cast<GtkTextTag*>(Glib::unwrap<TextTag>(tag)));
}

Glib::SListHandle< Glib::RefPtr<TextTag> > TextIter::get_tags()
{
  return Glib::SListHandle< Glib::RefPtr<TextTag> >(gtk_text_iter_get_tags(gobj()), Glib::OWNERSHIP_SHALLOW);
}

Glib::SListHandle< Glib::RefPtr<const TextTag> > TextIter::get_tags() const
{
  return Glib::SListHandle< Glib::RefPtr<const TextTag> >(gtk_text_iter_get_tags(const_cast<GtkTextIter*>(gobj())), Glib::OWNERSHIP_SHALLOW);
}

bool TextIter::editable(bool default_setting) const
{
  return gtk_text_iter_editable(const_cast<GtkTextIter*>(gobj()), static_cast<int>(default_setting));
}

bool TextIter::can_insert(bool default_editability) const
{
  return gtk_text_iter_can_insert(const_cast<GtkTextIter*>(gobj()), static_cast<int>(default_editability));
}

bool TextIter::starts_word() const
{
  return gtk_text_iter_starts_word(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::ends_word() const
{
  return gtk_text_iter_ends_word(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::inside_word() const
{
  return gtk_text_iter_inside_word(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::starts_sentence() const
{
  return gtk_text_iter_starts_sentence(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::ends_sentence() const
{
  return gtk_text_iter_ends_sentence(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::inside_sentence() const
{
  return gtk_text_iter_inside_sentence(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::starts_line() const
{
  return gtk_text_iter_starts_line(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::ends_line() const
{
  return gtk_text_iter_ends_line(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::is_cursor_position() const
{
  return gtk_text_iter_is_cursor_position(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_chars_in_line() const
{
  return gtk_text_iter_get_chars_in_line(const_cast<GtkTextIter*>(gobj()));
}

int TextIter::get_bytes_in_line() const
{
  return gtk_text_iter_get_bytes_in_line(const_cast<GtkTextIter*>(gobj()));
}

Pango::Language TextIter::get_language() const
{
  return Pango::Language(gtk_text_iter_get_language(const_cast<GtkTextIter*>(gobj())));
}

bool TextIter::is_end() const
{
  return gtk_text_iter_is_end(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::is_start() const
{
  return gtk_text_iter_is_start(const_cast<GtkTextIter*>(gobj()));
}

bool TextIter::forward_char()
{
  return gtk_text_iter_forward_char(gobj());
}

bool TextIter::backward_char()
{
  return gtk_text_iter_backward_char(gobj());
}

bool TextIter::forward_chars(int count)
{
  return gtk_text_iter_forward_chars(gobj(), count);
}

bool TextIter::backward_chars(int count)
{
  return gtk_text_iter_backward_chars(gobj(), count);
}

bool TextIter::forward_line()
{
  return gtk_text_iter_forward_line(gobj());
}

bool TextIter::backward_line()
{
  return gtk_text_iter_backward_line(gobj());
}

bool TextIter::forward_lines(int count)
{
  return gtk_text_iter_forward_lines(gobj(), count);
}

bool TextIter::backward_lines(int count)
{
  return gtk_text_iter_backward_lines(gobj(), count);
}

bool TextIter::forward_word_end()
{
  return gtk_text_iter_forward_word_end(gobj());
}

bool TextIter::backward_word_start()
{
  return gtk_text_iter_backward_word_start(gobj());
}

bool TextIter::forward_word_ends(int count)
{
  return gtk_text_iter_forward_word_ends(gobj(), count);
}

bool TextIter::backward_word_starts(int count)
{
  return gtk_text_iter_backward_word_starts(gobj(), count);
}

bool TextIter::forward_visible_word_end()
{
  return gtk_text_iter_forward_visible_word_end(gobj());
}

bool TextIter::backward_visible_word_start()
{
  return gtk_text_iter_backward_visible_word_start(gobj());
}

bool TextIter::forward_visible_word_ends(int count)
{
  return gtk_text_iter_forward_visible_word_ends(gobj(), count);
}

bool TextIter::backward_visible_word_starts(int count)
{
  return gtk_text_iter_backward_visible_word_starts(gobj(), count);
}

bool TextIter::forward_sentence_end()
{
  return gtk_text_iter_forward_sentence_end(gobj());
}

bool TextIter::backward_sentence_start()
{
  return gtk_text_iter_backward_sentence_start(gobj());
}

bool TextIter::forward_sentence_ends(int count)
{
  return gtk_text_iter_forward_sentence_ends(gobj(), count);
}

bool TextIter::backward_sentence_starts(int count)
{
  return gtk_text_iter_backward_sentence_starts(gobj(), count);
}

bool TextIter::forward_cursor_position()
{
  return gtk_text_iter_forward_cursor_position(gobj());
}

bool TextIter::backward_cursor_position()
{
  return gtk_text_iter_backward_cursor_position(gobj());
}

bool TextIter::forward_cursor_positions(int count)
{
  return gtk_text_iter_forward_cursor_positions(gobj(), count);
}

bool TextIter::backward_cursor_positions(int count)
{
  return gtk_text_iter_backward_cursor_positions(gobj(), count);
}

bool TextIter::forward_visible_cursor_position()
{
  return gtk_text_iter_forward_visible_cursor_position(gobj());
}

bool TextIter::backward_visible_cursor_position()
{
  return gtk_text_iter_backward_visible_cursor_position(gobj());
}

bool TextIter::forward_visible_cursor_positions(int count)
{
  return gtk_text_iter_forward_visible_cursor_positions(gobj(), count);
}

bool TextIter::backward_visible_cursor_positions(int count)
{
  return gtk_text_iter_backward_visible_cursor_positions(gobj(), count);
}

void TextIter::set_offset(int char_offset)
{
  gtk_text_iter_set_offset(gobj(), char_offset);
}

void TextIter::set_line(int line_number)
{
  gtk_text_iter_set_line(gobj(), line_number);
}

void TextIter::set_line_offset(int char_on_line)
{
  gtk_text_iter_set_line_offset(gobj(), char_on_line);
}

void TextIter::set_line_index(int byte_on_line)
{
  gtk_text_iter_set_line_index(gobj(), byte_on_line);
}

void TextIter::forward_to_end()
{
  gtk_text_iter_forward_to_end(gobj());
}

bool TextIter::forward_to_line_end()
{
  return gtk_text_iter_forward_to_line_end(gobj());
}

void TextIter::set_visible_line_offset(int char_on_line)
{
  gtk_text_iter_set_visible_line_offset(gobj(), char_on_line);
}

void TextIter::set_visible_line_index(int byte_on_line)
{
  gtk_text_iter_set_visible_line_index(gobj(), byte_on_line);
}

bool TextIter::forward_to_tag_toggle(const Glib::RefPtr<TextTag>& tag)
{
  return gtk_text_iter_forward_to_tag_toggle(gobj(), Glib::unwrap(tag));
}

bool TextIter::backward_to_tag_toggle(const Glib::RefPtr<TextTag>& tag)
{
  return gtk_text_iter_backward_to_tag_toggle(gobj(), Glib::unwrap(tag));
}

bool TextIter::forward_search(const Glib::ustring& str, TextSearchFlags flags, TextIter& match_start, TextIter& match_end, const TextIter& limit) const
{
  return gtk_text_iter_forward_search(const_cast<GtkTextIter*>(gobj()), str.c_str(), ((GtkTextSearchFlags)(flags)), (match_start).gobj(), (match_end).gobj(), (limit).gobj());
}

bool TextIter::backward_search(const Glib::ustring& str, TextSearchFlags flags, TextIter& match_start, TextIter& match_end, const TextIter& limit) const
{
  return gtk_text_iter_backward_search(const_cast<GtkTextIter*>(gobj()), str.c_str(), ((GtkTextSearchFlags)(flags)), (match_start).gobj(), (match_end).gobj(), (limit).gobj());
}

int TextIter::compare(const TextIter& rhs) const
{
  return gtk_text_iter_compare(const_cast<GtkTextIter*>(gobj()), (rhs).gobj());
}

bool TextIter::in_range(const TextIter& start, const TextIter& end) const
{
  return gtk_text_iter_in_range(const_cast<GtkTextIter*>(gobj()), (start).gobj(), (end).gobj());
}

void TextIter::order(TextIter& second)
{
  gtk_text_iter_order(gobj(), (second).gobj());
}


bool operator==(const TextIter& lhs, const TextIter& rhs)
{
  return (gtk_text_iter_equal(lhs.gobj(), rhs.gobj()) != 0);
}

bool operator!=(const TextIter& lhs, const TextIter& rhs)
{
  return (gtk_text_iter_equal(lhs.gobj(), rhs.gobj()) == 0);
}

bool operator<(const TextIter& lhs, const TextIter& rhs)
{
  return (gtk_text_iter_compare(lhs.gobj(), rhs.gobj()) < 0);
}

bool operator>(const TextIter& lhs, const TextIter& rhs)
{
  return (gtk_text_iter_compare(lhs.gobj(), rhs.gobj()) > 0);
}

bool operator<=(const TextIter& lhs, const TextIter& rhs)
{
  return (gtk_text_iter_compare(lhs.gobj(), rhs.gobj()) <= 0);
}

bool operator>=(const TextIter& lhs, const TextIter& rhs)
{
  return (gtk_text_iter_compare(lhs.gobj(), rhs.gobj()) >= 0);
}


} // namespace Gtk