File: GtkCList.xs

package info (click to toggle)
libgtk-perl 0.1.17-1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,352 kB
  • ctags: 1,100
  • sloc: ansic: 4,393; perl: 3,463; makefile: 36
file content (354 lines) | stat: -rw-r--r-- 6,074 bytes parent folder | download
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

#include "EXTERN.h"
#include "perl.h"
#include "XSUB.h"

#include <gtk/gtk.h>

#include "GtkTypes.h"
#include "GdkTypes.h"
#include "MiscTypes.h"

#include "GtkDefs.h"

#ifndef boolSV
# define boolSV(b) ((b) ? &sv_yes : &sv_no)
#endif

static void
svrefcnt_dec(gpointer data) {
	SvREFCNT_dec((SV*)data);
}

MODULE = Gtk::CList		PACKAGE = Gtk::CList		PREFIX = gtk_clist_

#ifdef GTK_CLIST

Gtk::CList_Sink
new(Class, columns)
	SV* Class
	int columns
	CODE:
	RETVAL = GTK_CLIST(gtk_clist_new(columns));
	OUTPUT:
	RETVAL

Gtk::CList_Sink
new_with_titles(Class, title, ...)
	SV *    Class
	SV *	title
	CODE:
	{
		int columns = items - 1;
		int i;
		char** titles = malloc(columns * sizeof(gchar*));
		for (i=1; i < items; ++i)
			titles[i-1] = SvPV(ST(i),na);
		RETVAL = GTK_CLIST(gtk_clist_new_with_titles(columns, titles));
		free(titles);
	}
	OUTPUT:
	RETVAL

void
gtk_clist_set_border(self, border)
	Gtk::CList	self
	Gtk::ShadowType	border

void
gtk_clist_set_selection_mode(self, mode)
	Gtk::CList	self
	Gtk::SelectionMode	mode

void
gtk_clist_set_policy(self, vscrollbar_policy, hscrollbar_policy)
	Gtk::CList	self
	Gtk::PolicyType	hscrollbar_policy
	Gtk::PolicyType	vscrollbar_policy

void
gtk_clist_freeze(self)
	Gtk::CList	self

void
gtk_clist_thaw(self)
	Gtk::CList	self

void
gtk_clist_column_titles_show (self)
	Gtk::CList  self

void
gtk_clist_column_titles_hide (self)
	Gtk::CList  self

void
gtk_clist_column_title_active (self, column)
	Gtk::CList  self
	int column

void
gtk_clist_column_title_passive (self, column)
	Gtk::CList  self
	int column

void
gtk_clist_column_titles_active (self)
	Gtk::CList  self

void
gtk_clist_column_titles_passive (self)
	Gtk::CList  self

void
gtk_clist_set_column_title(self, column, title)
	Gtk::CList	self
	int		column
	char*	title

void
gtk_clist_set_column_widget(self, column, widget)
	Gtk::CList	self
	int		column
	Gtk::Widget	widget

void
gtk_clist_set_column_justification(self, column, justification)
	Gtk::CList	self
	int		column
	Gtk::Justification	justification

void
gtk_clist_set_column_width(self, column, width)
	Gtk::CList	self
	int		column
	int		width

void
gtk_clist_set_row_height(self, height)
	Gtk::CList  self
	int		height

void
gtk_clist_moveto(self, row, column, row_align, column_align)
	Gtk::CList  self
	int		row
	int		column
	double	row_align
	double	column_align

bool
gtk_clist_row_is_visible (self, row)
	Gtk::CList  self
	int     row

Gtk::CellType
gtk_clist_get_cell_type (self, row, column)
	Gtk::CList  self
	int		row
	int		column

void
gtk_clist_set_text(self, row, column, text)
	Gtk::CList  self
	int		row
	int		column
	char*	text

char*
gtk_clist_get_text (self, row, column)
	Gtk::CList  self
	int		row
	int		column
	CODE:
	{
		gchar* text=NULL;
		gtk_clist_get_text(self, row, column, &text);
		RETVAL = text;
	}
	OUTPUT:
	RETVAL

void
gtk_clist_set_pixmap(self, row, column, pixmap, mask)
	Gtk::CList  self
	int		row
	int		column
	Gtk::Gdk::Pixmap		pixmap
	Gtk::Gdk::Bitmap	mask

void
gtk_clist_get_pixmap (self, row, column)
	Gtk::CList  self
	int		row
	int		column
	PPCODE:
	{
		GdkPixmap * pixmap = NULL;
		GdkBitmap * bitmap = NULL;
		int result;
		result = gtk_clist_get_pixmap(self, row, column, &pixmap, (GIMME == G_ARRAY) ?&bitmap: NULL);
		if ( result ) {
			if ( pixmap ) {
				EXTEND(sp, 1);
				PUSHs(sv_2mortal(newSVGdkPixmap(pixmap)));
			}
			if (bitmap ) {
				EXTEND(sp, 1);
				PUSHs(sv_2mortal(newSVGdkBitmap(bitmap)));
			}
		}
	}

void
gtk_clist_set_pixtext(self, row, column, text, spacing, pixmap, mask)
	Gtk::CList  self
	int		row
	int		column
	char*	text
	int		spacing
	Gtk::Gdk::Pixmap	pixmap
	Gtk::Gdk::Bitmap	mask

void
gtk_clist_get_pixtext (self, row, column)
	Gtk::CList  self
	int		row
	int		column
	PPCODE:
	{
		gchar* text = NULL;
		guint8 spacing;
		GdkPixmap * pixmap = NULL;
		GdkBitmap * bitmap = NULL;
		int result;
		/* FIXME: require GIMME == G_ARRAY? */
		result = gtk_clist_get_pixtext(self, row, column, &text, &spacing, &pixmap, &bitmap);
		if ( result ) {
			EXTEND(sp, 4);
			if ( text )
				PUSHs(sv_2mortal(newSVpv(text, 0)));
			else
				PUSHs(sv_2mortal(newSVsv(&sv_undef)));
			PUSHs(sv_2mortal(newSViv(spacing)));
			if ( pixmap )
				PUSHs(sv_2mortal(newSVGdkPixmap(pixmap)));
			else
				PUSHs(sv_2mortal(newSVsv(&sv_undef)));
			if (bitmap )
				PUSHs(sv_2mortal(newSVGdkBitmap(bitmap)));
			else
				PUSHs(sv_2mortal(newSVsv(&sv_undef)));
		}
	}


void
gtk_clist_set_foreground(self, row, color)
	Gtk::CList  self
	int		row
	Gtk::Gdk::Color	color

void
gtk_clist_set_background(self, row, color)
	Gtk::CList  self
	int		row
	Gtk::Gdk::Color	color

void
gtk_clist_set_shift(self, row, column, verticle, horizontal)
	Gtk::CList  self
	int		row
	int		column
	int 	verticle
	int		horizontal

int
gtk_clist_append(self, text, ...)
	Gtk::CList  self
	SV *	text
	CODE:
	{
		int num = items-1;
		int i;
		char** val = malloc(num*sizeof(char*));
		for (i=1; i < items; ++i)
			val[i-1] = SvPV(ST(i),na);
		RETVAL = gtk_clist_append(self, val);
		free(val);
	}
	OUTPUT:
	RETVAL

void
gtk_clist_insert(self, row, text, ...)
	Gtk::CList  self
	int		row
	SV *	text
	CODE:
	{
		int num = items-2;
		int i;
		char** val = malloc(num*sizeof(char*));
		for (i=2; i < items; ++i)
			val[i-2] = SvPV(ST(i),na);
		gtk_clist_insert(self, row, val);
		free(val);
	}

void
gtk_clist_remove(self, row)
	Gtk::CList  self
	int		row

void
gtk_clist_set_row_data(self, row, data)
	Gtk::CList  self
	int		row
	SV *	data
	CODE:
	gtk_clist_set_row_data_full(self, row, data, svrefcnt_dec);

SV*
gtk_clist_get_row_data(self, row)
	Gtk::CList  self
	int		row

int
gtk_clist_find_row_from_data (self, data)
	Gtk::CList  self
	SV *    data

void
gtk_clist_select_row(self, row, column)
	Gtk::CList  self
	int		row
	int		column

void
gtk_clist_unselect_row(self, row, column)
	Gtk::CList  self
	int		row
	int		column

void
gtk_clist_clear(self)
	Gtk::CList  self

#if 0

void
gtk_clist_get_selection_info (self, x, y)
	Gtk::CList  self
	int x
	int y
	PPCODE:
	{
		int row, column;
		gtk_clist_get_selection_info (self, x, y, &row, &column);
	}

#endif

#endif