File: rep-gtk.h

package info (click to toggle)
rep-gtk 0.15-3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 728 kB
  • ctags: 349
  • sloc: ansic: 3,577; sh: 2,430; lisp: 1,102; makefile: 159
file content (322 lines) | stat: -rw-r--r-- 10,513 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
/* Copyright (C) 1997, 1998, 1999 Marius Vollmer
 * Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
 *
 * $Id: rep-gtk.h,v 1.16 2000/07/09 11:05:02 john Exp $
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 * 
 * This program 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */

#ifndef REP_GTK_H
#define REP_GTK_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <rep.h>
#include <gtk/gtk.h>

typedef struct _sgtk_type_info {
  char *name;
  GtkType type;
  repv (*conversion) (repv);
} sgtk_type_info;

typedef struct _sgtk_enum_literal {
  char *name;
  int value;
} sgtk_enum_literal;

typedef struct _sgtk_enum_info {
  sgtk_type_info header;
  int n_literals;
  sgtk_enum_literal *literals;
} sgtk_enum_info;

/* This is like an _sgtk_enum_literal, but the values are strings.
   This is used in Gnome.  */
typedef struct _sgtk_senum_literal {
  char *name;
  char *value;
} sgtk_senum_literal;

typedef struct _sgtk_senum_info {
  sgtk_type_info header;
  int n_literals;
  sgtk_senum_literal *literals;
} sgtk_senum_info;

typedef struct _sgtk_boxed_info {
  sgtk_type_info header;
  void *(*copy) (void *);
  void (*destroy) (void *);
  size_t size;
} sgtk_boxed_info;

typedef struct _sgtk_object_info {
  sgtk_type_info header;
  GtkType (*init_func) ();

  struct _sgtk_object_info *parent;
  guint n_args;
  GtkArg *args;
  guint *args_flags;
  char **args_short_names;
} sgtk_object_info;

void sgtk_register_type_infos (sgtk_type_info **infos);
sgtk_type_info *sgtk_get_type_info (guint type_seqno);
void sgtk_register_type_infos_gtk (GtkTypeInfo **infos);
sgtk_type_info* sgtk_maybe_find_type_info (GtkType type);
sgtk_type_info *sgtk_find_type_info (GtkType type);

int sgtk_valid_int (repv obj);
int sgtk_valid_uint (repv obj);
int sgtk_valid_long (repv obj);
int sgtk_valid_ulong (repv obj);
int sgtk_valid_char (repv obj);
repv sgtk_uint_to_rep (u_long x);
repv sgtk_int_to_rep (long x);
repv sgtk_long_to_rep (long x);
repv sgtk_ulong_to_rep (u_long x);
guint sgtk_rep_to_uint (repv obj);
gint sgtk_rep_to_int (repv obj);
gulong sgtk_rep_to_ulong (repv obj);
glong sgtk_rep_to_long (repv obj);
gchar sgtk_rep_to_char (repv obj);
repv sgtk_char_to_rep (gchar c);
char *sgtk_rep_to_string (repv obj);
repv sgtk_string_to_rep (char *x);
repv sgtk_static_string_to_rep (const char *x);
int sgtk_valid_string (repv obj);
repv sgtk_bool_to_rep (int x);
int sgtk_rep_to_bool (repv obj);
int sgtk_valid_function (repv obj);
int sgtk_valid_fd (repv obj);
int sgtk_rep_to_fd (repv obj);
repv sgtk_fd_to_rep (int fd);

repv sgtk_wrap_gtkobj (GtkObject *obj);
int sgtk_is_a_gtkobj (guint type, repv obj);
GtkObject *sgtk_get_gtkobj (repv obj);

int sgtk_valid_enum (repv obj, sgtk_enum_info*);
repv sgtk_enum_to_rep (gint val, sgtk_enum_info*);
gint sgtk_rep_to_enum (repv obj, sgtk_enum_info*);

int sgtk_valid_flags (repv obj, sgtk_enum_info*);
repv sgtk_flags_to_rep (gint val, sgtk_enum_info*);
gint sgtk_rep_to_flags (repv obj, sgtk_enum_info*);

int sgtk_valid_senum (repv obj, sgtk_senum_info*);
repv sgtk_senum_to_rep (char *val, sgtk_senum_info*);
char *sgtk_rep_to_senum (repv obj, sgtk_senum_info*);

repv sgtk_boxed_to_rep (gpointer ptr, sgtk_boxed_info*, int copyp);
void *sgtk_rep_to_boxed (repv obj);
int sgtk_valid_boxed (repv obj, sgtk_boxed_info*);

int sgtk_valid_float (repv obj);
gfloat sgtk_rep_to_float (repv obj);
repv sgtk_float_to_rep (gfloat f);

int sgtk_valid_double (repv obj);
double sgtk_rep_to_double (repv obj);
repv sgtk_double_to_rep (double f);

int sgtk_valid_pointer (repv obj);
void *sgtk_rep_to_pointer (repv obj);
repv sgtk_pointer_to_rep (void *ptr);

int sgtk_valid_point (repv obj);
GdkPoint sgtk_rep_to_point (repv obj);
repv sgtk_point_to_rep (GdkPoint p);

int sgtk_valid_rect (repv obj);
GdkRectangle sgtk_rep_to_rect (repv obj);
repv sgtk_rect_to_rep (GdkRectangle p);

GtkType sgtk_type_from_name (char *name);
int sgtk_valid_type (repv obj);
GtkType sgtk_rep_to_type (repv obj);
repv sgtk_type_to_rep (GtkType t);

int sgtk_valid_composite (repv obj, int (*predicate)(repv));
int sgtk_valid_complen (repv obj, int (*predicate)(repv), int len);

repv sgtk_slist_to_rep (GSList *list, repv (*torep)(void*));
GSList *sgtk_rep_to_slist (repv obj, void (*fromrep)(repv, void*));
void sgtk_slist_finish (GSList *list, repv obj, repv (*torep)(void*));

repv sgtk_list_to_rep (GList *list, repv (*torep)(void*));
GList *sgtk_rep_to_list (repv obj, void (*fromrep)(repv, void*));
void sgtk_list_finish (GList *list, repv obj, repv (*torep)(void*));

typedef struct {
  int count;
  void *vec;
} sgtk_cvec;

sgtk_cvec sgtk_rep_to_cvec (repv obj, void (*fromrep)(repv, void*), size_t sz);
void sgtk_cvec_finish (sgtk_cvec *, repv obj, repv (*torep)(void*), size_t sz);
repv sgtk_cvec_to_rep (sgtk_cvec *cvec, repv (*toscm)(void *), size_t sz);

typedef struct sgtk_protshell sgtk_protshell;

void sgtk_set_protect (repv protector, sgtk_protshell *prot);
sgtk_protshell *sgtk_new_protect (repv obj);
sgtk_protshell *sgtk_protect (repv protector, repv obj);
void sgtk_unprotect (sgtk_protshell *);
repv sgtk_get_protect (sgtk_protshell *prot);

void sgtk_callback_marshal (GtkObject *,
			    gpointer data,
			    guint n_args,
			    GtkArg *args);
void sgtk_callback_destroy (gpointer data);
repv sgtk_callback_trampoline (repv new_trampoline);
void sgtk_callback_postfix (void);

int sgtk_valid_arg (GtkArg *, repv val);
repv sgtk_arg_to_rep (GtkArg *a, int free_mem);
void sgtk_rep_to_arg (GtkArg *a, repv obj, repv protector);
void sgtk_rep_to_ret (GtkArg *a, repv obj);

sgtk_object_info *sgtk_find_object_info_from_type (GtkType type);
sgtk_object_info *sgtk_find_object_info (char *name);
GtkArg *sgtk_build_args (sgtk_object_info *info, int *n_argsp,
			 repv rep_args, repv protector, char *subr);

repv sgtk_color_conversion (repv color);
repv sgtk_font_conversion (repv color);

void sgtk_set_standalone (int flag);
int sgtk_is_standalone (void);
repv sgtk_standalone_p (void);

void sgtk_init (void);
void sgtk_init_with_args (int *argcp, char ***argvp);

/* Additional useful Gdk routines. */

/* The following two do their magic with type conversions that are
   automatically generated by build-guile-gtk. */

GdkColor *gdk_color_intern (GdkColor *);
GdkFont *gdk_font_intern (GdkFont *);

GdkEventType gdk_event_type (GdkEvent *event);
GdkWindow *gdk_event_window (GdkEvent *event);
gboolean gdk_event_send_event (GdkEvent *event);
GdkRectangle *gdk_event_area (GdkEvent *event);
GdkVisibilityState gdk_event_visibility_state (GdkEvent *event);
guint32 gdk_event_time (GdkEvent *event);
gdouble gdk_event_x (GdkEvent *event);
gdouble gdk_event_y (GdkEvent *event);
gdouble gdk_event_pressure (GdkEvent *event);
gdouble gdk_event_xtilt (GdkEvent *event);
gdouble gdk_event_ytilt (GdkEvent *event);
gint gdk_event_button (GdkEvent *event);
gboolean gdk_event_button_state (GdkEvent *event);
gboolean gdk_event_is_hint (GdkEvent *event);
GdkInputSource gdk_event_source (GdkEvent *event);
guint32 gdk_event_deviceid (GdkEvent *event);
gdouble gdk_event_x_root (GdkEvent *event);
gdouble gdk_event_y_root (GdkEvent *event);
gboolean gdk_event_key_state (GdkEvent *event);
guint gdk_event_keyval (GdkEvent *event);
gchar *gdk_event_string (GdkEvent *event);
GdkWindow *gdk_event_subwindow (GdkEvent *event);
GdkNotifyType gdk_event_notify_detail (GdkEvent *event);
gboolean gdk_event_in (GdkEvent *event);
gint16 gdk_event_configure_x (GdkEvent *event);
gint16 gdk_event_configure_y (GdkEvent *event);
gint16 gdk_event_configure_width (GdkEvent *event);
gint16 gdk_event_configure_height (GdkEvent *event);

guint32 gdk_get_leader_window_id (void);

guint32 gdk_window_xid (GdkWindow *win);

GdkGC *gtk_style_fg_gc (GtkStyle *style, GtkStateType state);
GdkGC *gtk_style_bg_gc (GtkStyle *style, GtkStateType state);

/* Gtk stuff that wouldn't be here in an ideal world. */

#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 0
typedef int GtkWidgetFlags;
#endif

gchar *gtk_label_get_interp (GtkLabel *label);
void gtk_menu_popup_interp (GtkMenu *menu,
			    GtkWidget *parent_menu_shell,
			    GtkWidget *parent_menu_item,
			    gint button,
			    guint32 activate_time,
			    repv position);

GtkWidget*
gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group,
						gchar            *label);
GtkWidget* gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group);
GtkWidget* gtk_pixmap_new_interp (char *file, GtkWidget *intended_parent);

#ifndef HAVE_GDK_COLOR_COPY
GdkColor*    gdk_color_copy     (GdkColor *);
void         gdk_color_free     (GdkColor *);
#endif

GdkColor *gdk_color_parse_interp (char *spec);
GdkColor *gtk_style_get_white_interp (GtkStyle *style);

#ifndef HAVE_GTK_WIDGET_PEEK_COLORMAP
GdkColormap *gtk_widget_peek_colormap (void);
#endif

void gtk_list_append_item (GtkList *list, GtkListItem *item);

#ifndef HAVE_GTK_TYPE_GET_INFO
gboolean gtk_type_get_info (GtkType type, GtkTypeInfo *info);
#endif

GtkType gtk_class_new (GtkType parent_type, gchar *name);
guint
gtk_signal_new_generic (const gchar     *name,
			GtkSignalRunType signal_flags,
			GtkType          type,
			GtkType          return_type,
			guint            nparams,
			GtkType         *params);
void sgtk_signal_emit (GtkObject *obj, char *name, repv rep_args);

#ifndef HAVE_GTK_SIGNAL_SET_CLASS_FUNCTION_FULL
void gtk_signal_set_class_function_full (GtkType            type,
					 const gchar       *signal,
					 GtkSignalFunc      func,
					 GtkCallbackMarshal marshal,
					 gpointer           data,
					 GtkDestroyNotify   destroy_func);
#endif

void gtk_color_selection_set_color_interp (GtkColorSelection *sel, GdkColor *color);
GdkColor *gtk_color_selection_get_color_interp (GtkColorSelection *sel);
extern void gtk_widget_draw_interp (GtkWidget *widget);

repv sgtk_gtk_widget_get_allocation (GtkWidget *w);

extern rep_xsubr *sgtk_subrs[];
extern sgtk_type_info *sgtk_type_infos[];

#endif /* !REP_GTK_H */