source: trunk/third/rep-gtk/rep-gtk.h @ 21214

Revision 21214, 11.2 KB checked in by ghudson, 20 years ago (diff)
Adapt unholy redefinition of gtk functions to gtk 2.4.
Line 
1/* Copyright (C) 1997, 1998, 1999 Marius Vollmer
2 * Copyright (C) 1999 John Harper <john@dcs.warwick.ac.uk>
3 *
4 * $Id: rep-gtk.h,v 1.2 2004-12-28 17:30:00 ghudson Exp $
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this software; see the file COPYING.  If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef REP_GTK_H
22#define REP_GTK_H
23
24#ifdef HAVE_CONFIG_H
25#include <config.h>
26#endif
27
28#include <rep.h>
29#include <gtk/gtk.h>
30
31typedef struct _sgtk_type_info {
32  char *name;
33  GType type;
34  repv (*conversion) (repv);
35} sgtk_type_info;
36
37typedef struct _sgtk_enum_literal {
38  char *name;
39  int value;
40} sgtk_enum_literal;
41
42typedef struct _sgtk_enum_info {
43  sgtk_type_info header;
44  int n_literals;
45  sgtk_enum_literal *literals;
46} sgtk_enum_info;
47
48/* This is like an _sgtk_enum_literal, but the values are strings.
49   This is used in Gnome.  */
50typedef struct _sgtk_senum_literal {
51  char *name;
52  char *value;
53} sgtk_senum_literal;
54
55typedef struct _sgtk_senum_info {
56  sgtk_type_info header;
57  int n_literals;
58  sgtk_senum_literal *literals;
59} sgtk_senum_info;
60
61typedef struct _sgtk_boxed_info {
62  sgtk_type_info header;
63  void *(*copy) (void *);
64  void (*destroy) (void *);
65  size_t size;
66} sgtk_boxed_info;
67
68typedef struct _sgtk_object_info {
69  sgtk_type_info header;
70  GType (*init_func) ();
71
72  struct _sgtk_object_info *parent;
73} sgtk_object_info;
74
75void sgtk_register_type_infos (sgtk_type_info **infos);
76sgtk_type_info *sgtk_get_type_info (GType type_seqno);
77void sgtk_register_type_infos_gtk (GTypeInfo **infos);
78sgtk_type_info* sgtk_maybe_find_type_info (GType type);
79sgtk_type_info *sgtk_find_type_info (GType type);
80
81int sgtk_valid_int (repv obj);
82int sgtk_valid_uint (repv obj);
83int sgtk_valid_long (repv obj);
84int sgtk_valid_ulong (repv obj);
85int sgtk_valid_char (repv obj);
86repv sgtk_uint_to_rep (u_long x);
87repv sgtk_int_to_rep (long x);
88repv sgtk_long_to_rep (long x);
89repv sgtk_ulong_to_rep (u_long x);
90guint sgtk_rep_to_uint (repv obj);
91gint sgtk_rep_to_int (repv obj);
92gulong sgtk_rep_to_ulong (repv obj);
93glong sgtk_rep_to_long (repv obj);
94gchar sgtk_rep_to_char (repv obj);
95repv sgtk_char_to_rep (gchar c);
96char *sgtk_rep_to_string (repv obj);
97repv sgtk_string_to_rep (char *x);
98repv sgtk_static_string_to_rep (const char *x);
99int sgtk_valid_string (repv obj);
100repv sgtk_bool_to_rep (int x);
101int sgtk_rep_to_bool (repv obj);
102int sgtk_valid_function (repv obj);
103int sgtk_valid_fd (repv obj);
104int sgtk_rep_to_fd (repv obj);
105repv sgtk_fd_to_rep (int fd);
106
107repv sgtk_wrap_gobj (GObject *obj);
108int sgtk_is_a_gobj (guint type, repv obj);
109GObject *sgtk_get_gobj (repv obj);
110
111/* compatibility */
112repv sgtk_wrap_gtkobj (GtkObject *obj);
113int sgtk_is_a_gtkobj (guint type, repv obj);
114GtkObject *sgtk_get_gtkobj (repv obj);
115
116int sgtk_valid_enum (repv obj, sgtk_enum_info*);
117repv sgtk_enum_to_rep (gint val, sgtk_enum_info*);
118gint sgtk_rep_to_enum (repv obj, sgtk_enum_info*);
119
120int sgtk_valid_flags (repv obj, sgtk_enum_info*);
121repv sgtk_flags_to_rep (gint val, sgtk_enum_info*);
122gint sgtk_rep_to_flags (repv obj, sgtk_enum_info*);
123
124int sgtk_valid_senum (repv obj, sgtk_senum_info*);
125repv sgtk_senum_to_rep (char *val, sgtk_senum_info*);
126char *sgtk_rep_to_senum (repv obj, sgtk_senum_info*);
127
128repv sgtk_boxed_to_rep (gpointer ptr, sgtk_boxed_info*, int copyp);
129void *sgtk_rep_to_boxed (repv obj);
130int sgtk_valid_boxed (repv obj, sgtk_boxed_info*);
131
132int sgtk_valid_float (repv obj);
133gfloat sgtk_rep_to_float (repv obj);
134repv sgtk_float_to_rep (gfloat f);
135
136int sgtk_valid_double (repv obj);
137double sgtk_rep_to_double (repv obj);
138repv sgtk_double_to_rep (double f);
139
140int sgtk_valid_pointer (repv obj);
141void *sgtk_rep_to_pointer (repv obj);
142repv sgtk_pointer_to_rep (void *ptr);
143
144GType gobject_get_type (void);
145
146int sgtk_valid_point (repv obj);
147GdkPoint sgtk_rep_to_point (repv obj);
148repv sgtk_point_to_rep (GdkPoint p);
149
150int sgtk_valid_rect (repv obj);
151GdkRectangle sgtk_rep_to_rect (repv obj);
152repv sgtk_rect_to_rep (GdkRectangle p);
153
154GType sgtk_type_from_name (char *name);
155int sgtk_valid_type (repv obj);
156GType sgtk_rep_to_type (repv obj);
157repv sgtk_type_to_rep (GType t);
158
159int sgtk_valid_composite (repv obj, int (*predicate)(repv));
160int sgtk_valid_complen (repv obj, int (*predicate)(repv), int len);
161
162repv sgtk_slist_to_rep (GSList *list, repv (*torep)(void*));
163GSList *sgtk_rep_to_slist (repv obj, void (*fromrep)(repv, void*));
164void sgtk_slist_finish (GSList *list, repv obj, repv (*torep)(void*));
165
166repv sgtk_list_to_rep (GList *list, repv (*torep)(void*));
167GList *sgtk_rep_to_list (repv obj, void (*fromrep)(repv, void*));
168void sgtk_list_finish (GList *list, repv obj, repv (*torep)(void*));
169
170typedef struct {
171  int count;
172  void *vec;
173} sgtk_cvec;
174
175sgtk_cvec sgtk_rep_to_cvec (repv obj, void (*fromrep)(repv, void*), size_t sz);
176void sgtk_cvec_finish (sgtk_cvec *, repv obj, repv (*torep)(void*), size_t sz);
177repv sgtk_cvec_to_rep (sgtk_cvec *cvec, repv (*toscm)(void *), size_t sz);
178
179typedef struct sgtk_protshell sgtk_protshell;
180
181void sgtk_set_protect (repv protector, sgtk_protshell *prot);
182sgtk_protshell *sgtk_new_protect (repv obj);
183sgtk_protshell *sgtk_protect (repv protector, repv obj);
184void sgtk_unprotect (sgtk_protshell *);
185repv sgtk_get_protect (sgtk_protshell *prot);
186
187void sgtk_set_gclosure (repv protector, GClosure *closure);
188repv sgtk_get_gclosure (GClosure *closure);
189GClosure *sgtk_new_gclosure (repv obj);
190GClosure *sgtk_gclosure (repv protector, repv obj);
191
192void sgtk_gclosure_callback_marshal (GClosure *closure,
193                                     GValue *return_value,
194                                     guint n_param_values,
195                                     const GValue *param_values,
196                                     gpointer invocation_hint,
197                                     gpointer marshal_data);
198void sgtk_gclosure_callback_destroy (gpointer data, GClosure *closure);
199
200void sgtk_callback_marshal (GtkObject *obj,
201                            gpointer data,
202                            guint n_args,
203                            GtkArg *args);
204void sgtk_callback_destroy (gpointer data);
205
206repv sgtk_callback_trampoline (repv new_trampoline);
207void sgtk_callback_postfix (void);
208
209int sgtk_valid_arg_type (GType, repv val);
210repv sgtk_arg_to_rep (GtkArg *a, int free_mem);
211void sgtk_rep_to_arg (GtkArg *a, repv obj, repv protector);
212void sgtk_rep_to_ret (GtkArg *a, repv obj);
213
214repv sgtk_gvalue_to_rep (const GValue *a);
215int sgtk_valid_gvalue (const GValue *a, repv obj);
216void sgtk_rep_to_gvalue (GValue *a, repv obj);
217
218sgtk_object_info *sgtk_find_object_info_from_type (GType type);
219sgtk_object_info *sgtk_find_object_info (const char *name);
220void sgtk_free_args (GParameter *args, int n_args);
221GParameter *sgtk_build_args (GObjectClass *objclass, int *n_argsp,
222                             repv rep_args, char *subr);
223
224repv sgtk_color_conversion (repv color);
225repv sgtk_font_conversion (repv color);
226
227void sgtk_set_standalone (int flag);
228int sgtk_is_standalone (void);
229repv sgtk_standalone_p (void);
230
231void sgtk_init (void);
232void sgtk_init_with_args (int *argcp, char ***argvp);
233
234/* Additional useful Gdk routines. */
235
236/* The following two do their magic with type conversions that are
237   automatically generated by build-guile-gtk. */
238
239GdkColor *gdk_color_intern (GdkColor *);
240GdkFont *gdk_font_intern (GdkFont *);
241
242GdkEventType gdk_event_type (GdkEvent *event);
243GdkWindow *gdk_event_window (GdkEvent *event);
244gboolean gdk_event_send_event (GdkEvent *event);
245GdkRectangle *gdk_event_area (GdkEvent *event);
246GdkVisibilityState gdk_event_visibility_state (GdkEvent *event);
247guint32 gdk_event_time (GdkEvent *event);
248gdouble gdk_event_x (GdkEvent *event);
249gdouble gdk_event_y (GdkEvent *event);
250gdouble gdk_event_pressure (GdkEvent *event);
251gdouble gdk_event_xtilt (GdkEvent *event);
252gdouble gdk_event_ytilt (GdkEvent *event);
253gint gdk_event_button (GdkEvent *event);
254gboolean gdk_event_button_state (GdkEvent *event);
255gboolean gdk_event_is_hint (GdkEvent *event);
256GdkInputSource gdk_event_source (GdkEvent *event);
257guint32 gdk_event_deviceid (GdkEvent *event);
258gdouble gdk_event_x_root (GdkEvent *event);
259gdouble gdk_event_y_root (GdkEvent *event);
260gboolean gdk_event_key_state (GdkEvent *event);
261guint gdk_event_keyval (GdkEvent *event);
262gchar *gdk_event_string (GdkEvent *event);
263GdkWindow *gdk_event_subwindow (GdkEvent *event);
264GdkNotifyType gdk_event_notify_detail (GdkEvent *event);
265gboolean gdk_event_in (GdkEvent *event);
266gint16 gdk_event_configure_x (GdkEvent *event);
267gint16 gdk_event_configure_y (GdkEvent *event);
268gint16 gdk_event_configure_width (GdkEvent *event);
269gint16 gdk_event_configure_height (GdkEvent *event);
270
271guint32 gdk_get_leader_window_id (void);
272
273guint32 gdk_window_xid (GdkWindow *win);
274
275GdkGC *gtk_style_fg_gc (GtkStyle *style, GtkStateType state);
276GdkGC *gtk_style_bg_gc (GtkStyle *style, GtkStateType state);
277
278/* Gtk stuff that wouldn't be here in an ideal world. */
279
280#if GTK_MAJOR_VERSION == 1 && GTK_MINOR_VERSION == 0
281typedef int GtkWidgetFlags;
282#endif
283
284gchar *gtk_label_get_interp (GtkLabel *label);
285void gtk_menu_popup_interp (GtkMenu *menu,
286                            GtkWidget *parent_menu_shell,
287                            GtkWidget *parent_menu_item,
288                            gint button,
289                            guint32 activate_time,
290                            repv position);
291
292GtkWidget*
293gtk_radio_menu_item_new_with_label_from_widget (GtkRadioMenuItem *group,
294                                                const gchar      *label);
295GtkWidget*
296gtk_radio_menu_item_new_with_mnemonic_from_widget (GtkRadioMenuItem *group,
297                                                   const gchar      *label);
298GtkWidget* gtk_radio_menu_item_new_from_widget (GtkRadioMenuItem *group);
299GtkWidget* gtk_pixmap_new_interp (char *file, GtkWidget *intended_parent);
300
301#ifndef HAVE_GDK_COLOR_COPY
302GdkColor*    gdk_color_copy     (GdkColor *);
303void         gdk_color_free     (GdkColor *);
304#endif
305
306GdkColor *gdk_color_parse_interp (char *spec);
307GdkColor *gtk_style_get_white_interp (GtkStyle *style);
308
309#ifndef HAVE_GTK_WIDGET_PEEK_COLORMAP
310GdkColormap *gtk_widget_peek_colormap (void);
311#endif
312
313void gtk_list_append_item (GtkList *list, GtkListItem *item);
314void gtk_list_prepend_item (GtkList *list, GtkListItem *item);
315
316#ifndef HAVE_GTK_TYPE_GET_INFO
317gboolean gtk_type_get_info (GtkType type, GtkTypeInfo *info);
318#endif
319
320GtkType gtk_class_new (GtkType parent_type, gchar *name);
321guint
322gtk_signal_new_generic (const gchar     *name,
323                        GtkSignalRunType signal_flags,
324                        GtkType          type,
325                        GtkType          return_type,
326                        guint            nparams,
327                        GtkType         *params);
328void sgtk_signal_emit (GtkObject *obj, char *name, repv rep_args);
329
330#ifndef HAVE_GTK_SIGNAL_SET_CLASS_FUNCTION_FULL
331void gtk_signal_set_class_function_full (GtkType            type,
332                                         const gchar       *signal,
333                                         GtkSignalFunc      func,
334                                         GtkCallbackMarshal marshal,
335                                         gpointer           data,
336                                         GtkDestroyNotify   destroy_func);
337#endif
338
339void gtk_color_selection_set_color_interp (GtkColorSelection *sel, GdkColor *color);
340GdkColor *gtk_color_selection_get_color_interp (GtkColorSelection *sel);
341extern void gtk_widget_draw_interp (GtkWidget *widget);
342
343GtkTextIter *gtk_text_iter_new (void);
344repv sgtk_gtk_widget_get_allocation (GtkWidget *w);
345
346extern rep_xsubr *sgtk_subrs[];
347extern sgtk_type_info *sgtk_type_infos[];
348
349#endif /* !REP_GTK_H */
Note: See TracBrowser for help on using the repository browser.