PreviousUpNext

15.3.357  src/lib/src/easy-gtk.api

# easy-gtk.api
#
#            "Simple  things should be simple;
#             complex things should be possible."
#
#                             -- Alan Kay
#
# The vanilla GTK+ bindings do a good job of making
# complex things possible, but a poor job of making
# simple things simple.
#
# The purpose of easy-gtk to make it simple
# to create simple GTK GUI interfaces.
#
# We do not attempt here to support every possible
# oddball requirement -- the user can always drop
# back to the regular GTK binding for that -- but
# rather only to minimize the effort needed to
# create typical, common widget configurations.

# Compiled by:
#     src/lib/std/standard.lib

# Implemented in:
#     src/lib/src/easy-gtk.pkg



###               "Let me seize the Glory unattainable
###                To the bottom of deep ocean,
###                In the bottom of profound gulfs."
###
###                        -- "Mythology of All Races",
###                            Vol. VI, Indian & Iranian,
###                            (1917) p. 267



api Easy_Gtk {
    #
    include Gtk;                                # Gtk   is from   src/lib/src/gtk.api

    Arg
        = CALLBACKS  List( Callback_Type )
        | PROPERTIES List( Property      )
        | KIDS       List( Widget_Tree   )

    also
    Box_Arg
        = HOMOGENEOUS Bool                      # These two are box properties
        | SPACING     Int

        | PADDING     Int                       # These four are boxkid properties
        | EXPAND      Bool
        | FILL        Bool
        | PACK_FROM   Pack_From

    also
    Widget_Tree

        = WINDOW  List( Arg ) 

        | HORIZONTAL_BOX    (List( Box_Arg), List( Widget_Tree ))
        | VERTICAL_BOX      (List( Box_Arg), List( Widget_Tree ))

        | LABEL  (String, List( Arg ))

        | BUTTON                        List( Arg )
        | BUTTON_WITH_LABEL    (String, List( Arg ))
        | BUTTON_WITH_MNEMONIC (String, List( Arg ))

        | TOGGLE_BUTTON                        List( Arg )
        | TOGGLE_BUTTON_WITH_LABEL    (String, List( Arg ))
        | TOGGLE_BUTTON_WITH_MNEMONIC (String, List( Arg ))

        | CHECK_BUTTON                        List( Arg )
        | CHECK_BUTTON_WITH_LABEL    (String, List( Arg ))
        | CHECK_BUTTON_WITH_MNEMONIC (String, List( Arg ))

        | IMAGE_FROM_FILE (String, List( Arg ))

    also
    Callback_Type

        = DESTROY                        Void_Callback
        | REALIZE                        Void_Callback

        | CLICK                          Void_Callback
        | PRESS                          Void_Callback
        | RELEASE                        Void_Callback
        | ENTER                          Void_Callback
        | LEAVE                          Void_Callback

        | BUTTON_PRESS_EVENT     Button_Event_Callback
        | BUTTON_RELEASE_EVENT           Void_Callback
        | KEY_PRESS_EVENT           Key_Event_Callback
        | KEY_RELEASE_EVENT              Void_Callback
        | SCROLL_EVENT                   Void_Callback
        | MOTION_NOTIFY_EVENT    Motion_Event_Callback
        | CONFIGURE_EVENT     Configure_Event_Callback
        | DELETE_EVENT                   Void_Callback
        | EXPOSE_EVENT           Expose_Event_Callback
        | ENTER_NOTIFY_EVENT             Void_Callback
        | LEAVE_NOTIFY_EVENT             Void_Callback
        | FOCUS_IN_EVENT                 Void_Callback
        | FOCUS_OUT_EVENT                Void_Callback
        | MAP_EVENT                      Void_Callback
        | UNMAP_EVENT                    Void_Callback
        | PROPERTY_NOTIFY_EVENT          Void_Callback
        | SELECTION_CLEAR_EVENT          Void_Callback
        | SELECTION_REQUEST_EVENT        Void_Callback
        | SELECTION_NOTIFY_EVENT         Void_Callback
        | PROXIMITY_IN_EVENT             Void_Callback
        | PROXIMITY_OUT_EVENT            Void_Callback
        | CLIENT_EVENT                   Void_Callback
        | NO_EXPOSE_EVENT                Void_Callback
        | WINDOW_STATE_EVENT             Void_Callback

    also
    Property
        = EASY_ID               String                  # This is part of our binding machinery, not part of GTK+ itself.
        | BORDER_WIDTH          Int
        | WINDOW_TITLE          String
        | WINDOW_DEFAULT_SIZE  (Int, Int)
        | EVENT_BOX_VISIBILITY  Bool
        ;

    do: Session -> Widget_Tree -> Void;

    # Defined curried versions of all the widget
    # constructors, to save on parens and because
    # shouting text gets tiresome:

    window: List( Arg )   -> Widget_Tree;

    horizontal_box: List( Box_Arg ) -> List( Widget_Tree ) -> Widget_Tree;      # Lets us write  horizontal_box [...] [...]   instead of   HORIZONTAL_BOX ([...], [...])
    vertical_box: List( Box_Arg ) -> List( Widget_Tree ) -> Widget_Tree;        # Lets us write  vertical_box   [...] [...]   instead of   VERTICAL_BOX ([...], [...])

    label:                        String -> List( Arg ) -> Widget_Tree;

    button_with_label:            String -> List( Arg ) -> Widget_Tree;
    button_with_mnemonic:         String -> List( Arg ) -> Widget_Tree;

    toggle_button_with_label:     String -> List( Arg ) -> Widget_Tree;
    toggle_button_with_mnemonic:  String -> List( Arg ) -> Widget_Tree;

    check_button_with_label:      String -> List( Arg ) -> Widget_Tree;
    check_button_with_mnemonic:   String -> List( Arg ) -> Widget_Tree;

    image_from_file:              String -> List( Arg ) -> Widget_Tree;


    homogeneous: Bool      ->  Box_Arg;
    spacing:     Int       ->  Box_Arg;
    padding:     Int       ->  Box_Arg;
    expand:      Bool      ->  Box_Arg; 
    fill:        Bool      ->  Box_Arg;
    pack_from:   Pack_From ->  Box_Arg;

    callbacks:   List( Callback_Type ) -> Arg;
    properties:  List( Property      ) -> Arg;
    kids:        List( Widget_Tree   ) -> Arg;

    easy_id:                     String     -> Property;
    border_width:                Int        -> Property;
    window_title:                String     -> Property;
    window_default_size:        (Int, Int)  -> Property;
    event_box_visibility:        Bool       -> Property;        

    destroy:                     Void_Callback    -> Callback_Type;
    realize:                     Void_Callback    -> Callback_Type;
    click:                       Void_Callback    -> Callback_Type;
    press:                       Void_Callback    -> Callback_Type;
    release:                     Void_Callback    -> Callback_Type;
    enter:                       Void_Callback    -> Callback_Type;
    leave:                       Void_Callback    -> Callback_Type;
    button_press_event:  Button_Event_Callback    -> Callback_Type;
    button_release_event:        Void_Callback    -> Callback_Type;
    key_press_event:        Key_Event_Callback    -> Callback_Type;
    key_release_event:           Void_Callback    -> Callback_Type;
    scroll_event:                Void_Callback    -> Callback_Type;
    motion_notify_event: Motion_Event_Callback    -> Callback_Type;
    configure_event:  Configure_Event_Callback    -> Callback_Type;
    delete_event:                Void_Callback    -> Callback_Type;
    expose_event:        Expose_Event_Callback    -> Callback_Type;
    enter_notify_event:          Void_Callback    -> Callback_Type;
    leave_notify_event:          Void_Callback    -> Callback_Type;
    focus_in_event:              Void_Callback    -> Callback_Type;
    focus_out_event:             Void_Callback    -> Callback_Type;
    map_event:                   Void_Callback    -> Callback_Type;
    unmap_event:                 Void_Callback    -> Callback_Type;
    property_notify_event:       Void_Callback    -> Callback_Type;
    selection_clear_event:       Void_Callback    -> Callback_Type;
    selection_request_event:     Void_Callback    -> Callback_Type;
    selection_notify_event:      Void_Callback    -> Callback_Type;
    proximity_in_event:          Void_Callback    -> Callback_Type;
    proximity_out_event:         Void_Callback    -> Callback_Type;
    client_event:                Void_Callback    -> Callback_Type;
    no_expose_event:             Void_Callback    -> Callback_Type;
    window_state_event:          Void_Callback    -> Callback_Type;

};


## Code by Jeff Prothero: Copyright (c) 2010-2012,
## released under Gnu Public Licence version 3.


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext