]> matita.cs.unibo.it Git - helm.git/blob - helm/DEVEL/lablgtk/lablgtk_20001129-0.1.0/ml_gtkmisc.c
.cvsignore files missing
[helm.git] / helm / DEVEL / lablgtk / lablgtk_20001129-0.1.0 / ml_gtkmisc.c
1 /* $Id$ */
2
3 #include <string.h>
4 #include <gtk/gtk.h>
5 #include <caml/mlvalues.h>
6 #include <caml/alloc.h>
7 #include <caml/memory.h>
8 #include <caml/callback.h>
9 #include <caml/fail.h>
10
11 #include "wrappers.h"
12 #include "ml_glib.h"
13 #include "ml_gdk.h"
14 #include "ml_gtk.h"
15 #include "gtk_tags.h"
16
17 /* gtkgamma.h */
18
19 #define GtkGammaCurve_val(val) check_cast(GTK_GAMMA_CURVE,val)
20 ML_0 (gtk_gamma_curve_new, Val_GtkWidget_sink)
21 Make_Extractor (gtk_gamma_curve_get, GtkGammaCurve_val, gamma, copy_double)
22
23 /* gtkstatusbar.h */
24
25 #define GtkStatusbar_val(val) check_cast(GTK_STATUSBAR,val)
26 ML_0 (gtk_statusbar_new, Val_GtkWidget_sink)
27 ML_2 (gtk_statusbar_get_context_id, GtkStatusbar_val, String_val, Val_int)
28 ML_3 (gtk_statusbar_push, GtkStatusbar_val, Int_val, String_val, Val_int)
29 ML_2 (gtk_statusbar_pop, GtkStatusbar_val, Int_val, Unit)
30 ML_3 (gtk_statusbar_remove, GtkStatusbar_val, Int_val, Int_val, Unit)
31
32 /* gtkcalendar.h */
33
34 #define GtkCalendar_val(val) check_cast(GTK_CALENDAR,val)
35 ML_0 (gtk_calendar_new, Val_GtkWidget_sink)
36 ML_3 (gtk_calendar_select_month, GtkCalendar_val, Int_val, Int_val, Unit)
37 ML_2 (gtk_calendar_select_day, GtkCalendar_val, Int_val, Unit)
38 ML_2 (gtk_calendar_mark_day, GtkCalendar_val, Int_val, Unit)
39 ML_2 (gtk_calendar_unmark_day, GtkCalendar_val, Int_val, Unit)
40 ML_1 (gtk_calendar_clear_marks, GtkCalendar_val, Unit)
41 Make_Flags_val (Calendar_display_options_val)
42 ML_2 (gtk_calendar_display_options, GtkCalendar_val,
43       Flags_Calendar_display_options_val, Unit)
44 value ml_gtk_calendar_get_date (value w)
45 {
46     guint year, month, day;
47     value ret;
48
49     gtk_calendar_get_date (GtkCalendar_val(w), &year, &month, &day);
50     ret = alloc_small (3, 0);
51     Field(ret,0) = Val_int(year);
52     Field(ret,1) = Val_int(month);
53     Field(ret,2) = Val_int(day);
54     return ret;
55 }
56 ML_1 (gtk_calendar_freeze, GtkCalendar_val, Unit)
57 ML_1 (gtk_calendar_thaw, GtkCalendar_val, Unit)
58
59 /* gtkdrawingarea.h */
60
61 #define GtkDrawingArea_val(val) check_cast(GTK_DRAWING_AREA,val)
62 ML_0 (gtk_drawing_area_new, Val_GtkWidget_sink)
63 ML_3 (gtk_drawing_area_size, GtkDrawingArea_val, Int_val, Int_val, Unit)
64
65 /* gtkmisc.h */
66
67 #define GtkMisc_val(val) check_cast(GTK_MISC,val)
68 ML_3 (gtk_misc_set_alignment, GtkMisc_val, Double_val, Double_val, Unit)
69 ML_3 (gtk_misc_set_padding, GtkMisc_val, Int_val, Int_val, Unit)
70 Make_Extractor (gtk_misc_get, GtkMisc_val, xalign, copy_double)
71 Make_Extractor (gtk_misc_get, GtkMisc_val, yalign, copy_double)
72 Make_Extractor (gtk_misc_get, GtkMisc_val, xpad, Val_int)
73 Make_Extractor (gtk_misc_get, GtkMisc_val, ypad, Val_int)
74
75 /* gtkarrow.h */
76
77 #define GtkArrow_val(val) check_cast(GTK_ARROW,val)
78 ML_2 (gtk_arrow_new, Arrow_type_val, Shadow_type_val, Val_GtkWidget_sink)
79 ML_3 (gtk_arrow_set, GtkArrow_val, Arrow_type_val, Shadow_type_val, Unit)
80
81 /* gtkimage.h */
82
83 #define GtkImage_val(val) check_cast(GTK_IMAGE,val)
84 ML_2 (gtk_image_new, GdkImage_val,
85       Option_val (arg2, GdkBitmap_val, NULL) Ignore, Val_GtkWidget_sink)
86 ML_3 (gtk_image_set, GtkImage_val, GdkImage_val,
87       Option_val (arg2, GdkBitmap_val, NULL) Ignore, Unit)
88
89 /* gtklabel.h */
90
91 #define GtkLabel_val(val) check_cast(GTK_LABEL,val)
92 ML_1 (gtk_label_new, String_val, Val_GtkWidget_sink)
93 ML_2 (gtk_label_set_text, GtkLabel_val, String_val, Unit)
94 ML_2 (gtk_label_set_pattern, GtkLabel_val, String_val, Unit)
95 ML_2 (gtk_label_set_justify, GtkLabel_val, Justification_val, Unit)
96 ML_2 (gtk_label_set_line_wrap, GtkLabel_val, Bool_val, Unit)
97 Make_Extractor (gtk_label_get, GtkLabel_val, label, Val_string)
98
99 /* gtktipsquery.h */
100
101 #define GtkTipsQuery_val(val) check_cast(GTK_TIPS_QUERY,val)
102 ML_0 (gtk_tips_query_new, Val_GtkWidget_sink)
103 ML_1 (gtk_tips_query_start_query, GtkTipsQuery_val, Unit)
104 ML_1 (gtk_tips_query_stop_query, GtkTipsQuery_val, Unit)
105 ML_2 (gtk_tips_query_set_caller, GtkTipsQuery_val, GtkWidget_val, Unit)
106 ML_3 (gtk_tips_query_set_labels, GtkTipsQuery_val,
107       String_val, String_val, Unit)
108 value ml_gtk_tips_query_set_emit_always (value w, value arg)
109 {
110     GtkTipsQuery_val(w)->emit_always = Bool_val(arg);
111     return Val_unit;
112 }
113 Make_Extractor (gtk_tips_query_get, GtkTipsQuery_val, emit_always, Val_bool)
114 Make_Extractor (gtk_tips_query_get, GtkTipsQuery_val, caller, Val_GtkWidget)
115 Make_Extractor (gtk_tips_query_get, GtkTipsQuery_val, label_inactive,
116                 Val_string)
117 Make_Extractor (gtk_tips_query_get, GtkTipsQuery_val, label_no_tip,
118                 Val_string)
119
120 /* gtkpixmap.h */
121
122 #define GtkPixmap_val(val) check_cast(GTK_PIXMAP,val)
123 ML_2 (gtk_pixmap_new, GdkPixmap_val,
124       Option_val (arg2, GdkBitmap_val, NULL) Ignore,
125       Val_GtkWidget_sink)
126 value ml_gtk_pixmap_set (value val, value pixmap, value mask)
127 {
128     GtkPixmap *w = GtkPixmap_val(val);
129     gtk_pixmap_set (w, Option_val(pixmap,GdkPixmap_val,w->pixmap),
130                     Option_val(mask,GdkBitmap_val,w->mask));
131     return Val_unit;
132 }
133 Make_Extractor (GtkPixmap, GtkPixmap_val, pixmap, Val_GdkPixmap)
134 Make_Extractor (GtkPixmap, GtkPixmap_val, mask, Val_GdkBitmap)
135
136 /* gtk[hv]separator.h */
137
138 ML_0 (gtk_hseparator_new, Val_GtkWidget_sink)
139 ML_0 (gtk_vseparator_new, Val_GtkWidget_sink)