


# gtk-via-pipe-driver.pkg
#
# This file handles the Mythryl side
# of the Mythryl <-> C interface
# layer for the Mythryl Gtk-in-subprocess
# Gtk binding.
#
# Here we implement only low-level pipe-specific functionality.
# In src/lib/src/gtk-via-pipe.pkg we are passed as an argument# to the generic handling the higher-level stuff:
#
# gtk_g from src/lib/src/gtk-g.pkg#
# The other end of the pipe is implemented in C in:
#
# src/c/gtk/mythryl-gtk-slave.c
#
# See the comments in that file for a description
# of the pipe protocol used.
#
# Our alternative Gtk-in-main-process implementation is in
#
# src/lib/src/gtk-driver.pkg# Compiled by:
# src/lib/std/standard.libstipulate
package f8b = eight_byte_float; # eight_byte_float is from src/lib/std/eight-byte-float.pkg package spn = spawn; # spawn is from src/lib/std/src/posix/spawn.pkgherein
package gtk_via_pipe_driver: Gtk_Driver { # Gtk_Driver is from src/lib/src/gtk-driver.api include gtk_event; # gtk_event is from src/lib/src/gtk-event.pkg package int_map
=
int_red_black_map;
Session
=
{ process: spn::Process( file::Output_Stream, file::Input_Stream, file::Input_Stream ),
# The input and output pipes connecting us
# to the GTK slave subprocess:
#
from_stream: file::Input_Stream,
to_stream: file::Output_Stream,
# An additional stream on which to log debug stuff:
#
logstream: file::Output_Stream,
void_callback_map: Ref (int_map::Map( Void -> Void )),
bool_callback_map: Ref (int_map::Map( Bool -> Void )),
float_callback_map: Ref (int_map::Map( Float -> Void )),
button_event_callback_map: Ref (int_map::Map( Button_Event -> Void )),
motion_event_callback_map: Ref (int_map::Map( Motion_Event -> Void )),
key_event_callback_map: Ref (int_map::Map( Key_Event -> Void )),
expose_event_callback_map: Ref (int_map::Map( Expose_Event -> Void )),
configure_event_callback_map: Ref (int_map::Map( Configure_Event -> Void ))
};
# Given ("FOO", "FOO187"), return 187:
#
fun get_int_suffix (prefix, string)
=
{ suffix = string::extract (string, string::length prefix, NULL);
case (int::from_string suffix)
THE i => i;
NULL => raise exception FAIL ("get_int_suffix: Bad " + prefix + " value: " + string);
esac;
};
# Given ("FOO", "FOO..."), return "...":
#
fun get_suffix (prefix, string)
=
string::extract (string, string::length prefix, NULL);
# A line like
# "CALLBACK17"
# means to execute callback 17
# in our callback_map.
#
# A line like
# "BOOL_CALLBACK17 TRUE"
# means to execute callback 17
# in our bool_callback_map with an argument of TRUE.
#
# A line like
# "FLOAT_CALLBACK17 2.3"
# means to execute callback 17
# in our float_callback_map with an argument of 2.3.
#
# A line like
# "BUTTON_CALLBACK17 1 23.3 52.9"
# means to tell callback 17 that mouse button 1 was clicked at x,y of (23.3, 52.9)
# ...
# and so forth. :)
#
fun maybe_run_callback (session: Session, callback_line: String): Void
=
{
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: callback_line = '" + callback_line + "'\n"); file::flush session.subsession.logstream;
if (string::is_prefix "CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id
=
get_int_suffix ("CALLBACK", callback_line);
case (int_map::get (*session.void_callback_map, callback_id))
THE callback => callback ();
NULL => ();
esac;
fi;
if (string::is_prefix "BOOL_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa BOOL_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("BOOL_CALLBACK", callback_line);
bool = string::is_suffix "TRUE" callback_line;
case (int_map::get (*session.bool_callback_map, callback_id))
THE callback => callback bool;
NULL => ();
esac;
fi;
if (string::is_prefix "FLOAT_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa FLOAT_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("FLOAT_CALLBACK", callback_line);
# callback_line should look like
#
# "FLOAT_CALLBACK17 2.3"
#
# where '17' is the callback to invoke
# and '2.3' is the value to pass it:
#
value
=
case (string::tokens char::is_space callback_line)
#
_ ! arg ! NIL => the (f8b::from_string arg);
_ => raise exception GTK_ERROR "bad FLOAT_CALLBACK arg";
esac;
case (int_map::get (*session.float_callback_map, callback_id))
THE callback => callback value;
NULL => ();
esac;
fi;
if (string::is_prefix "BUTTON_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa BUTTON_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("BUTTON_CALLBACK", callback_line);
# callback_line should look like
#
# "BUTTON_CALLBACK17 13 1 23.3 16.2 2314 16"
#
# where '17' is the callback to invoke;
# '13' is the widow receiving the event
# '1' is the button pressed;
# '23.3' is the pointer x-coord;
# '16.2' is the pointer y-coord;
# '2314' is the event time in milliseconds; and
# '16' is the bitbag of modifier keys.
#
value
=
case (string::tokens char::is_space callback_line)
_ ! window ! button ! x ! y ! time ! modifiers ! NIL
=>
{ window => the ( int::from_string window),
button => the ( int::from_string button),
x => the (f8b::from_string x ),
y => the (f8b::from_string y ),
time => the ( int::from_string time ),
modifiers => mods (the ( int::from_string modifiers))
};
_ => raise exception GTK_ERROR "bad BUTTON_CALLBACK arg";
esac
where
mods = int_to_modifier_list;
end;
case (int_map::get (*session.button_event_callback_map, callback_id))
THE callback => callback value;
NULL => ();
esac;
fi;
if (string::is_prefix "MOTION_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa MOTION_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("MOTION_CALLBACK", callback_line);
# callback_line should look like
#
# "MOTION_CALLBACK17 14 19123 23.3 16.2"
#
# where '17' is the callback to invoke;
# '14' is the window which received the event;
# '19123' is the millisecond-accurate sample time;
# '23.3' is the pointer x-coord; and
# '16.2' is the pointer y-coord.
#
value
=
case (string::tokens char::is_space callback_line)
_ ! window ! time ! x ! y ! modifiers ! is_hint ! NIL
=>
{ window => the ( int::from_string window ),
time => the ( int::from_string time ),
x => the (f8b::from_string x ),
y => the (f8b::from_string y ),
modifiers => mods (the ( int::from_string modifiers)),
is_hint => 1 == (the ( int::from_string is_hint ))
};
_ => raise exception GTK_ERROR "bad MOTION_CALLBACK arg";
esac
where
mods = int_to_modifier_list;
end;
case (int_map::get (*session.motion_event_callback_map, callback_id))
THE callback => callback value;
NULL => ();
esac;
fi;
if (string::is_prefix "EXPOSE_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa EXPOSE_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("EXPOSE_CALLBACK", callback_line);
# callback_line should look like
#
# "EXPOSE_CALLBACK17 0"
#
# where '17' is the callback to invoke;
# '0' is count of following expose events.
#
value
=
case (string::tokens char::is_space callback_line)
_ ! window ! count ! x ! y ! wide ! high ! NIL
=>
{ window => the (int::from_string window ),
count => the (int::from_string count ),
x => the (int::from_string x ),
y => the (int::from_string y ),
wide => the (int::from_string wide ),
high => the (int::from_string high )
};
_ => raise exception GTK_ERROR "bad EXPOSE_CALLBACK arg";
esac;
case (int_map::get (*session.expose_event_callback_map, callback_id))
THE callback => callback value;
NULL => ();
esac;
fi;
if (string::is_prefix "CONFIGURE_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa CONFIGURE_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("CONFIGURE_CALLBACK", callback_line);
# callback_line should look like
#
# "CONFIGURE_CALLBACK17 8 15 600 300"
#
# where '17' is the callback to invoke;
# '8' is x;
# '15' is y;
# '600' is wide;
# '300' is high;
#
value
=
case (string::tokens char::is_space callback_line)
_ ! window ! x ! y ! wide ! high ! NIL
=>
{ window => the (int::from_string window ),
x => the (int::from_string x ),
y => the (int::from_string y ),
wide => the (int::from_string wide ),
high => the (int::from_string high )
};
_ => raise exception GTK_ERROR "bad CONFIGURE_CALLBACK arg";
esac;
case (int_map::get (*session.configure_event_callback_map, callback_id))
THE callback => callback value;
NULL => ();
esac;
fi;
if (string::is_prefix "KEY_CALLBACK" callback_line)
# file::write (session.subsession.logstream, "src/lib/src/gtk.pkg: maybe_run_callback: itsa KEY_CALLBACK line.\n"); file::flush session.subsession.logstream;
callback_id = get_int_suffix ("KEY_CALLBACK", callback_line);
# callback_line should look like
#
# "KEY_CALLBACK17 8 15 12819 0"
#
# where '17' is the callback to invoke;
# '8' is key;
# '15' is keycode;
# '12819' is millisecond time;
# '0' is modifiers.
#
value
=
case (string::tokens char::is_space callback_line)
_ ! key ! keycode ! time ! modifiers ! NIL
=>
{ key => the (int::from_string key ),
keycode => the (int::from_string keycode ),
time => the (int::from_string time ),
modifiers => mods (the (int::from_string modifiers ))
};
_ => raise exception GTK_ERROR "bad KEY_CALLBACK arg";
esac
where
mods = int_to_modifier_list;
end;
case (int_map::get (*session.key_event_callback_map, callback_id))
THE callback => callback value;
NULL => ();
esac;
fi;
};
#
fun widget_to_string widget
=
"WIDGET" + (int::to_string widget);
#
fun string_to_string string
=
sprintf "\"%d\"%s\"" (string::length string) string;
#
fun string_to_widget widget
=
{ if (not (string::is_prefix "WIDGET" widget)) raise exception FAIL ("Invalid string_to_widget arg: " + widget); fi;
suffix = get_suffix ("WIDGET", widget);
the (int::from_string suffix);
};
#
fun bool_to_string bool
=
case bool
TRUE => "TRUE";
FALSE => "FALSE";
esac;
# Read a line from mythryl-gtk-slave,
# then execute any callback
# it requests.
# Return Void:
#
fun handle_line_from_slave (session: Session)
=
case (file::read_line session.from_stream)
NULL
=>
raise exception FAIL "EOF from mythryl-gtk-slave subprocess.";
THE line
=>
{ line = string::chomp line;
file::write (session.logstream, " read: " + line + "\n"); file::flush session.logstream;
maybe_run_callback (session, line);
};
esac;
# Read lines from mythryl-gtk-slave until
# we get a line (say "FOO187"),
# starting with given prefix ("FOO").
# After finding it, execute any callbacks
# encountered along the way, then return
# the target line ("FOO187"):
#
fun handle_line_from_slave'
( session: Session,
result_prefix: String
)
=
read_lines []
where
# Voice of Experience: We need to read everything
# up to our target line before running any callbacks,
# because otherwise the callbacks may make recursive
# calls to our slave process which will eat our remaining
# input out from under us before we can get to it.
#
fun read_lines lines_read
=
case (file::read_line session.from_stream)
NULL
=>
raise exception FAIL "EOF from mythryl-gtk-slave subprocess.";
THE line
=>
{ line = string::chomp line;
file::write (session.logstream, " READ: " + line + "\n"); file::flush session.logstream;
if (string::is_prefix result_prefix line)
# NOW it is safe to run our callbacks:
#
apply
.{ maybe_run_callback (session, #line); }
(reverse lines_read);
line;
else
read_lines (line ! lines_read);
fi;
};
esac;
end;
# Send given command to mythryl-gtk-slave subprocess,
# return Void:
#
fun do_void_command
(
session: Session,
command
)
=
{ file::write (session.to_stream, (sprintf "%d" (string::length command + 1)) + "\n"); # Write length of next line.
file::write (session.to_stream, command+"\n");
file::flush session.to_stream;
file::write (session.logstream, " sent: do_void_command: " + command + "\n"); file::flush session.logstream;
};
# Send given command to mythryl-gtk-slave subprocess,
# read result marked by 'result_prefix' ,
# return integer result:
#
fun do_int_command
( session,
result_prefix,
command
)
=
{ file::write (session.to_stream, (sprintf "%d" (string::length command + 1)) + "\n"); # Write length of next line.
file::write (session.to_stream, command+"\n"); file::flush session.to_stream;
file::write (session.logstream, " Sent: " + command + "\n"); file::flush session.logstream;
result = handle_line_from_slave' (session, result_prefix);
file::write (session.logstream, " Rslt: " + result + "\n"); file::flush session.logstream;
get_int_suffix (result_prefix, result);
};
# Send given command to mythryl-gtk-slave subprocess,
# read result marked by 'result_prefix' ,
# return string result:
#
fun do_string_command
( session,
result_prefix,
command
)
=
{ file::write (session.to_stream, (sprintf "%d" (string::length command + 1)) + "\n"); # Write length of next line.
file::write (session.to_stream, command+"\n"); file::flush session.to_stream;
file::write (session.logstream, " SENT: " + command + "\n"); file::flush session.logstream;
result = handle_line_from_slave' (session, result_prefix);
get_suffix (result_prefix, result);
};
#
fun make_session
{
void_callback_map: Ref (int_map::Map( Void -> Void )),
bool_callback_map: Ref (int_map::Map( Bool -> Void )),
float_callback_map: Ref (int_map::Map( Float -> Void )),
button_event_callback_map: Ref (int_map::Map( Button_Event -> Void )),
motion_event_callback_map: Ref (int_map::Map( Motion_Event -> Void )),
key_event_callback_map: Ref (int_map::Map( Key_Event -> Void )),
expose_event_callback_map: Ref (int_map::Map( Expose_Event -> Void )),
configure_event_callback_map: Ref (int_map::Map( Configure_Event -> Void ))
}
=
{
process = spn::spawn_process { executable => "/usr/bin/mythryl-gtk-slave", arguments => [], options => [] };
(spn::text_streams_of process)
->
{ stdin_to_child => to_stream,
stdout_from_child => from_stream
};
logstream
=
file::open_for_write "gtk.pkg.log~";
session
=
{ process,
from_stream,
to_stream,
logstream,
#
void_callback_map,
bool_callback_map,
float_callback_map,
button_event_callback_map,
motion_event_callback_map,
key_event_callback_map,
expose_event_callback_map,
configure_event_callback_map
};
do_void_command (session, "init");
session;
};
#
fun get_widget_allocation (session, widget)
=
{ result
=
do_string_command
(
session,
"get_widget_allocation",
string::join " " [ "get_widget_allocation", widget_to_string widget ]
);
case (string::tokens char::is_space result)
x ! y ! wide ! high ! NIL
=>
( /* x => */ the (int::from_string x),
/* y => */ the (int::from_string y),
/* wide => */ the (int::from_string wide),
/* high => */ the (int::from_string high)
);
_ => raise exception FAIL ("get_widget_allocation: invalid result from child: " + result);
esac;
};
#
fun get_window_pointer (session, window)
=
{ result
=
do_string_command
(
session,
"get_window_pointer",
string::join " " [ "get_window_pointer", widget_to_string window ]
);
case (string::tokens char::is_space result)
x ! y ! modifiers ! NIL
=>
( the (int::from_string x),
the (int::from_string y),
the (int::from_string modifiers)
);
_ => raise exception FAIL ("get_window_pointer: invalid result from child: " + result);
esac;
};
#
fun make_dialog session
=
{ result
=
do_string_command
(
session,
"make_dialog",
"make_dialog"
);
case (string::tokens char::is_space result)
dialog ! vbox ! action_area ! NIL
=>
( string_to_widget dialog,
string_to_widget vbox,
string_to_widget action_area
);
_ => raise exception FAIL ("make_dialog: invalid result from child: " + result);
esac;
};
#
fun unref_object (session, widget)
=
do_void_command (session, "unref_object " + widget_to_string widget);
#
fun quit_eventloop session
=
do_void_command (session, "quit_eventloop");
#
fun run_eventloop_indefinitely session
=
{ do_void_command (session, "run_eventloop_indefinitely");
loop ()
where
fun loop ()
=
{ handle_line_from_slave session;
loop ();
};
end;
};
#
fun run_eventloop_once (session: Session, block_until_event: Bool)
=
if (0 == do_int_command (session, "make_window", "make_window" + " " + bool_to_string block_until_event))
FALSE;
else
TRUE;
fi;
# Do not edit this or following lines -- they are autogenerated by make-gtk-glue.
fun make_window (session) # new Widget
=
do_int_command (session, "make_window", "make_window");
fun make_label (session, s0) # new Widget
=
do_int_command (session, "make_label", "make_label" + " " + string_to_string s0);
fun make_status_bar_context_id (session, w0, s1) # Int
=
do_int_command (session, "make_status_bar_context_id", "make_status_bar_context_id" + " " + widget_to_string w0 + " " + string_to_string s1);
fun make_menu (session) # new Widget
=
do_int_command (session, "make_menu", "make_menu");
fun make_option_menu (session) # new Widget
=
do_int_command (session, "make_option_menu", "make_option_menu");
fun make_menu_bar (session) # new Widget
=
do_int_command (session, "make_menu_bar", "make_menu_bar");
fun make_combo_box (session) # new Widget
=
do_int_command (session, "make_combo_box", "make_combo_box");
fun make_text_combo_box (session) # new Widget
=
do_int_command (session, "make_text_combo_box", "make_text_combo_box");
fun make_frame (session, s0) # new Widget
=
do_int_command (session, "make_frame", "make_frame" + " " + string_to_string s0);
fun make_button (session) # new Widget
=
do_int_command (session, "make_button", "make_button");
fun make_button_with_label (session, s0) # new Widget
=
do_int_command (session, "make_button_with_label", "make_button_with_label" + " " + string_to_string s0);
fun make_button_with_mnemonic (session, s0) # new Widget
=
do_int_command (session, "make_button_with_mnemonic", "make_button_with_mnemonic" + " " + string_to_string s0);
fun make_toggle_button (session) # new Widget
=
do_int_command (session, "make_toggle_button", "make_toggle_button");
fun make_toggle_button_with_label (session, s0) # new Widget
=
do_int_command (session, "make_toggle_button_with_label", "make_toggle_button_with_label" + " " + string_to_string s0);
fun make_toggle_button_with_mnemonic (session, s0) # new Widget
=
do_int_command (session, "make_toggle_button_with_mnemonic", "make_toggle_button_with_mnemonic" + " " + string_to_string s0);
fun make_check_button (session) # new Widget
=
do_int_command (session, "make_check_button", "make_check_button");
fun make_check_button_with_label (session, s0) # new Widget
=
do_int_command (session, "make_check_button_with_label", "make_check_button_with_label" + " " + string_to_string s0);
fun make_check_button_with_mnemonic (session, s0) # new Widget
=
do_int_command (session, "make_check_button_with_mnemonic", "make_check_button_with_mnemonic" + " " + string_to_string s0);
fun make_menu_item (session) # new Widget
=
do_int_command (session, "make_menu_item", "make_menu_item");
fun make_menu_item_with_label (session, s0) # new Widget
=
do_int_command (session, "make_menu_item_with_label", "make_menu_item_with_label" + " " + string_to_string s0);
fun make_menu_item_with_mnemonic (session, s0) # new Widget
=
do_int_command (session, "make_menu_item_with_mnemonic", "make_menu_item_with_mnemonic" + " " + string_to_string s0);
fun make_first_radio_button (session) # new Widget
=
do_int_command (session, "make_first_radio_button", "make_first_radio_button");
fun make_next_radio_button (session, w0) # new Widget
=
do_int_command (session, "make_next_radio_button", "make_next_radio_button" + " " + widget_to_string w0);
fun make_first_radio_button_with_label (session, s0) # new Widget
=
do_int_command (session, "make_first_radio_button_with_label", "make_first_radio_button_with_label" + " " + string_to_string s0);
fun make_next_radio_button_with_label (session, w0, s1) # new Widget
=
do_int_command (session, "make_next_radio_button_with_label", "make_next_radio_button_with_label" + " " + widget_to_string w0 + " " + string_to_string s1);
fun make_first_radio_button_with_mnemonic (session, s0) # new Widget
=
do_int_command (session, "make_first_radio_button_with_mnemonic", "make_first_radio_button_with_mnemonic" + " " + string_to_string s0);
fun make_next_radio_button_with_mnemonic (session, w0, s1) # new Widget
=
do_int_command (session, "make_next_radio_button_with_mnemonic", "make_next_radio_button_with_mnemonic" + " " + widget_to_string w0 + " " + string_to_string s1);
fun make_arrow (session, i0, i1) # new Widget
=
do_int_command (session, "make_arrow", "make_arrow" + " " + int::to_string i0 + " " + int::to_string i1);
fun set_arrow (session, w0, i1, i2) # Void
=
do_void_command (session, "set_arrow" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun make_horizontal_box (session, b0, i1) # new Widget
=
do_int_command (session, "make_horizontal_box", "make_horizontal_box" + " " + bool_to_string b0 + " " + int::to_string i1);
fun make_vertical_box (session, b0, i1) # new Widget
=
do_int_command (session, "make_vertical_box", "make_vertical_box" + " " + bool_to_string b0 + " " + int::to_string i1);
fun make_horizontal_button_box (session) # new Widget
=
do_int_command (session, "make_horizontal_button_box", "make_horizontal_button_box");
fun make_vertical_button_box (session) # new Widget
=
do_int_command (session, "make_vertical_button_box", "make_vertical_button_box");
fun make_table (session, i0, i1, b2) # new Widget
=
do_int_command (session, "make_table", "make_table" + " " + int::to_string i0 + " " + int::to_string i1 + " " + bool_to_string b2);
fun make_event_box (session) # new Widget
=
do_int_command (session, "make_event_box", "make_event_box");
fun make_image_from_file (session, s0) # new Widget
=
do_int_command (session, "make_image_from_file", "make_image_from_file" + " " + string_to_string s0);
fun make_horizontal_separator (session) # new Widget
=
do_int_command (session, "make_horizontal_separator", "make_horizontal_separator");
fun make_vertical_separator (session) # new Widget
=
do_int_command (session, "make_vertical_separator", "make_vertical_separator");
fun make_layout_container (session) # new Widget
=
do_int_command (session, "make_layout_container", "make_layout_container");
fun layout_put (session, w0, w1, i2, i3) # Void
=
do_void_command (session, "layout_put" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + int::to_string i3);
fun layout_move (session, w0, w1, i2, i3) # Void
=
do_void_command (session, "layout_move" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + int::to_string i3);
fun make_fixed_container (session) # new Widget
=
do_int_command (session, "make_fixed_container", "make_fixed_container");
fun fixed_put (session, w0, w1, i2, i3) # Void
=
do_void_command (session, "fixed_put" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + int::to_string i3);
fun fixed_move (session, w0, w1, i2, i3) # Void
=
do_void_command (session, "fixed_move" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + int::to_string i3);
fun make_adjustment (session, f0, f1, f2, f3, f4, f5) # new Widget
=
do_int_command (session, "make_adjustment", "make_adjustment" + " " + eight_byte_float::to_string f0 + " " + eight_byte_float::to_string f1 + " " + eight_byte_float::to_string f2 + " " + eight_byte_float::to_string f3 + " " + eight_byte_float::to_string f4 + " " + eight_byte_float::to_string f5);
fun make_viewport (session, w0, w1) # new Widget
=
do_int_command (session, "make_viewport", "make_viewport" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun make_scrolled_window (session, w0, w1) # new Widget
=
do_int_command (session, "make_scrolled_window", "make_scrolled_window" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun make_horizontal_ruler (session) # new Widget
=
do_int_command (session, "make_horizontal_ruler", "make_horizontal_ruler");
fun make_vertical_ruler (session) # new Widget
=
do_int_command (session, "make_vertical_ruler", "make_vertical_ruler");
fun make_vertical_scrollbar (session, w0) # new Widget
=
do_int_command (session, "make_vertical_scrollbar", "make_vertical_scrollbar" + " " + widget_to_string w0);
fun make_horizontal_scrollbar (session, w0) # new Widget
=
do_int_command (session, "make_horizontal_scrollbar", "make_horizontal_scrollbar" + " " + widget_to_string w0);
fun make_vertical_scale (session, w0) # new Widget
=
do_int_command (session, "make_vertical_scale", "make_vertical_scale" + " " + widget_to_string w0);
fun make_horizontal_scale (session, w0) # new Widget
=
do_int_command (session, "make_horizontal_scale", "make_horizontal_scale" + " " + widget_to_string w0);
fun make_vertical_scale_with_range (session, f0, f1, f2) # new Widget
=
do_int_command (session, "make_vertical_scale_with_range", "make_vertical_scale_with_range" + " " + eight_byte_float::to_string f0 + " " + eight_byte_float::to_string f1 + " " + eight_byte_float::to_string f2);
fun make_horizontal_scale_with_range (session, f0, f1, f2) # new Widget
=
do_int_command (session, "make_horizontal_scale_with_range", "make_horizontal_scale_with_range" + " " + eight_byte_float::to_string f0 + " " + eight_byte_float::to_string f1 + " " + eight_byte_float::to_string f2);
fun make_drawing_area (session) # new Widget
=
do_int_command (session, "make_drawing_area", "make_drawing_area");
fun make_pixmap (session, w0, i1, i2) # new Widget
=
do_int_command (session, "make_pixmap", "make_pixmap" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun make_status_bar (session) # new Widget
=
do_int_command (session, "make_status_bar", "make_status_bar");
fun push_text_on_status_bar (session, w0, i1, s2) # Int
=
do_int_command (session, "push_text_on_status_bar", "push_text_on_status_bar" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + string_to_string s2);
fun pop_text_off_status_bar (session, w0, i1) # Void
=
do_void_command (session, "pop_text_off_status_bar" + " " + widget_to_string w0 + " " + int::to_string i1);
fun remove_text_from_status_bar (session, w0, i1, i2) # Void
=
do_void_command (session, "remove_text_from_status_bar" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun pack_box (session, w0, w1, i2, b3, b4, i5) # Void
=
do_void_command (session, "pack_box" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + bool_to_string b3 + " " + bool_to_string b4 + " " + int::to_string i5);
fun menu_shell_append (session, w0, w1) # Void
=
do_void_command (session, "menu_shell_append" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun menu_bar_append (session, w0, w1) # Void
=
do_void_command (session, "menu_bar_append" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun append_text_to_combo_box (session, w0, s1) # Void
=
do_void_command (session, "append_text_to_combo_box" + " " + widget_to_string w0 + " " + string_to_string s1);
fun set_option_menu_menu (session, w0, w1) # Void
=
do_void_command (session, "set_option_menu_menu" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun set_text_tooltip_on_widget (session, w0, s1) # Void
=
do_void_command (session, "set_text_tooltip_on_widget" + " " + widget_to_string w0 + " " + string_to_string s1);
fun set_ruler_metric (session, w0, i1) # Void
=
do_void_command (session, "set_ruler_metric" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_ruler_range (session, w0, f1, f2, f3, f4) # Void
=
do_void_command (session, "set_ruler_range" + " " + widget_to_string w0 + " " + eight_byte_float::to_string f1 + " " + eight_byte_float::to_string f2 + " " + eight_byte_float::to_string f3 + " " + eight_byte_float::to_string f4);
fun set_scrollbar_policy (session, w0, i1, i2) # Void
=
do_void_command (session, "set_scrollbar_policy" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun draw_rectangle (session, w0, w1, b2, i3, i4, i5, i6) # Void
=
do_void_command (session, "draw_rectangle" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + bool_to_string b2 + " " + int::to_string i3 + " " + int::to_string i4 + " " + int::to_string i5 + " " + int::to_string i6);
fun draw_drawable (session, w0, w1, w2, i3, i4, i5, i6, i7, i8) # Void
=
do_void_command (session, "draw_drawable" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + widget_to_string w2 + " " + int::to_string i3 + " " + int::to_string i4 + " " + int::to_string i5 + " " + int::to_string i6 + " " + int::to_string i7 + " " + int::to_string i8);
fun queue_redraw (session, w0, i1, i2, i3, i4) # Void
=
do_void_command (session, "queue_redraw" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2 + " " + int::to_string i3 + " " + int::to_string i4);
fun press_button (session, w0) # Void
=
do_void_command (session, "press_button" + " " + widget_to_string w0);
fun release_button (session, w0) # Void
=
do_void_command (session, "release_button" + " " + widget_to_string w0);
fun click_button (session, w0) # Void
=
do_void_command (session, "click_button" + " " + widget_to_string w0);
fun enter_button (session, w0) # Void
=
do_void_command (session, "enter_button" + " " + widget_to_string w0);
fun leave_button (session, w0) # Void
=
do_void_command (session, "leave_button" + " " + widget_to_string w0);
fun show_widget (session, w0) # Void
=
do_void_command (session, "show_widget" + " " + widget_to_string w0);
fun show_widget_tree (session, w0) # Void
=
do_void_command (session, "show_widget_tree" + " " + widget_to_string w0);
fun destroy_widget (session, w0) # Void
=
do_void_command (session, "destroy_widget" + " " + widget_to_string w0);
fun emit_changed_signal (session, w0) # Void
=
do_void_command (session, "emit_changed_signal" + " " + widget_to_string w0);
fun pop_up_combo_box (session, w0) # Void
=
do_void_command (session, "pop_up_combo_box" + " " + widget_to_string w0);
fun pop_down_combo_box (session, w0) # Void
=
do_void_command (session, "pop_down_combo_box" + " " + widget_to_string w0);
fun set_combo_box_title (session, w0, s1) # Void
=
do_void_command (session, "set_combo_box_title" + " " + widget_to_string w0 + " " + string_to_string s1);
fun set_window_title (session, w0, s1) # Void
=
do_void_command (session, "set_window_title" + " " + widget_to_string w0 + " " + string_to_string s1);
fun set_window_default_size (session, w0, i1, i2) # Void
=
do_void_command (session, "set_window_default_size" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun set_minimum_widget_size (session, w0, i1, i2) # Void
=
do_void_command (session, "set_minimum_widget_size" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun set_border_width (session, w0, i1) # Void
=
do_void_command (session, "set_border_width" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_event_box_visibility (session, w0, b1) # Void
=
do_void_command (session, "set_event_box_visibility" + " " + widget_to_string w0 + " " + bool_to_string b1);
fun set_widget_alignment (session, w0, f1, f2) # Void
=
do_void_command (session, "set_widget_alignment" + " " + widget_to_string w0 + " " + eight_byte_float::to_string f1 + " " + eight_byte_float::to_string f2);
fun set_widget_events (session, w0, i1) # Void
=
do_void_command (session, "set_widget_events" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_widget_name (session, w0, s1) # Void
=
do_void_command (session, "set_widget_name" + " " + widget_to_string w0 + " " + string_to_string s1);
fun set_label_justification (session, w0, i1) # Void
=
do_void_command (session, "set_label_justification" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_label_line_wrapping (session, w0, b1) # Void
=
do_void_command (session, "set_label_line_wrapping" + " " + widget_to_string w0 + " " + bool_to_string b1);
fun set_label_underlines (session, w0, s1) # Void
=
do_void_command (session, "set_label_underlines" + " " + widget_to_string w0 + " " + string_to_string s1);
fun set_scale_value_position (session, w0, i1) # Void
=
do_void_command (session, "set_scale_value_position" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_draw_scale_value (session, w0, b1) # Void
=
do_void_command (session, "set_draw_scale_value" + " " + widget_to_string w0 + " " + bool_to_string b1);
fun get_scale_value_digits_shown (session, w0) # Int
=
do_int_command (session, "get_scale_value_digits_shown", "get_scale_value_digits_shown" + " " + widget_to_string w0);
fun set_scale_value_digits_shown (session, w0, i1) # Void
=
do_void_command (session, "set_scale_value_digits_shown" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_range_update_policy (session, w0, i1) # Void
=
do_void_command (session, "set_range_update_policy" + " " + widget_to_string w0 + " " + int::to_string i1);
fun get_toggle_button_state (session, w0) # Bool
=
{ result = do_string_command (session, "get_toggle_button_state", "get_toggle_button_state" + " " + widget_to_string w0);
the (int::from_string result) != 0;
};
fun set_toggle_button_state (session, w0, b1) # Void
=
do_void_command (session, "set_toggle_button_state" + " " + widget_to_string w0 + " " + bool_to_string b1);
fun get_adjustment_value (session, w0) # Float
=
{ result = do_string_command (session, "get_adjustment_value", "get_adjustment_value" + " " + widget_to_string w0);
the (eight_byte_float::from_string result);
};
fun set_adjustment_value (session, w0, f1) # Void
=
do_void_command (session, "set_adjustment_value" + " " + widget_to_string w0 + " " + eight_byte_float::to_string f1);
fun get_white_graphics_context (session, w0) # Widget
=
do_int_command (session, "get_white_graphics_context", "get_white_graphics_context" + " " + widget_to_string w0);
fun get_black_graphics_context (session, w0) # Widget
=
do_int_command (session, "get_black_graphics_context", "get_black_graphics_context" + " " + widget_to_string w0);
fun get_current_foreground_graphics_context (session, w0) # Widget
=
do_int_command (session, "get_current_foreground_graphics_context", "get_current_foreground_graphics_context" + " " + widget_to_string w0);
fun get_current_background_graphics_context (session, w0) # Widget
=
do_int_command (session, "get_current_background_graphics_context", "get_current_background_graphics_context" + " " + widget_to_string w0);
fun get_widget_window (session, w0) # Widget
=
do_int_command (session, "get_widget_window", "get_widget_window" + " " + widget_to_string w0);
fun add_kid (session, w0, w1) # Void
=
do_void_command (session, "add_kid" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun add_scrolled_window_kid (session, w0, w1) # Void
=
do_void_command (session, "add_scrolled_window_kid" + " " + widget_to_string w0 + " " + widget_to_string w1);
fun add_table_kid (session, w0, w1, i2, i3, i4, i5) # Void
=
do_void_command (session, "add_table_kid" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + int::to_string i3 + " " + int::to_string i4 + " " + int::to_string i5);
fun add_table_kid2 (session, w0, w1, i2, i3, i4, i5, i6, i7, i8, i9) # Void
=
do_void_command (session, "add_table_kid2" + " " + widget_to_string w0 + " " + widget_to_string w1 + " " + int::to_string i2 + " " + int::to_string i3 + " " + int::to_string i4 + " " + int::to_string i5 + " " + int::to_string i6 + " " + int::to_string i7 + " " + int::to_string i8 + " " + int::to_string i9);
fun get_viewport_vertical_adjustment (session, w0) # Widget
=
do_int_command (session, "get_viewport_vertical_adjustment", "get_viewport_vertical_adjustment" + " " + widget_to_string w0);
fun get_viewport_horizontal_adjustment (session, w0) # Widget
=
do_int_command (session, "get_viewport_horizontal_adjustment", "get_viewport_horizontal_adjustment" + " " + widget_to_string w0);
fun set_table_row_spacing (session, w0, i1, i2) # Void
=
do_void_command (session, "set_table_row_spacing" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun set_table_col_spacing (session, w0, i1, i2) # Void
=
do_void_command (session, "set_table_col_spacing" + " " + widget_to_string w0 + " " + int::to_string i1 + " " + int::to_string i2);
fun set_table_row_spacings (session, w0, i1) # Void
=
do_void_command (session, "set_table_row_spacings" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_table_col_spacings (session, w0, i1) # Void
=
do_void_command (session, "set_table_col_spacings" + " " + widget_to_string w0 + " " + int::to_string i1);
fun set_clicked_callback (session, w0) # Int
=
do_int_command (session, "set_clicked_callback", "set_clicked_callback" + " " + widget_to_string w0);
fun set_pressed_callback (session, w0) # Int
=
do_int_command (session, "set_pressed_callback", "set_pressed_callback" + " " + widget_to_string w0);
fun set_release_callback (session, w0) # Int
=
do_int_command (session, "set_release_callback", "set_release_callback" + " " + widget_to_string w0);
fun set_enter_callback (session, w0) # Int
=
do_int_command (session, "set_enter_callback", "set_enter_callback" + " " + widget_to_string w0);
fun set_leave_callback (session, w0) # Int
=
do_int_command (session, "set_leave_callback", "set_leave_callback" + " " + widget_to_string w0);
fun set_activate_callback (session, w0) # Int
=
do_int_command (session, "set_activate_callback", "set_activate_callback" + " " + widget_to_string w0);
fun set_destroy_callback (session, w0) # Int
=
do_int_command (session, "set_destroy_callback", "set_destroy_callback" + " " + widget_to_string w0);
fun set_realize_callback (session, w0) # Int
=
do_int_command (session, "set_realize_callback", "set_realize_callback" + " " + widget_to_string w0);
fun set_button_press_event_callback (session, w0) # Int
=
do_int_command (session, "set_button_press_event_callback", "set_button_press_event_callback" + " " + widget_to_string w0);
fun set_button_release_event_callback (session, w0) # Int
=
do_int_command (session, "set_button_release_event_callback", "set_button_release_event_callback" + " " + widget_to_string w0);
fun set_scroll_event_callback (session, w0) # Int
=
do_int_command (session, "set_scroll_event_callback", "set_scroll_event_callback" + " " + widget_to_string w0);
fun set_motion_notify_event_callback (session, w0) # Int
=
do_int_command (session, "set_motion_notify_event_callback", "set_motion_notify_event_callback" + " " + widget_to_string w0);
fun set_delete_event_callback (session, w0) # Int
=
do_int_command (session, "set_delete_event_callback", "set_delete_event_callback" + " " + widget_to_string w0);
fun set_expose_event_callback (session, w0) # Int
=
do_int_command (session, "set_expose_event_callback", "set_expose_event_callback" + " " + widget_to_string w0);
fun set_key_press_event_callback (session, w0) # Int
=
do_int_command (session, "set_key_press_event_callback", "set_key_press_event_callback" + " " + widget_to_string w0);
fun set_key_release_event_callback (session, w0) # Int
=
do_int_command (session, "set_key_release_event_callback", "set_key_release_event_callback" + " " + widget_to_string w0);
fun set_enter_notify_event_callback (session, w0) # Int
=
do_int_command (session, "set_enter_notify_event_callback", "set_enter_notify_event_callback" + " " + widget_to_string w0);
fun set_leave_notify_event_callback (session, w0) # Int
=
do_int_command (session, "set_leave_notify_event_callback", "set_leave_notify_event_callback" + " " + widget_to_string w0);
fun set_configure_event_callback (session, w0) # Int
=
do_int_command (session, "set_configure_event_callback", "set_configure_event_callback" + " " + widget_to_string w0);
fun set_focus_in_event_callback (session, w0) # Int
=
do_int_command (session, "set_focus_in_event_callback", "set_focus_in_event_callback" + " " + widget_to_string w0);
fun set_focus_out_event_callback (session, w0) # Int
=
do_int_command (session, "set_focus_out_event_callback", "set_focus_out_event_callback" + " " + widget_to_string w0);
fun set_map_event_callback (session, w0) # Int
=
do_int_command (session, "set_map_event_callback", "set_map_event_callback" + " " + widget_to_string w0);
fun set_unmap_event_callback (session, w0) # Int
=
do_int_command (session, "set_unmap_event_callback", "set_unmap_event_callback" + " " + widget_to_string w0);
fun set_property_notify_event_callback (session, w0) # Int
=
do_int_command (session, "set_property_notify_event_callback", "set_property_notify_event_callback" + " " + widget_to_string w0);
fun set_selection_clear_event_callback (session, w0) # Int
=
do_int_command (session, "set_selection_clear_event_callback", "set_selection_clear_event_callback" + " " + widget_to_string w0);
fun set_selection_request_event_callback (session, w0) # Int
=
do_int_command (session, "set_selection_request_event_callback", "set_selection_request_event_callback" + " " + widget_to_string w0);
fun set_selection_notify_event_callback (session, w0) # Int
=
do_int_command (session, "set_selection_notify_event_callback", "set_selection_notify_event_callback" + " " + widget_to_string w0);
fun set_proximity_in_event_callback (session, w0) # Int
=
do_int_command (session, "set_proximity_in_event_callback", "set_proximity_in_event_callback" + " " + widget_to_string w0);
fun set_proximity_out_event_callback (session, w0) # Int
=
do_int_command (session, "set_proximity_out_event_callback", "set_proximity_out_event_callback" + " " + widget_to_string w0);
fun set_client_event_callback (session, w0) # Int
=
do_int_command (session, "set_client_event_callback", "set_client_event_callback" + " " + widget_to_string w0);
fun set_no_expose_event_callback (session, w0) # Int
=
do_int_command (session, "set_no_expose_event_callback", "set_no_expose_event_callback" + " " + widget_to_string w0);
fun set_window_state_event_callback (session, w0) # Int
=
do_int_command (session, "set_window_state_event_callback", "set_window_state_event_callback" + " " + widget_to_string w0);
fun set_toggled_callback (session, w0) # Int
=
do_int_command (session, "set_toggled_callback", "set_toggled_callback" + " " + widget_to_string w0);
fun set_value_changed_callback (session, w0) # Int
=
do_int_command (session, "set_value_changed_callback", "set_value_changed_callback" + " " + widget_to_string w0);
# Do not edit this or preceding lines -- they are autogenerated by make-gtk-glue.
};
end;


