File: GtkTextIter.xs

package info (click to toggle)
libgtk2-perl 2:1.2499-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 4,668 kB
  • ctags: 594
  • sloc: perl: 22,100; ansic: 122; makefile: 17
file content (583 lines) | stat: -rw-r--r-- 16,552 bytes parent folder | download | duplicates (5)
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
/*
 * Copyright (c) 2003-2005 by the gtk2-perl team (see the file AUTHORS)
 *
 * Licensed under the LGPL, see LICENSE file for more information.
 *
 * $Id$
 */

#include "gtk2perl.h"
#include <gperl_marshal.h>

static GPerlCallback *
create_text_char_predicate_callback (SV * func, SV * data)
{
	return gperl_callback_new (func, data, 0, NULL, G_TYPE_BOOLEAN);
}

static gboolean
gtk2perl_text_char_predicate (gunichar ch,
                              gpointer user_data)
{
	GPerlCallback * callback = (GPerlCallback *) user_data;
	gboolean ret;
	SV * svch;
	gchar temp[6];
	gint length;
	dGPERL_CALLBACK_MARSHAL_SP;

	GPERL_CALLBACK_MARSHAL_INIT (callback);

	ENTER;
	SAVETMPS;
	PUSHMARK (SP);

	length = g_unichar_to_utf8 (ch, temp);
	svch = newSVpv (temp, length);
	SvUTF8_on (svch);
	XPUSHs (sv_2mortal (svch));

	if (callback->data)
		XPUSHs (callback->data);

	PUTBACK;
	call_sv (callback->func, G_SCALAR);
	SPAGAIN;

	ret = POPi;

	PUTBACK;
	FREETMPS;
	LEAVE;
 
	return ret;
}

MODULE = Gtk2::TextIter	PACKAGE = Gtk2::TextIter	PREFIX = gtk_text_iter_

GtkTextBuffer*
gtk_text_iter_get_buffer (iter)
	GtkTextIter * iter

 # boxed wrapper support taken care of by Glib::Boxed
## GtkTextIter* gtk_text_iter_copy (const GtkTextIter *iter);
## void gtk_text_iter_free (GtkTextIter *iter);

## gint gtk_text_iter_get_offset (const GtkTextIter *iter)
gint
gtk_text_iter_get_offset (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_line (const GtkTextIter *iter)
gint
gtk_text_iter_get_line (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_line_offset (const GtkTextIter *iter)
gint
gtk_text_iter_get_line_offset (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_line_index (const GtkTextIter *iter)
gint
gtk_text_iter_get_line_index (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_visible_line_offset (const GtkTextIter *iter)
gint
gtk_text_iter_get_visible_line_offset (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_visible_line_index (const GtkTextIter *iter)
gint
gtk_text_iter_get_visible_line_index (iter)
	 GtkTextIter *iter

## gunichar gtk_text_iter_get_char (const GtkTextIter *iter)
gunichar
gtk_text_iter_get_char (iter)
	GtkTextIter *iter

gchar_own *
gtk_text_iter_get_slice (start, end)
	GtkTextIter * start
	GtkTextIter * end

gchar_own *
gtk_text_iter_get_text (start, end)
	GtkTextIter * start
	GtkTextIter * end

gchar_own * gtk_text_iter_get_visible_slice (GtkTextIter *start, GtkTextIter *end)

gchar_own * gtk_text_iter_get_visible_text (GtkTextIter *start, GtkTextIter *end)

## GdkPixbuf* gtk_text_iter_get_pixbuf (const GtkTextIter *iter)
GdkPixbuf_ornull*
gtk_text_iter_get_pixbuf (iter)
	GtkTextIter *iter

## GSList * gtk_text_iter_get_marks (const GtkTextIter *iter)
=for apidoc
Returns a list of all Gtk2::TextMark at this location. Because marks are not
iterable (they don't take up any "space" in the buffer, they are just marks in
between iterable locations), multiple marks can exist in the same place. The
returned list is not in any meaningful order.
=cut
void
gtk_text_iter_get_marks (GtkTextIter *iter)
    PREINIT:
	GSList * marks, * i;
    PPCODE:
	marks = gtk_text_iter_get_marks (iter);
	for (i = marks ; i != NULL ; i = i->next)
		XPUSHs (sv_2mortal (newSVGtkTextMark (i->data)));
	g_slist_free (marks);

## GSList* gtk_text_iter_get_toggled_tags  (const GtkTextIter *iter, gboolean toggled_on)
=for apidoc
Returns a list of Gtk2::TextTag that are toggled on or off at this point. (If
toggled_on is TRUE, the list contains tags that are toggled on.) If a tag is
toggled on at iter, then some non-empty range of characters following iter has
that tag applied to it. If a tag is toggled off, then some non-empty range
following iter does not have the tag applied to it.
=cut
void
gtk_text_iter_get_toggled_tags (GtkTextIter * iter, gboolean toggled_on)
    PREINIT:
	GSList * tags, * i;
    PPCODE:
	tags = gtk_text_iter_get_toggled_tags (iter, toggled_on);
	for (i = tags ; i != NULL ; i = i->next)
		XPUSHs (sv_2mortal (newSVGtkTextTag (i->data)));
	g_slist_free (tags);

## GtkTextChildAnchor* gtk_text_iter_get_child_anchor (const GtkTextIter *iter)
GtkTextChildAnchor_ornull*
gtk_text_iter_get_child_anchor (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_begins_tag (const GtkTextIter *iter, GtkTextTag *tag)
gboolean
gtk_text_iter_begins_tag (iter, tag)
	GtkTextIter *iter
	GtkTextTag_ornull *tag

## gboolean gtk_text_iter_ends_tag (const GtkTextIter *iter, GtkTextTag *tag)
gboolean
gtk_text_iter_ends_tag (iter, tag)
	GtkTextIter *iter
	GtkTextTag_ornull *tag

## gboolean gtk_text_iter_toggles_tag (const GtkTextIter *iter, GtkTextTag *tag)
gboolean
gtk_text_iter_toggles_tag (iter, tag)
	GtkTextIter *iter
	GtkTextTag_ornull *tag

## gboolean gtk_text_iter_has_tag (const GtkTextIter *iter, GtkTextTag *tag)
gboolean
gtk_text_iter_has_tag (iter, tag)
	GtkTextIter *iter
	GtkTextTag *tag

### GSList* gtk_text_iter_get_tags (const GtkTextIter *iter)
=for apidoc
Returns a list of tags that apply to iter, in ascending order of priority
(highest-priority tags are last). 
=cut
void
gtk_text_iter_get_tags (GtkTextIter *iter)
    PREINIT:
	GSList* slist, *i;
    PPCODE:
	slist = gtk_text_iter_get_tags (iter);
	for (i = slist ; i != NULL ; i = i->next)
		XPUSHs (sv_2mortal (newSVGtkTextTag (i->data)));
	g_slist_free (slist);
	

## gboolean gtk_text_iter_editable (const GtkTextIter *iter, gboolean default_setting)
gboolean
gtk_text_iter_editable (iter, default_setting)
	GtkTextIter *iter
	gboolean default_setting

## gboolean gtk_text_iter_can_insert (const GtkTextIter *iter, gboolean default_editability)
gboolean
gtk_text_iter_can_insert (iter, default_editability)
	GtkTextIter *iter
	gboolean default_editability

## gboolean gtk_text_iter_starts_word (const GtkTextIter *iter)
gboolean
gtk_text_iter_starts_word (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_ends_word (const GtkTextIter *iter)
gboolean
gtk_text_iter_ends_word (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_inside_word (const GtkTextIter *iter)
gboolean
gtk_text_iter_inside_word (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_starts_sentence (const GtkTextIter *iter)
gboolean
gtk_text_iter_starts_sentence (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_ends_sentence (const GtkTextIter *iter)
gboolean
gtk_text_iter_ends_sentence (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_inside_sentence (const GtkTextIter *iter)
gboolean
gtk_text_iter_inside_sentence (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_starts_line (const GtkTextIter *iter)
gboolean
gtk_text_iter_starts_line (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_ends_line (const GtkTextIter *iter)
gboolean
gtk_text_iter_ends_line (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_is_cursor_position (const GtkTextIter *iter)
gboolean
gtk_text_iter_is_cursor_position (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_chars_in_line (const GtkTextIter *iter)
gint
gtk_text_iter_get_chars_in_line (iter)
	GtkTextIter *iter

## gint gtk_text_iter_get_bytes_in_line (const GtkTextIter *iter)
gint
gtk_text_iter_get_bytes_in_line (iter)
	GtkTextIter *iter

### gboolean gtk_text_iter_get_attributes (const GtkTextIter *iter, GtkTextAttributes *values)
GtkTextAttributes_copy*
gtk_text_iter_get_attributes (GtkTextIter *iter)
    PREINIT:
	GtkTextAttributes values;
    CODE:
	if (!gtk_text_iter_get_attributes (iter, &values))
		XSRETURN_UNDEF;
	RETVAL = &values;
    OUTPUT:
	RETVAL

# i think the returned value should NOT be owned
## PangoLanguage* gtk_text_iter_get_language (const GtkTextIter *iter)
PangoLanguage*
gtk_text_iter_get_language (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_is_end (const GtkTextIter *iter)
gboolean
gtk_text_iter_is_end (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_is_start (const GtkTextIter *iter)
gboolean
gtk_text_iter_is_start (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_char (GtkTextIter *iter)
gboolean
gtk_text_iter_forward_char (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_backward_char (GtkTextIter *iter)
gboolean
gtk_text_iter_backward_char (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_chars (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_forward_chars (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_backward_chars (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_backward_chars (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_forward_line (GtkTextIter *iter)
gboolean
gtk_text_iter_forward_line (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_backward_line (GtkTextIter *iter)
gboolean
gtk_text_iter_backward_line (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_lines (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_forward_lines (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_backward_lines (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_backward_lines (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_forward_word_end (GtkTextIter *iter)
gboolean
gtk_text_iter_forward_word_end (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_backward_word_start (GtkTextIter *iter)
gboolean
gtk_text_iter_backward_word_start (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_word_ends (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_forward_word_ends (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_backward_word_starts (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_backward_word_starts (iter, count)
	GtkTextIter *iter
	gint count

#if GTK_CHECK_VERSION(2,4,0)

gboolean gtk_text_iter_forward_visible_word_end (GtkTextIter *iter);

gboolean gtk_text_iter_backward_visible_word_start (GtkTextIter *iter);

gboolean gtk_text_iter_forward_visible_word_ends (GtkTextIter *iter, gint count);

gboolean gtk_text_iter_backward_visible_word_starts (GtkTextIter *iter, gint count);

#endif

## gboolean gtk_text_iter_forward_sentence_end (GtkTextIter *iter)
gboolean
gtk_text_iter_forward_sentence_end (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_backward_sentence_start (GtkTextIter *iter)
gboolean
gtk_text_iter_backward_sentence_start (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_sentence_ends (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_forward_sentence_ends (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_backward_sentence_starts (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_backward_sentence_starts (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_forward_cursor_position (GtkTextIter *iter)
gboolean
gtk_text_iter_forward_cursor_position (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_backward_cursor_position (GtkTextIter *iter)
gboolean
gtk_text_iter_backward_cursor_position (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_cursor_positions (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_forward_cursor_positions (iter, count)
	GtkTextIter *iter
	gint count

## gboolean gtk_text_iter_backward_cursor_positions (GtkTextIter *iter, gint count)
gboolean
gtk_text_iter_backward_cursor_positions (iter, count)
	GtkTextIter *iter
	gint count

#if GTK_CHECK_VERSION(2,4,0)

gboolean gtk_text_iter_forward_visible_cursor_position   (GtkTextIter *iter);

gboolean gtk_text_iter_backward_visible_cursor_position  (GtkTextIter *iter);

gboolean gtk_text_iter_forward_visible_cursor_positions  (GtkTextIter *iter, gint count);

gboolean gtk_text_iter_backward_visible_cursor_positions (GtkTextIter *iter, gint count);

#endif

## void gtk_text_iter_set_offset (GtkTextIter *iter, gint char_offset)
void
gtk_text_iter_set_offset (iter, char_offset)
	GtkTextIter *iter
	gint char_offset

## void gtk_text_iter_set_line (GtkTextIter *iter, gint line_number)
void
gtk_text_iter_set_line (iter, line_number)
	GtkTextIter *iter
	gint line_number

## void gtk_text_iter_set_line_offset (GtkTextIter *iter, gint char_on_line)
void
gtk_text_iter_set_line_offset (iter, char_on_line)
	GtkTextIter *iter
	gint char_on_line

## void gtk_text_iter_set_line_index (GtkTextIter *iter, gint byte_on_line)
void
gtk_text_iter_set_line_index (iter, byte_on_line)
	GtkTextIter *iter
	gint byte_on_line

## void gtk_text_iter_forward_to_end (GtkTextIter *iter)
void
gtk_text_iter_forward_to_end (iter)
	GtkTextIter *iter

## gboolean gtk_text_iter_forward_to_line_end (GtkTextIter *iter)
gboolean
gtk_text_iter_forward_to_line_end (iter)
	GtkTextIter *iter

## void gtk_text_iter_set_visible_line_offset (GtkTextIter *iter, gint char_on_line)
void
gtk_text_iter_set_visible_line_offset (iter, char_on_line)
	GtkTextIter *iter
	gint char_on_line

## void gtk_text_iter_set_visible_line_index (GtkTextIter *iter, gint byte_on_line)
void
gtk_text_iter_set_visible_line_index (iter, byte_on_line)
	GtkTextIter *iter
	gint byte_on_line

## gboolean gtk_text_iter_forward_to_tag_toggle (GtkTextIter *iter, GtkTextTag *tag)
gboolean
gtk_text_iter_forward_to_tag_toggle (iter, tag)
	GtkTextIter       * iter
	GtkTextTag_ornull * tag

## gboolean gtk_text_iter_backward_to_tag_toggle (GtkTextIter *iter, GtkTextTag *tag)
gboolean
gtk_text_iter_backward_to_tag_toggle (iter, tag)
	GtkTextIter       * iter
	GtkTextTag_ornull * tag

## gboolean gtk_text_iter_forward_find_char (GtkTextIter *iter, GtkTextCharPredicate pred, gpointer user_data, const GtkTextIter *limit)
## gboolean gtk_text_iter_backward_find_char (GtkTextIter *iter, GtkTextCharPredicate pred, gpointer user_data, const GtkTextIter *limit)
gboolean
gtk_text_iter_forward_find_char (iter, pred, user_data=NULL, limit=NULL)
	GtkTextIter *iter
	SV * pred
	SV * user_data
	GtkTextIter_ornull *limit
    ALIAS:
	backward_find_char = 1
    PREINIT:
	GPerlCallback * callback;
    CODE:
	callback = create_text_char_predicate_callback (pred, user_data);
	if (ix == 1)
		RETVAL = gtk_text_iter_backward_find_char
				(iter, gtk2perl_text_char_predicate,
				 callback, limit);
	else
		RETVAL = gtk_text_iter_forward_find_char
				(iter, gtk2perl_text_char_predicate,
				 callback, limit);
	gperl_callback_destroy (callback);
    OUTPUT:
	RETVAL

## gboolean gtk_text_iter_forward_search (const GtkTextIter *iter, const gchar *str, GtkTextSearchFlags flags, GtkTextIter *match_start, GtkTextIter *match_end, const GtkTextIter *limit)
#### gboolean gtk_text_iter_backward_search (const GtkTextIter *iter, const gchar *str, GtkTextSearchFlags flags, GtkTextIter *match_start, GtkTextIter *match_end, const GtkTextIter *limit)

=for apidoc backward_search
=for signature (match_start, match_end) = $iter->backward_search ($str, $flags, $limit=NULL)
=cut

=for apidoc
=for signature (match_start, match_end) = $iter->forward_search ($str, $flags, $limit=NULL)
=cut
void
gtk_text_iter_forward_search (iter, str, flags, limit=NULL)
	const GtkTextIter *iter
	const gchar *str
	GtkTextSearchFlags flags
	GtkTextIter_ornull *limit
    ALIAS:
	backward_search = 1
    PREINIT:
	GtkTextIter match_start;
	GtkTextIter match_end;
	gboolean (*searchfunc) (const GtkTextIter*, const gchar*,
	                        GtkTextSearchFlags, GtkTextIter*, GtkTextIter*,
	                        const GtkTextIter*);
    PPCODE:
	searchfunc = ix == 1
	           ? gtk_text_iter_backward_search
	           : gtk_text_iter_forward_search;
	if (! searchfunc (iter, str, flags, &match_start, &match_end, limit))
		XSRETURN_EMPTY;
	EXTEND (SP, 2);
	PUSHs (sv_2mortal (newSVGtkTextIter_copy (&match_start)));
	PUSHs (sv_2mortal (newSVGtkTextIter_copy (&match_end)));


## gboolean gtk_text_iter_equal (const GtkTextIter *lhs, const GtkTextIter *rhs)
gboolean
gtk_text_iter_equal (lhs, rhs)
	GtkTextIter *lhs
	GtkTextIter *rhs

## gint gtk_text_iter_compare (const GtkTextIter *lhs, const GtkTextIter *rhs)
gint
gtk_text_iter_compare (lhs, rhs)
	GtkTextIter *lhs
	GtkTextIter *rhs

## gboolean gtk_text_iter_in_range (const GtkTextIter *iter, const GtkTextIter *start, const GtkTextIter *end)
gboolean
gtk_text_iter_in_range (iter, start, end)
	GtkTextIter *iter
	GtkTextIter *start
	GtkTextIter *end

## void gtk_text_iter_order (GtkTextIter *first, GtkTextIter *second)
void
gtk_text_iter_order (first, second)
	GtkTextIter *first
	GtkTextIter *second

#if GTK_CHECK_VERSION (2, 8, 0)

gboolean gtk_text_iter_forward_visible_line (GtkTextIter *iter);

gboolean gtk_text_iter_backward_visible_line (GtkTextIter *iter);

gboolean gtk_text_iter_forward_visible_lines (GtkTextIter *iter, gint count);

gboolean gtk_text_iter_backward_visible_lines (GtkTextIter *iter, gint count);

#endif