File: GtkEntry.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 (353 lines) | stat: -rw-r--r-- 9,494 bytes parent folder | download | duplicates (3)
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
/*
 * Copyright (c) 2003-2006 by the gtk2-perl team (see the file AUTHORS)
 *
 * 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.1 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., 59 Temple Place - Suite 330, 
 * Boston, MA  02111-1307  USA.
 *
 * $Id$
 */

#include "gtk2perl.h"

static GPerlBoxedWrapperClass gtk_border_wrapper_class;

static SV *
gtk2perl_border_wrap (GType gtype, const char * package, gpointer boxed, gboolean own)
{
	GtkBorder *border = boxed;
	HV *hv;

	PERL_UNUSED_VAR (gtype);
	PERL_UNUSED_VAR (package);

	if (!border)
		return &PL_sv_undef;

	hv = newHV ();

	gperl_hv_take_sv_s (hv, "left", newSViv (border->left));
	gperl_hv_take_sv_s (hv, "right", newSViv (border->right));
	gperl_hv_take_sv_s (hv, "top", newSViv (border->top));
	gperl_hv_take_sv_s (hv, "bottom", newSViv (border->bottom));

	if (own)
		gtk_border_free (border);

	return newRV_noinc ((SV *) hv);
}

/* This uses gperl_alloc_temp so make sure you don't hold on to pointers
 * returned by SvGtkBorder for too long. */
static gpointer
gtk2perl_border_unwrap (GType gtype, const char * package, SV * sv)
{
	HV *hv;
	SV **value;
	GtkBorder *border;

	PERL_UNUSED_VAR (gtype);
	PERL_UNUSED_VAR (package);

	if (!gperl_sv_is_defined (sv) || !SvRV (sv))
		return NULL;

	if (!gperl_sv_is_hash_ref (sv))
		croak ("GtkBorder must be a hash reference with four keys: "
		       "left, right, top, bottom");

	hv = (HV *) SvRV (sv);

	border = gperl_alloc_temp (sizeof (GtkBorder));

	value = hv_fetch (hv, "left", 4, 0);
	if (value && gperl_sv_is_defined (*value))
		border->left = SvIV (*value);

	value = hv_fetch (hv, "right", 5, 0);
	if (value && gperl_sv_is_defined (*value))
		border->right = SvIV (*value);

	value = hv_fetch (hv, "top", 3, 0);
	if (value && gperl_sv_is_defined (*value))
		border->top = SvIV (*value);

	value = hv_fetch (hv, "bottom", 6, 0);
	if (value && gperl_sv_is_defined (*value))
		border->bottom = SvIV (*value);

	return border;
}

MODULE = Gtk2::Entry	PACKAGE = Gtk2::Entry	PREFIX = gtk_entry_

BOOT:
	gperl_prepend_isa ("Gtk2::Entry", "Gtk2::CellEditable");
	gperl_prepend_isa ("Gtk2::Entry", "Gtk2::Editable");
	gtk_border_wrapper_class = * gperl_default_boxed_wrapper_class ();
	gtk_border_wrapper_class.wrap = gtk2perl_border_wrap;
	gtk_border_wrapper_class.unwrap = gtk2perl_border_unwrap;
	gperl_register_boxed (GTK_TYPE_BORDER, "Gtk2::Border",
	                      &gtk_border_wrapper_class);

GtkWidget*
gtk_entry_new (class)
    C_ARGS:
	/* void */

##GtkWidget* gtk_entry_new_with_max_length (gint max)
GtkWidget *
gtk_entry_new_with_max_length (class, max)
	gint   max
    C_ARGS:
	max

void
gtk_entry_set_visibility (entry, visible)
	GtkEntry *entry
	gboolean visible

gboolean
gtk_entry_get_visibility (entry)
	GtkEntry *entry

 ## void gtk_entry_set_invisible_char (GtkEntry *entry, gunichar ch)
void
gtk_entry_set_invisible_char (entry, ch)
	GtkEntry *entry
	gunichar ch

 ## gunichar gtk_entry_get_invisible_char (GtkEntry *entry)
gunichar
gtk_entry_get_invisible_char (entry)
	GtkEntry *entry

void
gtk_entry_set_has_frame (entry, setting)
	GtkEntry *entry
	gboolean setting

gboolean
gtk_entry_get_has_frame (entry)
	GtkEntry *entry

void
gtk_entry_set_max_length (entry, max)
	GtkEntry      *entry
	gint           max

gint
gtk_entry_get_max_length (entry)
	GtkEntry *entry

void
gtk_entry_set_activates_default (entry, setting)
	GtkEntry *entry
	gboolean setting

gboolean
gtk_entry_get_activates_default (entry)
	GtkEntry *entry

void
gtk_entry_set_width_chars (entry, n_chars)
	GtkEntry *entry
	gint n_chars

gint
gtk_entry_get_width_chars (entry)
	GtkEntry *entry

void
gtk_entry_set_text (entry, text)
	GtkEntry      *entry
	const gchar   *text

# had G_CONST_RETURN
const gchar*
gtk_entry_get_text (entry)
	GtkEntry      *entry

PangoLayout*
gtk_entry_get_layout (entry)
	GtkEntry *entry

 ## void gtk_entry_get_layout_offsets (GtkEntry *entry, gint *x, gint *y)
void
gtk_entry_get_layout_offsets (GtkEntry *entry, OUTLIST gint x, OUTLIST gint y)

#if GTK_CHECK_VERSION(2,4,0)

void gtk_entry_set_completion (GtkEntry *entry, GtkEntryCompletion_ornull *completion);

GtkEntryCompletion_ornull *gtk_entry_get_completion (GtkEntry *entry);

void gtk_entry_set_alignment (GtkEntry *entry, gfloat xalign);

gfloat gtk_entry_get_alignment (GtkEntry *entry);

#endif

#if GTK_CHECK_VERSION(2, 6, 0)

gint gtk_entry_layout_index_to_text_index (GtkEntry *entry, gint layout_index)

gint gtk_entry_text_index_to_layout_index (GtkEntry *entry, gint text_index)

#endif

#if GTK_CHECK_VERSION(2, 10, 0)

void gtk_entry_set_inner_border (GtkEntry *entry, const GtkBorder_ornull *border);

const GtkBorder_ornull * gtk_entry_get_inner_border (GtkEntry *entry);

#endif

#if GTK_CHECK_VERSION(2, 12, 0)

void gtk_entry_set_cursor_hadjustment (GtkEntry *entry, GtkAdjustment_ornull *adjustment);

GtkAdjustment_ornull* gtk_entry_get_cursor_hadjustment (GtkEntry *entry);

#endif

#if GTK_CHECK_VERSION (2, 14, 0)

void gtk_entry_set_overwrite_mode (GtkEntry *entry, gboolean overwrite);

gboolean gtk_entry_get_overwrite_mode (GtkEntry *entry);

guint16 gtk_entry_get_text_length (GtkEntry *entry);

#endif /* 2.14 */

#if GTK_CHECK_VERSION (2, 16, 0)

#
# FIXME: Missing typemap, actually I don't think that gio is available through Perl
#
# GIcon_ornull* gtk_entry_get_gicon (GtkEntry *entry, GtkEntryIconPosition icon_pos);
# void gtk_entry_set_icon_from_gicon (GtkEntry *entry, GtkEntryIconPosition icon_pos, GIcon_ornull *icon);
#

gboolean gtk_entry_get_icon_activatable (GtkEntry *entry, GtkEntryIconPosition icon_pos);

gint gtk_entry_get_icon_at_pos (GtkEntry *entry, gint x, gint y);

const gchar_ornull* gtk_entry_get_icon_name (GtkEntry *entry, GtkEntryIconPosition icon_pos);

gboolean gtk_entry_get_icon_sensitive (GtkEntry *entry, GtkEntryIconPosition icon_pos);

GdkPixbuf_ornull* gtk_entry_get_icon_pixbuf (GtkEntry *entry, GtkEntryIconPosition icon_pos);

gdouble gtk_entry_get_progress_fraction (GtkEntry *entry);

gdouble gtk_entry_get_progress_pulse_step (GtkEntry *entry);

void gtk_entry_progress_pulse (GtkEntry *entry);

const gchar_ornull* gtk_entry_get_icon_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos);

GtkImageType gtk_entry_get_icon_storage_type (GtkEntry *entry, GtkEntryIconPosition icon_pos);

void gtk_entry_set_icon_activatable (GtkEntry *entry, GtkEntryIconPosition icon_pos, gboolean activatable);

void gtk_entry_set_icon_from_icon_name (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar_ornull *icon_name);

void gtk_entry_set_icon_from_pixbuf (GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkPixbuf_ornull *pixbuf);

void gtk_entry_set_icon_from_stock (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar_ornull *stock_id);

void gtk_entry_set_icon_sensitive (GtkEntry *entry, GtkEntryIconPosition icon_pos, gboolean sensitive);

void gtk_entry_set_icon_tooltip_markup (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar_ornull *tooltip);

gchar_own_ornull * gtk_entry_get_icon_tooltip_markup (GtkEntry *entry, GtkEntryIconPosition icon_pos);

void gtk_entry_set_icon_tooltip_text (GtkEntry *entry, GtkEntryIconPosition icon_pos, const gchar_ornull *tooltip);

gchar_own_ornull * gtk_entry_get_icon_tooltip_text (GtkEntry *entry, GtkEntryIconPosition icon_pos);

void gtk_entry_set_progress_fraction (GtkEntry *entry, gdouble fraction);

void gtk_entry_set_progress_pulse_step (GtkEntry *entry, gdouble fraction);

void gtk_entry_unset_invisible_char (GtkEntry *entry);

void gtk_entry_set_icon_drag_source (GtkEntry *entry, GtkEntryIconPosition icon_pos, GtkTargetList *target_list, GdkDragAction actions);

gint gtk_entry_get_current_icon_drag_source (GtkEntry *entry);

#endif /* 2.16 */

#if GTK_CHECK_VERSION (2, 18, 0)

GtkWidget *gtk_entry_new_with_buffer (class, GtkEntryBuffer *buffer)
    C_ARGS:
	buffer

GtkEntryBuffer *gtk_entry_get_buffer (GtkEntry *entry);

void gtk_entry_set_buffer (GtkEntry *entry, GtkEntryBuffer *buffer);

#endif /* 2.18 */

#if GTK_CHECK_VERSION (2, 20, 0)

GdkWindow * gtk_entry_get_icon_window (GtkEntry *entry, GtkEntryIconPosition icon_pos);

GdkWindow * gtk_entry_get_text_window (GtkEntry *entry);

#endif /* 2.20 */

#if GTK_CHECK_VERSION (2, 22, 0)

gboolean gtk_entry_im_context_filter_keypress (GtkEntry *entry, GdkEvent *event);
    C_ARGS:
	entry, (GdkEventKey *) event

void gtk_entry_reset_im_context (GtkEntry *entry);

#endif /* 2.22 */

##
## hey, these are deprecated!  is that new as of 2.3.x?
##

void
gtk_entry_append_text (entry, text)
	GtkEntry    * entry
	const gchar * text

void
gtk_entry_prepend_text (entry, text)
	GtkEntry    * entry
	const gchar * text

void
gtk_entry_set_position (entry, position)
	GtkEntry * entry
	gint       position

void
gtk_entry_select_region (entry, start, end)
	GtkEntry * entry
	gint       start
	gint       end

void
gtk_entry_set_editable (entry, editable)
	GtkEntry * entry
	gboolean   editable