Next Previous Contents

9. Miscellaneous

SLgtk provides an assortment of other higher-level S-Lang functions and variables, to simplify common case use of selected Gtk widgets or features. The names of some of these are prefixed with underscores, usually to distinguish them from wrappers for Gtk functions proper or denote their higher susceptibility to revision in a future release.

9.1 GdkColor Variables

As a convenience SLgtk pre-allocates a number of GdkColor structures, for colors expected to be commonly used. They are named

and will be available in the relevant namespace after gtk.sl has been loaded.

9.2 _menu_new

        GtkWidget = _menu_new(String_Type labels[], callback [,cbdata1, cbdata2, ...] )
A convenience function to instantiate a GtkMenu, whose entries are labels created from the given array of strings. The callback specification may either be NULL or a signature (a function reference, optionally followed by one or more callback data parameters) suitable for responding to the activate signal via g_signal_connect(). Recall that such callback functions should accept at least one argument, even when no callback data is registered, to receive the activated menu item. Any label which, after being lowercased, matches "<separator>" will cause a horizontal separator to be drawn in the menu.

9.3 _option_menu_new

        GtkWidget = _option_menu_new(String_Type labels[], Integer_type default)
A convenience function to instantiate a GtkOptionMenu, whose entries are labels created from the given array of strings. The active menu item will be set to the given default.

9.4 _color_button_new

        GtkWidget = _color_button_new(GdkColor_structure)
This function returns an instantiated GtkButton, which when realized will display a swatch of the given color. When the button is pressed a color selection dialog will be launched through which the color of the swatch (as well as the RGB field values within the given GdkColor structure, since S-Lang structures are passed as references) may be modified.

9.5 _info_window

        Void_Type        _info_window(title,text)
This function will create a non-modal dialog to display the given text in a window with the given title. The dialog will be raised immediately, provided there is at least one active gtk_main() loop context.

9.6 _is_numeric

        Integer_Type  =  _is_numeric(Any_Type datum)
This function will return a one if the given datum can be interpreted as a real- or integral-valued numerical type, and zero otherwise. This function will be phased out of SLgtk proper, as it is now available in S-Lang 2.x.

9.7 _is_callable

        Integer_Type  =  _is_callable(Any_Type datum)
This function returns either 1 or 0, to indicate whether the given datum can be dereferenced to invoke a function. This function will be phased out of SLgtk proper, as it is now available in S-Lang 2.x.

9.8 _get_slgtk_doc_string

        String_Type = _get_slgtk_doc_string(topic)
This function will search the SLgtk documentation for the given topic. If the topic is found then its entire entry will be returned as a single string, otherwise an error string will be returned.

9.9 _gtk_window_destroy_with(window,parent)

Provides a one-step way to set the transient parent of a window AND have it be destroyed with that parent. It is equivalent to calling

        gtk_window_set_transient_for(window,parent);
        gtk_window_destroy_with_parent(window,TRUE);

9.10 _gdk_pixbuf_get_formats()

        Array_Type = _gdk_pixbuf_get_formats()
Similar to the Gdk function gdk_pixbuf_get_formats(), in that its return value indicates the number and kind of file formats supported by the Gdk pixbuf interface, only this version returns an array of String_Type instead of a GSList*.


Next Previous Contents