This file is indexed.

/usr/include/d/gtkd-3/gtk/EntryBuffer.d is in libgtkd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
/*
 * This file is part of gtkD.
 *
 * gtkD is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 3
 * of the License, or (at your option) any later version, with
 * some exceptions, please read the COPYING file.
 *
 * gtkD 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with gtkD; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
 */

// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage


module gtk.EntryBuffer;

private import glib.ConstructionException;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gtk.c.functions;
public  import gtk.c.types;
public  import gtkc.gtktypes;
private import std.algorithm;


/**
 * The #GtkEntryBuffer class contains the actual text displayed in a
 * #GtkEntry widget.
 * 
 * A single #GtkEntryBuffer object can be shared by multiple #GtkEntry
 * widgets which will then share the same text content, but not the cursor
 * position, visibility attributes, icon etc.
 * 
 * #GtkEntryBuffer may be derived from. Such a derived class might allow
 * text to be stored in an alternate location, such as non-pageable memory,
 * useful in the case of important passwords. Or a derived class could
 * integrate with an application’s concept of undo/redo.
 */
public class EntryBuffer : ObjectG
{
	/** the main Gtk struct */
	protected GtkEntryBuffer* gtkEntryBuffer;

	/** Get the main Gtk struct */
	public GtkEntryBuffer* getEntryBufferStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gtkEntryBuffer;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gtkEntryBuffer;
	}

	protected override void setStruct(GObject* obj)
	{
		gtkEntryBuffer = cast(GtkEntryBuffer*)obj;
		super.setStruct(obj);
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GtkEntryBuffer* gtkEntryBuffer, bool ownedRef = false)
	{
		this.gtkEntryBuffer = gtkEntryBuffer;
		super(cast(GObject*)gtkEntryBuffer, ownedRef);
	}


	/** */
	public static GType getType()
	{
		return gtk_entry_buffer_get_type();
	}

	/**
	 * Create a new GtkEntryBuffer object.
	 *
	 * Optionally, specify initial text to set in the buffer.
	 *
	 * Params:
	 *     initialChars = initial buffer text, or %NULL
	 *     nInitialChars = number of characters in @initial_chars, or -1
	 *
	 * Returns: A new GtkEntryBuffer object.
	 *
	 * Since: 2.18
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(string initialChars, int nInitialChars)
	{
		auto p = gtk_entry_buffer_new(Str.toStringz(initialChars), nInitialChars);

		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}

		this(cast(GtkEntryBuffer*) p, true);
	}

	/**
	 * Deletes a sequence of characters from the buffer. @n_chars characters are
	 * deleted starting at @position. If @n_chars is negative, then all characters
	 * until the end of the text are deleted.
	 *
	 * If @position or @n_chars are out of bounds, then they are coerced to sane
	 * values.
	 *
	 * Note that the positions are specified in characters, not bytes.
	 *
	 * Params:
	 *     position = position at which to delete text
	 *     nChars = number of characters to delete
	 *
	 * Returns: The number of characters deleted.
	 *
	 * Since: 2.18
	 */
	public uint deleteText(uint position, int nChars)
	{
		return gtk_entry_buffer_delete_text(gtkEntryBuffer, position, nChars);
	}

	/**
	 * Used when subclassing #GtkEntryBuffer
	 *
	 * Params:
	 *     position = position at which text was deleted
	 *     nChars = number of characters deleted
	 *
	 * Since: 2.18
	 */
	public void emitDeletedText(uint position, uint nChars)
	{
		gtk_entry_buffer_emit_deleted_text(gtkEntryBuffer, position, nChars);
	}

	/**
	 * Used when subclassing #GtkEntryBuffer
	 *
	 * Params:
	 *     position = position at which text was inserted
	 *     chars = text that was inserted
	 *     nChars = number of characters inserted
	 *
	 * Since: 2.18
	 */
	public void emitInsertedText(uint position, string chars, uint nChars)
	{
		gtk_entry_buffer_emit_inserted_text(gtkEntryBuffer, position, Str.toStringz(chars), nChars);
	}

	/**
	 * Retrieves the length in bytes of the buffer.
	 * See gtk_entry_buffer_get_length().
	 *
	 * Returns: The byte length of the buffer.
	 *
	 * Since: 2.18
	 */
	public size_t getBytes()
	{
		return gtk_entry_buffer_get_bytes(gtkEntryBuffer);
	}

	/**
	 * Retrieves the length in characters of the buffer.
	 *
	 * Returns: The number of characters in the buffer.
	 *
	 * Since: 2.18
	 */
	public uint getLength()
	{
		return gtk_entry_buffer_get_length(gtkEntryBuffer);
	}

	/**
	 * Retrieves the maximum allowed length of the text in
	 * @buffer. See gtk_entry_buffer_set_max_length().
	 *
	 * Returns: the maximum allowed number of characters
	 *     in #GtkEntryBuffer, or 0 if there is no maximum.
	 *
	 * Since: 2.18
	 */
	public int getMaxLength()
	{
		return gtk_entry_buffer_get_max_length(gtkEntryBuffer);
	}

	/**
	 * Retrieves the contents of the buffer.
	 *
	 * The memory pointer returned by this call will not change
	 * unless this object emits a signal, or is finalized.
	 *
	 * Returns: a pointer to the contents of the widget as a
	 *     string. This string points to internally allocated
	 *     storage in the buffer and must not be freed, modified or
	 *     stored.
	 *
	 * Since: 2.18
	 */
	public string getText()
	{
		return Str.toString(gtk_entry_buffer_get_text(gtkEntryBuffer));
	}

	/**
	 * Inserts @n_chars characters of @chars into the contents of the
	 * buffer, at position @position.
	 *
	 * If @n_chars is negative, then characters from chars will be inserted
	 * until a null-terminator is found. If @position or @n_chars are out of
	 * bounds, or the maximum buffer text length is exceeded, then they are
	 * coerced to sane values.
	 *
	 * Note that the position and length are in characters, not in bytes.
	 *
	 * Params:
	 *     position = the position at which to insert text.
	 *     chars = the text to insert into the buffer.
	 *     nChars = the length of the text in characters, or -1
	 *
	 * Returns: The number of characters actually inserted.
	 *
	 * Since: 2.18
	 */
	public uint insertText(uint position, string chars, int nChars)
	{
		return gtk_entry_buffer_insert_text(gtkEntryBuffer, position, Str.toStringz(chars), nChars);
	}

	/**
	 * Sets the maximum allowed length of the contents of the buffer. If
	 * the current contents are longer than the given length, then they
	 * will be truncated to fit.
	 *
	 * Params:
	 *     maxLength = the maximum length of the entry buffer, or 0 for no maximum.
	 *         (other than the maximum length of entries.) The value passed in will
	 *         be clamped to the range 0-65536.
	 *
	 * Since: 2.18
	 */
	public void setMaxLength(int maxLength)
	{
		gtk_entry_buffer_set_max_length(gtkEntryBuffer, maxLength);
	}

	/**
	 * Sets the text in the buffer.
	 *
	 * This is roughly equivalent to calling gtk_entry_buffer_delete_text()
	 * and gtk_entry_buffer_insert_text().
	 *
	 * Note that @n_chars is in characters, not in bytes.
	 *
	 * Params:
	 *     chars = the new text
	 *     nChars = the number of characters in @text, or -1
	 *
	 * Since: 2.18
	 */
	public void setText(string chars, int nChars)
	{
		gtk_entry_buffer_set_text(gtkEntryBuffer, Str.toStringz(chars), nChars);
	}

	protected class OnDeletedTextDelegateWrapper
	{
		void delegate(uint, uint, EntryBuffer) dlg;
		gulong handlerId;

		this(void delegate(uint, uint, EntryBuffer) dlg)
		{
			this.dlg = dlg;
			onDeletedTextListeners ~= this;
		}

		void remove(OnDeletedTextDelegateWrapper source)
		{
			foreach(index, wrapper; onDeletedTextListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onDeletedTextListeners[index] = null;
					onDeletedTextListeners = std.algorithm.remove(onDeletedTextListeners, index);
					break;
				}
			}
		}
	}
	OnDeletedTextDelegateWrapper[] onDeletedTextListeners;

	/**
	 * This signal is emitted after text is deleted from the buffer.
	 *
	 * Params:
	 *     position = the position the text was deleted at.
	 *     nChars = The number of characters that were deleted.
	 *
	 * Since: 2.18
	 */
	gulong addOnDeletedText(void delegate(uint, uint, EntryBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnDeletedTextDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"deleted-text",
			cast(GCallback)&callBackDeletedText,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackDeletedTextDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackDeletedText(GtkEntryBuffer* entrybufferStruct, uint position, uint nChars, OnDeletedTextDelegateWrapper wrapper)
	{
		wrapper.dlg(position, nChars, wrapper.outer);
	}

	extern(C) static void callBackDeletedTextDestroy(OnDeletedTextDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}

	protected class OnInsertedTextDelegateWrapper
	{
		void delegate(uint, string, uint, EntryBuffer) dlg;
		gulong handlerId;

		this(void delegate(uint, string, uint, EntryBuffer) dlg)
		{
			this.dlg = dlg;
			onInsertedTextListeners ~= this;
		}

		void remove(OnInsertedTextDelegateWrapper source)
		{
			foreach(index, wrapper; onInsertedTextListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onInsertedTextListeners[index] = null;
					onInsertedTextListeners = std.algorithm.remove(onInsertedTextListeners, index);
					break;
				}
			}
		}
	}
	OnInsertedTextDelegateWrapper[] onInsertedTextListeners;

	/**
	 * This signal is emitted after text is inserted into the buffer.
	 *
	 * Params:
	 *     position = the position the text was inserted at.
	 *     chars = The text that was inserted.
	 *     nChars = The number of characters that were inserted.
	 *
	 * Since: 2.18
	 */
	gulong addOnInsertedText(void delegate(uint, string, uint, EntryBuffer) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnInsertedTextDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"inserted-text",
			cast(GCallback)&callBackInsertedText,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackInsertedTextDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackInsertedText(GtkEntryBuffer* entrybufferStruct, uint position, char* chars, uint nChars, OnInsertedTextDelegateWrapper wrapper)
	{
		wrapper.dlg(position, Str.toString(chars), nChars, wrapper.outer);
	}

	extern(C) static void callBackInsertedTextDestroy(OnInsertedTextDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}
}