5 #include <caml/mlvalues.h>
6 #include <caml/alloc.h>
7 #include <caml/memory.h>
8 #include <caml/callback.h>
19 #define GtkEditable_val(val) check_cast(GTK_EDITABLE,val)
20 ML_3 (gtk_editable_select_region, GtkEditable_val, Int_val, Int_val, Unit)
21 value ml_gtk_editable_insert_text (value w, value s, value pos)
23 int position = Int_val(pos);
24 gtk_editable_insert_text (GtkEditable_val(w), String_val(s),
25 string_length(s), &position);
26 return Val_int(position);
28 ML_3 (gtk_editable_delete_text, GtkEditable_val, Int_val, Int_val, Unit)
29 ML_3 (gtk_editable_get_chars, GtkEditable_val, Int_val, Int_val,
31 ML_1 (gtk_editable_cut_clipboard, GtkEditable_val, Unit)
32 ML_1 (gtk_editable_copy_clipboard, GtkEditable_val, Unit)
33 ML_1 (gtk_editable_paste_clipboard, GtkEditable_val, Unit)
34 ML_3 (gtk_editable_claim_selection, GtkEditable_val, Bool_val, Int_val, Unit)
35 ML_1 (gtk_editable_delete_selection, GtkEditable_val, Unit)
36 ML_1 (gtk_editable_changed, GtkEditable_val, Unit)
37 ML_2 (gtk_editable_set_position, GtkEditable_val, Int_val, Unit)
38 ML_1 (gtk_editable_get_position, GtkEditable_val, Val_int)
39 ML_2 (gtk_editable_set_editable, GtkEditable_val, Bool_val, Unit)
40 Make_Extractor (gtk_editable, GtkEditable_val, selection_start_pos, Val_int)
41 Make_Extractor (gtk_editable, GtkEditable_val, selection_end_pos, Val_int)
42 Make_Extractor (gtk_editable, GtkEditable_val, has_selection, Val_bool)
46 #define GtkEntry_val(val) check_cast(GTK_ENTRY,val)
47 ML_0 (gtk_entry_new, Val_GtkWidget_sink)
48 ML_1 (gtk_entry_new_with_max_length, (gint16)Long_val, Val_GtkWidget_sink)
49 ML_2 (gtk_entry_set_text, GtkEntry_val, String_val, Unit)
50 ML_2 (gtk_entry_append_text, GtkEntry_val, String_val, Unit)
51 ML_2 (gtk_entry_prepend_text, GtkEntry_val, String_val, Unit)
52 ML_1 (gtk_entry_get_text, GtkEntry_val, Val_string)
53 ML_3 (gtk_entry_select_region, GtkEntry_val, Int_val, Int_val, Unit)
54 ML_2 (gtk_entry_set_visibility, GtkEntry_val, Bool_val, Unit)
55 ML_2 (gtk_entry_set_max_length, GtkEntry_val, (gint16)Long_val, Unit)
56 Make_Extractor (GtkEntry, GtkEntry_val, text_length, Val_int)
60 #define GtkSpinButton_val(val) check_cast(GTK_SPIN_BUTTON,val)
61 ML_3 (gtk_spin_button_new, GtkAdjustment_val,
62 Float_val, Int_val, Val_GtkWidget_sink)
63 ML_2 (gtk_spin_button_set_adjustment, GtkSpinButton_val, GtkAdjustment_val,
65 ML_1 (gtk_spin_button_get_adjustment, GtkSpinButton_val, Val_GtkAny)
66 ML_2 (gtk_spin_button_set_digits, GtkSpinButton_val, Int_val, Unit)
67 ML_1 (gtk_spin_button_get_value_as_float, GtkSpinButton_val, copy_double)
68 ML_2 (gtk_spin_button_set_value, GtkSpinButton_val, Float_val, Unit)
69 ML_2 (gtk_spin_button_set_update_policy, GtkSpinButton_val,
70 Update_type_val, Unit)
71 ML_2 (gtk_spin_button_set_numeric, GtkSpinButton_val, Bool_val, Unit)
72 ML_2 (gtk_spin_button_spin, GtkSpinButton_val,
73 Insert (Is_long(arg2) ? Spin_type_val(arg2) : GTK_SPIN_USER_DEFINED)
74 (Is_long(arg2) ? 0.0 : Float_val(Field(arg2,1))) Ignore, Unit)
75 ML_2 (gtk_spin_button_set_wrap, GtkSpinButton_val, Bool_val, Unit)
76 ML_2 (gtk_spin_button_set_shadow_type, GtkSpinButton_val, Shadow_type_val, Unit)
77 ML_2 (gtk_spin_button_set_snap_to_ticks, GtkSpinButton_val, Bool_val, Unit)
78 ML_4 (gtk_spin_button_configure, GtkSpinButton_val, GtkAdjustment_val,
79 Float_val, Int_val, Unit)
80 ML_1 (gtk_spin_button_update, GtkSpinButton_val, Unit)
84 #define GtkText_val(val) check_cast(GTK_TEXT,val)
85 ML_2 (gtk_text_new, GtkAdjustment_val, GtkAdjustment_val, Val_GtkWidget_sink)
86 ML_2 (gtk_text_set_word_wrap, GtkText_val, Bool_val, Unit)
87 ML_2 (gtk_text_set_line_wrap, GtkText_val, Bool_val, Unit)
88 ML_3 (gtk_text_set_adjustments, GtkText_val,
89 Option_val(arg2,GtkAdjustment_val,GtkText_val(arg1)->hadj) Ignore,
90 Option_val(arg3,GtkAdjustment_val,GtkText_val(arg1)->vadj) Ignore,
92 Make_Extractor (gtk_text_get, GtkText_val, hadj, Val_GtkWidget)
93 Make_Extractor (gtk_text_get, GtkText_val, vadj, Val_GtkWidget)
94 ML_2 (gtk_text_set_point, GtkText_val, Int_val, Unit)
95 ML_1 (gtk_text_get_point, GtkText_val, Val_int)
96 ML_1 (gtk_text_get_length, GtkText_val, Val_int)
97 ML_1 (gtk_text_freeze, GtkText_val, Unit)
98 ML_1 (gtk_text_thaw, GtkText_val, Unit)
99 value ml_gtk_text_insert (value text, value font, value fore, value back,
102 gtk_text_insert (GtkText_val(text),
103 Option_val(font,GdkFont_val,NULL),
104 Option_val(fore,GdkColor_val,NULL),
105 Option_val(back,GdkColor_val,NULL),
106 String_val(str), string_length(str));
109 ML_2 (gtk_text_forward_delete, GtkText_val, Int_val, Val_int)
110 ML_2 (gtk_text_backward_delete, GtkText_val, Int_val, Val_int)
114 #define GtkCombo_val(val) check_cast(GTK_COMBO,val)
115 ML_0 (gtk_combo_new, Val_GtkWidget_sink)
116 ML_3 (gtk_combo_set_value_in_list, GtkCombo_val,
117 Option_val(arg2, Bool_val, GtkCombo_val(arg1)->value_in_list) Ignore,
118 Option_val(arg3, Bool_val, GtkCombo_val(arg1)->ok_if_empty) Ignore,
120 ML_2 (gtk_combo_set_use_arrows, GtkCombo_val, Bool_val, Unit)
121 ML_2 (gtk_combo_set_use_arrows_always, GtkCombo_val, Bool_val, Unit)
122 ML_2 (gtk_combo_set_case_sensitive, GtkCombo_val, Bool_val, Unit)
123 ML_3 (gtk_combo_set_item_string, GtkCombo_val, GtkItem_val, String_val, Unit)
124 ML_1 (gtk_combo_disable_activate, GtkCombo_val, Unit)
125 Make_Extractor (gtk_combo, GtkCombo_val, entry, Val_GtkWidget)
126 Make_Extractor (gtk_combo, GtkCombo_val, list, Val_GtkWidget)