


# gtk.api
#
# Here we define the primary low-level end-user
# api for constructing Gtk GUI interfaces.
#
# This api is implemented by the generic package
#
# src/lib/src/gtk-g.pkg#
# which is instantiated twice:
#
# src/lib/src/gtk.pkg# src/lib/src/gtk-via-pipe.pkg#
# The former puts the Gtk library code in our main
# Mythryl process address space; the latter puts it
# in a subprocess, controlled via a pipe.
#
# Putting the Gtk code in the main process is potentially
# faster but carries the risk that loose pointers in the
# Gtk C code can corrupt the delicate and dynamic Mythryl
# heap. Pointer bugs have always been endemic in C code,
# so this is a nontrivial risk.
#
# Putting the Gtk code in a subprocess yields the opposite
# cost/benefit tradeoff: Passing control back and forth
# through the control pipe may potentially slow down the
# GUI, but bugs in the Gtk C code cannot possible crash
# the main Mythryl application; at most they can crash
# the Gtk subprocess. (Note that on a multicore machine
# putting the Gtk display code in a subprocess may actually
# improve performance, by allowing the Gtk code to run in
# parallel with the main Mythyrl process.)
#
#
# A alternative higher-level interface to Gtk functionality
# which is intended to make easy stuff easier at the cost of
# being somewhat less flexible is defined in
#
# src/lib/src/easy-gtk.api# Compiled by:
# src/lib/std/standard.lib# Implemented in:
# src/lib/src/gtk.pkg# src/lib/src/gtk-via-pipe.pkg# See also:
# src/lib/src/easy-gtk.api### "Complexity is a hard global problem.
### Efficiency is an easy local problem.
### Solve the hard problem first."
# NB: Lines which contain a comment
# starting with the keyword 'glue'
# are read and analysed by
#
# src/lib/src/make-gtk-glue
#
# which synthesizes code
# in response.
api Gtk {
#
exception GTK_ERROR String;
Session;
Widget; # This is the production def
# Do not edit this or following lines -- they are autogenerated by make-gtk-glue.
Event_Mask
= EXPOSURE_MASK
| POINTER_MOTION_MASK
| POINTER_MOTION_HINT_MASK
| BUTTON_MOTION_MASK
| BUTTON1_MOTION_MASK
| BUTTON2_MOTION_MASK
| BUTTON3_MOTION_MASK
| BUTTON_PRESS_MASK
| BUTTON_RELEASE_MASK
| KEY_PRESS_MASK
| KEY_RELEASE_MASK
| ENTER_NOTIFY_MASK
| LEAVE_NOTIFY_MASK
| FOCUS_CHANGE_MASK
| STRUCTURE_MASK
| PROPERTY_CHANGE_MASK
| PROXIMITY_IN_MASK
| PROXIMITY_OUT_MASK
;
Void_Callback = Void -> Void;
Bool_Callback = Bool -> Void;
Float_Callback = Float -> Void;
Button_Event_Callback = gtk_event::Button_Event -> Void; # # http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventButton
Key_Event_Callback = gtk_event::Key_Event -> Void; # # http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventKey
Expose_Event_Callback = gtk_event::Expose_Event -> Void; # # http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventExpose
Motion_Event_Callback = gtk_event::Motion_Event -> Void; # # http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventMotion
Configure_Event_Callback = gtk_event::Configure_Event -> Void; # # http://library.gnome.org/devel/gdk/stable/gdk-Event-Structures.html#GdkEventConfigure
Pack_From
=
FROM_START | FROM_END;
Arrow_Direction
= ARROW_UP
| ARROW_DOWN
| ARROW_LEFT
| ARROW_RIGHT;
Shadow_Style
= SHADOW_NONE
| SHADOW_IN
| SHADOW_OUT
| SHADOW_ETCHED_IN
| SHADOW_ETCHED_OUT;
Metric = PIXELS | INCHES | CENTIMETERS;
Scrollbar_Policy
= POLICY_AUTOMATIC
| POLICY_ALWAYS;
Justification
= JUSTIFY_LEFT
| JUSTIFY_RIGHT
| JUSTIFY_CENTER
| JUSTIFY_FILL;
Position_Type
=
POSITION_LEFT |
POSITION_RIGHT |
POSITION_TOP |
POSITION_BOTTOM ;
Update_Policy
=
CONTINUOUS_UPDATES |
DISCONTINUOUS_UPDATES |
DELAYED_UPDATES ;
Table_Attach_Option
=
TABLE_FILL | TABLE_SHRINK | TABLE_EXPAND;
# Do not edit this or preceding lines -- they are autogenerated by make-gtk-glue.
set_widget_tree: (Session, Widget) -> Void; #
make_session: List( String ) -> Session; # # http://library.gnome.org/devel/gtk/stable/gtk-General.html#gtk-init
run_eventloop_indefinitely: Session -> Void; # # http://library.gnome.org/devel/gtk/stable/gtk-General.html#gtk-main
run_eventloop_once: { session: Session, block_until_event: Bool } -> Bool; # # http://library.gnome.org/devel/gtk/stable/gtk-General.html#gtk-main
quit_eventloop: Session -> Void; # # http://library.gnome.org/devel/gtk/stable/gtk-General.html#gtk-exit
make_dialog # # http://library.gnome.org/devel/gtk/stable/GtkDialog.html#gtk-dialog-new
:
Session
->
{ dialog: Widget,
vbox: Widget,
action_area: Widget
};
set_easy_id: (Session, String, Widget) -> Void;
get_by_easy_id: (Session, String) -> Widget;
drop_easy_id: (Session, String) -> Void;
unref_object: (Session, Widget) -> Void; # # http://library.gnome.org/devel/gobject/stable/gobject-The-Base-Object-Type.html#g-object-unref
get_widget_allocation: (Session, Widget) -> gtk_event::Allocation;
get_window_pointer # # http://library.gnome.org/devel/gdk/unstable/gdk-Windows.html#gdk-window-get-pointer
:
(Session, Widget)
->
{ x: Int,
y: Int,
modifiers: List( gtk_event::Modifier )
};
# Do not edit this or following lines -- they are autogenerated by make-gtk-glue.
make_window: Session -> Widget;
make_label: (Session, String) -> Widget;
make_status_bar_context_id: (Session, Widget, String) -> Int;
make_menu: Session -> Widget;
make_option_menu: Session -> Widget;
make_menu_bar: Session -> Widget;
make_combo_box: Session -> Widget;
make_text_combo_box: Session -> Widget;
make_frame: (Session, String) -> Widget;
make_button: Session -> Widget;
make_button_with_label: (Session, String) -> Widget;
make_button_with_mnemonic: (Session, String) -> Widget;
make_toggle_button: Session -> Widget;
make_toggle_button_with_label: (Session, String) -> Widget;
make_toggle_button_with_mnemonic: (Session, String) -> Widget;
make_check_button: Session -> Widget;
make_check_button_with_label: (Session, String) -> Widget;
make_check_button_with_mnemonic: (Session, String) -> Widget;
make_menu_item: Session -> Widget;
make_menu_item_with_label: (Session, String) -> Widget;
make_menu_item_with_mnemonic: (Session, String) -> Widget;
make_first_radio_button: Session -> Widget;
make_next_radio_button: (Session, Widget) -> Widget;
make_first_radio_button_with_label: (Session, String) -> Widget;
make_next_radio_button_with_label: (Session, Widget, String) -> Widget;
make_first_radio_button_with_mnemonic: (Session, String) -> Widget;
make_next_radio_button_with_mnemonic: (Session, Widget, String) -> Widget;
make_arrow: (Session, Arrow_Direction, Shadow_Style) -> Widget;
set_arrow: (Session, Widget, Arrow_Direction, Shadow_Style) -> Void;
make_horizontal_box: (Session, Bool, Int) -> Widget;
make_vertical_box: (Session, Bool, Int) -> Widget;
make_horizontal_button_box: Session -> Widget;
make_vertical_button_box: Session -> Widget;
make_table: { session: Session, rows: Int, cols: Int, homogeneous: Bool } -> Widget;
make_event_box: Session -> Widget;
make_image_from_file: (Session, String) -> Widget;
make_horizontal_separator: Session -> Widget;
make_vertical_separator: Session -> Widget;
make_layout_container: Session -> Widget;
layout_put: { session: Session, layout: Widget, kid: Widget, x: Int, y: Int } -> Void;
layout_move: { session: Session, layout: Widget, kid: Widget, x: Int, y: Int } -> Void;
make_fixed_container: Session -> Widget;
fixed_put: { session: Session, layout: Widget, kid: Widget, x: Int, y: Int } -> Void;
fixed_move: { session: Session, layout: Widget, kid: Widget, x: Int, y: Int } -> Void;
make_adjustment: { session: Session, value: Float, lower: Float, upper: Float, step_increment: Float, page_increment: Float, page_size: Float } -> Widget;
make_viewport: { session: Session, horizontal_adjustment: Null_Or(Widget), vertical_adjustment: Null_Or(Widget) } -> Widget;
make_scrolled_window: { session: Session, horizontal_adjustment: Null_Or(Widget), vertical_adjustment: Null_Or(Widget) } -> Widget;
make_horizontal_ruler: Session -> Widget;
make_vertical_ruler: Session -> Widget;
make_vertical_scrollbar: (Session, Null_Or(Widget)) -> Widget;
make_horizontal_scrollbar: (Session, Null_Or(Widget)) -> Widget;
make_vertical_scale: (Session, Null_Or(Widget)) -> Widget;
make_horizontal_scale: (Session, Null_Or(Widget)) -> Widget;
make_vertical_scale_with_range: { session: Session, min: Float, max: Float, step: Float } -> Widget;
make_horizontal_scale_with_range: { session: Session, min: Float, max: Float, step: Float } -> Widget;
make_drawing_area: Session -> Widget;
make_pixmap: { session: Session, window: Widget, wide: Int, high: Int } -> Widget;
make_status_bar: Session -> Widget;
push_text_on_status_bar: (Session, Widget, Int, String) -> Int;
pop_text_off_status_bar: (Session, Widget, Int) -> Void;
remove_text_from_status_bar: { session: Session, status_bar: Widget, context: Int, message: Int } -> Void;
pack_box: { session: Session, box: Widget, kid: Widget, pack: Pack_From, expand: Bool, fill: Bool, padding: Int } -> Void;
menu_shell_append: { session: Session, menu: Widget, kid: Widget } -> Void;
menu_bar_append: { session: Session, menu: Widget, kid: Widget } -> Void;
append_text_to_combo_box: (Session, Widget, String) -> Void;
set_option_menu_menu: { session: Session, option_menu: Widget, menu: Widget } -> Void;
set_text_tooltip_on_widget: (Session, Widget, String) -> Void;
set_ruler_metric: (Session, Widget, Metric) -> Void;
set_ruler_range: { session: Session, ruler: Widget, lower: Float, upper: Float, position: Float, max_size: Float } -> Void;
set_scrollbar_policy: { session: Session, window: Widget, horizontal_scrollbar: Scrollbar_Policy, vertical_scrollbar: Scrollbar_Policy } -> Void;
draw_rectangle: { session: Session, drawable: Widget, gcontext: Widget, filled: Bool, x: Int, y: Int, wide: Int, high: Int } -> Void;
draw_drawable: { session: Session, drawable: Widget, gcontext: Widget, from: Widget, from_x: Int, from_y: Int, to_x: Int, to_y: Int, wide: Int, high: Int } -> Void;
queue_redraw: { session: Session, widget: Widget, x: Int, y: Int, wide: Int, high: Int } -> Void;
press_button: (Session, Widget) -> Void;
release_button: (Session, Widget) -> Void;
click_button: (Session, Widget) -> Void;
enter_button: (Session, Widget) -> Void;
leave_button: (Session, Widget) -> Void;
show_widget: (Session, Widget) -> Void;
show_widget_tree: (Session, Widget) -> Void;
destroy_widget: (Session, Widget) -> Void;
emit_changed_signal: (Session, Widget) -> Void;
pop_up_combo_box: (Session, Widget) -> Void;
pop_down_combo_box: (Session, Widget) -> Void;
set_combo_box_title: (Session, Widget, String) -> Void;
set_window_title: (Session, Widget, String) -> Void;
set_window_default_size: (Session, Widget, (Int,Int)) -> Void;
set_minimum_widget_size: (Session, Widget, (Int,Int)) -> Void;
set_border_width: (Session, Widget, Int) -> Void;
set_event_box_visibility: (Session, Widget, Bool) -> Void;
set_widget_alignment: { session: Session, widget: Widget, x: Float, y: Float } -> Void;
set_widget_events: (Session, Widget, List( Event_Mask )) -> Void;
set_widget_name: (Session, Widget, String) -> Void;
set_label_justification: (Session, Widget, Justification) -> Void;
set_label_line_wrapping: (Session, Widget, Bool) -> Void;
set_label_underlines: (Session, Widget, String) -> Void;
set_scale_value_position: (Session, Widget, Position_Type) -> Void;
set_draw_scale_value: (Session, Widget, Bool) -> Void;
get_scale_value_digits_shown: (Session, Widget) -> Int;
set_scale_value_digits_shown: (Session, Widget, Int) -> Void;
set_range_update_policy: (Session, Widget, Update_Policy) -> Void;
get_toggle_button_state: (Session, Widget) -> Bool;
set_toggle_button_state: (Session, Widget, Bool) -> Void;
get_adjustment_value: (Session, Widget) -> Float;
set_adjustment_value: (Session, Widget, Float) -> Void;
get_white_graphics_context: (Session, Widget) -> Widget;
get_black_graphics_context: (Session, Widget) -> Widget;
get_current_foreground_graphics_context:(Session, Widget) -> Widget;
get_current_background_graphics_context:(Session, Widget) -> Widget;
get_widget_window: (Session, Widget) -> Widget;
add_kid: { session: Session, mom: Widget, kid: Widget } -> Void;
add_scrolled_window_kid: { session: Session, window: Widget, kid: Widget } -> Void;
add_table_kid: { session: Session, table: Widget, kid: Widget, left: Int, right: Int, top: Int, bottom: Int } -> Void;
add_table_kid': { session: Session, table: Widget, kid: Widget, left: Int, right: Int, top: Int, bottom: Int, xoptions: List( Table_Attach_Option ), yoptions: List( Table_Attach_Option ), xpadding: Int, ypadding: Int } -> Void;
get_viewport_vertical_adjustment: (Session, Widget) -> Widget;
get_viewport_horizontal_adjustment: (Session, Widget) -> Widget;
set_table_row_spacing: { session: Session, table: Widget, row: Int, spacing: Int } -> Void;
set_table_col_spacing: { session: Session, table: Widget, col: Int, spacing: Int } -> Void;
set_table_row_spacings: (Session, Widget, Int) -> Void;
set_table_col_spacings: (Session, Widget, Int) -> Void;
set_clicked_callback: Session -> Widget -> Void_Callback -> Void;
set_pressed_callback: Session -> Widget -> Void_Callback -> Void;
set_release_callback: Session -> Widget -> Void_Callback -> Void;
set_enter_callback: Session -> Widget -> Void_Callback -> Void;
set_leave_callback: Session -> Widget -> Void_Callback -> Void;
set_activate_callback: Session -> Widget -> Void_Callback -> Void;
set_destroy_callback: Session -> Widget -> Void_Callback -> Void;
set_realize_callback: Session -> Widget -> Void_Callback -> Void;
set_button_press_event_callback: Session -> Widget -> Button_Event_Callback -> Void;
set_button_release_event_callback: Session -> Widget -> Void_Callback -> Void;
set_scroll_event_callback: Session -> Widget -> Void_Callback -> Void;
set_motion_notify_event_callback: Session -> Widget -> Motion_Event_Callback -> Void;
set_delete_event_callback: Session -> Widget -> Void_Callback -> Void;
set_expose_event_callback: Session -> Widget -> Expose_Event_Callback -> Void;
set_key_press_event_callback: Session -> Widget -> Key_Event_Callback -> Void;
set_key_release_event_callback: Session -> Widget -> Void_Callback -> Void;
set_enter_notify_event_callback: Session -> Widget -> Void_Callback -> Void;
set_leave_notify_event_callback: Session -> Widget -> Void_Callback -> Void;
set_configure_event_callback: Session -> Widget -> Configure_Event_Callback -> Void;
set_focus_in_event_callback: Session -> Widget -> Void_Callback -> Void;
set_focus_out_event_callback: Session -> Widget -> Void_Callback -> Void;
set_map_event_callback: Session -> Widget -> Void_Callback -> Void;
set_unmap_event_callback: Session -> Widget -> Void_Callback -> Void;
set_property_notify_event_callback: Session -> Widget -> Void_Callback -> Void;
set_selection_clear_event_callback: Session -> Widget -> Void_Callback -> Void;
set_selection_request_event_callback: Session -> Widget -> Void_Callback -> Void;
set_selection_notify_event_callback: Session -> Widget -> Void_Callback -> Void;
set_proximity_in_event_callback: Session -> Widget -> Void_Callback -> Void;
set_proximity_out_event_callback: Session -> Widget -> Void_Callback -> Void;
set_client_event_callback: Session -> Widget -> Void_Callback -> Void;
set_no_expose_event_callback: Session -> Widget -> Void_Callback -> Void;
set_window_state_event_callback: Session -> Widget -> Void_Callback -> Void;
set_toggled_callback: Session -> Widget -> Bool_Callback -> Void;
set_value_changed_callback: Session -> Widget -> Float_Callback -> Void;
# Do not edit this or preceding lines -- they are autogenerated by make-gtk-glue.
clamp: { min: Float, max: Float, value: Float } -> Float;
};
## Code by Jeff Prothero: Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


