[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8. GTK+ interface

This chapter describes the interface for GTK+, the Open Source Free Software GUI Toolkit, primarily developed for use with the X Window System. The most detailed information about GTK+ may be found at http://www.gtk.org.

The interface is designed after the popular guile-gtk analog, the GTK+ interface for using with guile scheme implementation. My intention was to make the interface as compatible with that of guile-gtk as possible in order to utilize the tutorials, examples and other software written for guile-gtk.

For generation of multiple interfaces to GTK+ functions the cgen utility was developed See section 3.11 cgen - bigloo preprocessor, which was used to process the specification of GTK+ interface found in guile-gtk.

guile-gtk may be found at http://www.ping.de/sites/zagadka/guile-gtk/.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1 Testing the GTK interface

Since the main goal of GTK+ is to provide a graphical user interface, it is practically impossible to test it automatically. Instead, a test application was derived from analogous program provided with GTK+ (file gtk/testgtk.c in GTK+ distribution) and guile-gtk. Also this application may be used as a source of examples how to use bigloo-gtk.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1.1 testgtk program

The testgtk is port of testgtk.c provided with GTK+ distribution, to bigloo-gtk. Initially is was derived from testgtk.scm provided with guile-gtk. Now most of the text is redesigned, many tests made more up-to-date than the corresponding guile-gtk analogs.

All the original tests testgtk.c from latest GTK+ distribution are listed in main testgtk window, labels for whose that are still unimplemented are grayed.

The simplest way to run the testgtk is to process its source code by bigloo-bgtk driver program:

 
bigloo-bgtk ./testgtk.defs

but to make all the tests work, you probably have to compile and run binary executable:

 
make testgtk && ./testgtk


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.1.2 example programs

Bigloo-gtk provides a small set of examples, derived from whose provided in "GTK+ Tutorial". You'll find the examples in gtk/examples/ subdirectory. All the examples are shell scripts, though may be compiled. You need to install the package before running this examples.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2 Bigloo-gtk reference

Currently this reference guide of very far from completeness. Only selected calls are documented. Look at working tests code in testgtk.defs for example.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1 GDK Reference Manual


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.1 The gdk event object

procedure: gdk-event-type event::gdk-event => gdk-event-type
procedure: gdk-event-window event::gdk-event => gdk-window
procedure: gdk-event-send-event event::gdk-event => bool
procedure: gdk-event-visibility-state event::gdk-event => gdk-visibility-state
procedure: gdk-event-time event::gdk-event => int
procedure: gdk-event-x event::gdk-event => double
procedure: gdk-event-y event::gdk-event => double
procedure: gdk-event-pressure event::gdk-event => double
procedure: gdk-event-xtilt event::gdk-event => double
procedure: gdk-event-ytilt event::gdk-event => double
procedure: gdk-event-button event::gdk-event => int
procedure: gdk-event-button-state event::gdk-event => bool
procedure: gdk-event-is-hint event::gdk-event => bool
procedure: gdk-event-source event::gdk-event => gdk-input-source
procedure: gdk-event-deviceid event::gdk-event => int
procedure: gdk-event-x-root event::gdk-event => double
procedure: gdk-event-y-root event::gdk-event => double
procedure: gdk-event-key-state event::gdk-event => bool
procedure: gdk-event-keyval event::gdk-event => uint
procedure: gdk-event-string event::gdk-event => string
procedure: gdk-event-subwindow event::gdk-event => gdk-window
procedure: gdk-event-notify-detail event::gdk-event => gdk-notify-type
procedure: gdk-event-in event::gdk-event => bool
procedure: gdk-event-configure-x event::gdk-event => int
procedure: gdk-event-configure-y event::gdk-event => int
procedure: gdk-event-configure-width event::gdk-event => int
procedure: gdk-event-configure-height event::gdk-event => int
procedure: gdk-window-get-id window::gdk-window => int


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.2 The gdk color object

procedure: gdk-color-red o::gdk-color => uint
o
 
=>

procedure: gdk-color-green o::gdk-color => uint
o
 
=>

procedure: gdk-color-blue o::gdk-color => uint
o
 
=>

procedure: gdk-color-parse spec::string #!optional color::gdk-color => gdk-color

The gdk-color-parse procedure looks up the string name of a color, given in spec argument, with respect to the screen associated with the default colormap. On return it initializes the object given in a color argument with the exact color value. Use of uppercase or lowercase does not matter. If the color is not specified, the new instance of type gdk-color is allocated through gdk-color-alloc. If the color name is not resolved, an exception is raised.

 
(gdk-color-parse "red") => #<foreign:GDK-COLOR:fe471d10>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.3 The gdk font object

procedure: gdk-font-unref font::gdk-font => #unspecified
font
 
=>

procedure: gdk-font-ref font::gdk-font => #unspecified
font
 
=>

procedure: gdk-font-load name::string => gdk-font
name
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.4 The gdk drawing procedures

procedure: gdk-draw-string window::gdk-window font::gdk-font gc::gdk-gc x::int y::int string::string => #unspecified
window font gc x y string
 
=>

procedure: gdk-draw-arc window::gdk-window gc::gdk-gc filled::bool x::int y::int width::int height::int angle1::int angle2::int => #unspecified
window gc filled x y width height angle1 angle2
 
=>

procedure: gdk-draw-rectangle window::gdk-window gc::gdk-gc filled::bool x::int y::int width::int height::int
window gc filled x y width height
 
=>

procedure: gdk-draw-line window::gdk-window gc::gdk-gc x1::int y1::int x2::int y2::int => #unspecified
window gc x1 y1 x2 y2
 
=>

procedure: gdk-draw-pixmap drawable::gdk-window gc::gdk-gc src::gdk-window xsrc::int ysrc::int xdest::int ydest::int width::int height::int => #unspecified
drawable gc src xsrc ysrc xdest ydest width height
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.5 The gdk pixmap object

procedure: gdk-pixmap-new window width::int height::int #!optional depth => gdk-window
window width height depth
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.6 The gdk window object

procedure: gdk-window-get-parent window::gdk-window => gdk-window
window
 
=>

procedure: gdk-window-clear-area-e window::gdk-window x::int y::int width::int height::int => #unspecified
window x y width height
 
=>

procedure: gdk-window-clear-area window::gdk-window x::int y::int width::int height::int => #unspecified
window x y width height
 
=>

procedure: gdk-window-clear window::gdk-window => #unspecified
window
 
=>

procedure: gdk-window-new parent::gdk-window #!key => gdk-window

The procedure gdk-window-new creates a new gdk-window object. The main purpose of this procedure is creating new types of widgets which require its own window.

The following keyed arguments may be passed to this procedure:

In the following example a new window for a widget is created. The new window inherites all parent's attributes, excepr the width and height. Besides, the new window responds on the button-press event.

 
(let((parent(gtk-widget-get-parent-window widget)))
  (gdk-window-new parent
    title: "MyWindow"
    width: 200
    height: 200
    visual: (gdk-window-get-visual parent)
    colormap: (gdk-window-get-colormap parent)
    event-mask: (gdk-window-get-events parent)))
=> 

procedure: gdk-window-new-from-parent parent::gdk-window #!key

The procedure gdk-window-new-from-parent is a convenience substitution of gdk-window-new. Is accepts same arguments, but by default inherits th width, height, visual, colormap and event-mask of the parent window.

The example in gdk-window-new section may be rewritten as follows:

 
(let((parent(gtk-widget-get-parent-window widget)))
  (gdk-window-new parent
    title: "MyWindow"
    width: 200
    height: 200))
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.7 The gdk GC (graphic context) object

procedure: gdk-gc-set-line-attributes gc::gdk-gc line_width::int line_style::gdk-line-style cap_style::gdk-cap-style join_style::gdk-join-style => #unspecified
gc line_width line_style cap_style join_style
 
=>

procedure: gdk-gc-set-exposures gc::gdk-gc exposures::bool => #unspecified
gc exposures
 
=>

procedure: gdk-gc-set-subwindow gc::gdk-gc mode::gdk-subwindow-mode => #unspecified
gc mode
 
=>

procedure: gdk-gc-set-clip-origin gc::gdk-gc x::int y::int => #unspecified
gc x y
 
=>

procedure: gdk-gc-set-ts-origin gc::gdk-gc x::int y::int => #unspecified
gc x y
 
=>

procedure: gdk-gc-set-fill gc::gdk-gc fill::gdk-fill => #unspecified
gc fill
 
=>

procedure: gdk-gc-set-function gc::gdk-gc function::gdk-function => #unspecified
gc function
 
=>

procedure: gdk-gc-set-font gc::gdk-gc font::gdk-font => #unspecified
gc font
 
=>

procedure: gdk-gc-set-background gc::gdk-gc color::gdk-color => #unspecified
gc color
 
=>

procedure: gdk-gc-set-foreground gc::gdk-gc color::gdk-color => #unspecified
gc color
 
=>

procedure: gdk-gc-new window::gdk-window => gdk-gc
window
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.8 The gdk colormap object

procedure: gdk-colormap-alloc-color colormap::gdk-colormap color::gdk-color writeable::bool best_match::bool => bool
colormap color writeable best_match
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.1.9 gdk miscellaneous procedures

procedure: gdk-beep => #unspecified
 
=>

procedure: gdk-flush => #unspecified
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2 Types


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2.1 Introduction to the Type System

Every type in GTK+ is given an unique identifier. These identifiers have a type named gtk-type (they are sequential integers really).

A few numbers are preassigned to built-in GTK+ types (such an integers, strings, booleans etc.). All other type ids are allocated along with the first instance of that type.

procedure: gtk-type-name type::gtk-type => string
Get the GTK+ name of an existing type.

Note: the name returned is a GTK+ name, not a Bigloo type name, i.e. the value "GtkButton" will be returned for buttons, but not "gtk-button".

 
(gtk-type-name 2)
=> "gchar"

(gtk-type-name(gtk-object-type(gtk-button-new)))
=> "GtkButton"

procedure: gtk-type-from-name name::string => gtk-type

Given the name of an existing GTK+ type, return its type id.

 
(gtk-type-from-name "gint")
=> 5

(gtk-type-from-name "GtkObject")
=> 21

(gtk-button-new) ;; assure the button type is initialized
(gtk-type-from-name "GtkButton")
=> 40469

procedure: gtk-object-type object::gtk-object => gtk-type
Given an gtk-object or any ancestor of gtk-object, ruturn the object type identifier

Example: get the type of gtk-button instance.

 
(gtk-object-type(gtk-button-new)) => 40469

procedure: gtk-object-klass o::gtk-object => gtk-object-class

Get GTK+ object class reference by instance. The gtk-object-class structures may be useful for introspection purposes only (to inspect object signals etc.).

 
(gtk-object-klass(gtk-button-new))
=> #<foreign:GTK-OBJECT-CLASS:84b3078>

procedure: gtk-object-class-type o::gtk-object-class => gtk-type

Get type identifier by GTK+ object class. o
 
(gtk-object-class-type(gtk-object-klass(gtk-button-new)))
=> 40469

procedure: gtk-type-query type::gtk-type => name::string object-size::uint class-size::uint
type

The procedure gtk-type-query queries information about the name and sizes of GTK class object. It returns three values:

For example, to query parameters of the gtk-box class, do:
 
(multiple-value-bind
  (name object-size class-size)
  (gtk-type-query (gtk-vbox-get-type))
  (print "name: "name " object-size: " object-size " class-size: " class-size))
-| name: GtkVBox object-size: 68 class-size: 336

This procedure is used internally in gtk-class-new procedure.

procedure: gtk-class-new parent-type::gtk-type name::string => gtk-type

The procedure gtk-class-new registers a new subclass of the existing gtk object class parent-type, with the named name. Using this procedure, new widget types may be implemented entirely in Bigloo Scheme.

For example, to derive a new widget from gtk-vbox, named MyVBox do:

 
(define my-vbox-class (gtk-class-new (gtk-vbox-get-type) "MyVBox")))
(define my-vbox(gtk-object-new my-vbox-class))
=>
For more detailed example see the tictactoe.scm example.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2.2 Basic Concepts


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2.3 Simple Types


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2.4 Enumerations and Flags


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2.5 Callbacks

Any Bigloo procedure with matching prototype may be used as signal or event handler in Bigloo.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.2.6 Composite Types


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.3 Objects

procedure: gtk-object-destroyed object::gtk-object => bool
Was an object destroyed with gtk-object-destroy?
 
(define button(gtk-button-new))
(gtk-object-destroyed button)
=> #f
(gtk-object-destroy button)
(gtk-object-destroyed button)
=> #t

procedure: gtk-object-destroy object::gtk-object
Ask the object's class to destroy the object.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.4 Signals Overview

procedure: gtk-signal-emit-stop object::gtk-object signal

Stop the emission of the signal on object. signal is the string signal name or the integer identifier for the signal, which can be determined using the function gtk-signal-lookup. Attempting to stop the emission of a signal that isn't being emitted does nothing.

procedure: gtk-signal-disconnect object::gtk-object id::int

Disconnects a signal handler from an object. The signal handler is identified by the integer id which is returned by the gtk-signal-connect function.

Example: disable the button action after the first invocation.

 
(letrec((but(gtk-button-new "Hello"))
	(signal-id
	 (gtk-signal-connect
	  but "clicked"
	  (lambda args
	    (print "Hello, World")
	    (gtk-signal-disconnect but signal-id)))))
  ...)

procedure: gtk-signal-emit object::gtk-object signal . arguments

Emit the signal specified by the integer or string identifier signal from object. The signal definition determines the parameters passed in the arguments list along with the type of return value.

For example, if the signal is defined as:

 
  void (* parent_set) (GtkWidget *widget, GtkWidget *parent);

Then a call to emit the "parent_set" signal would look like:

 
(let((button(gtk-button-new)))
  (gtk-signal-emit button  "parent_set" *window*))
=> #unspecified

Notice that the widget argument is implicit in that the first argument to every signal is a type derived from GtkObject.

Signals may return values. For example see the gtk-signal-new-generic section.

procedure: gtk-signal-connect object::gtk-object name::string function::procedure #!optional after::bool => uint

Connects a signal handling function to a signal emitting object. function is connected to the signal name emitted by object. The arguments and returns type of func should match the arguments and return type of the signal name.

gtk-signal-connect returns an integer identifier for the connection which can be used to refer to it in the future. Specifically it is useful for removing the connection and/or blocking it from being used.

Example: connect a click handler to a button. Being invoked, handler prints a message and disconnects itself.

 
(letrec((but(gtk-button-new "Hello"))
	(signal-id
	 (gtk-signal-connect
	  but "clicked"
	  (lambda(button)
	    (print "Hello, World")
	    (gtk-signal-disconnect button signal-id)))))
  ...)

procedure: gtk-signal-query-params query::gtk-signal-query => pair-nil

Signal introspection.

procedure: gtk-signal-new-generic name::string run-type::gtk-signal-run-type object-type::gtk-type return-type::gtk-type . params => uint

Create a new signal and give it the character string identifier name. name needs to be unique in the context of object-type's branch of the class hierarchy. That is, object-type cannot create a signal type with the same name as a signal type created by one of its parent types.

run-type specifies whether the class function should be run before ('first), after ('last) or both before and after normal signal handlers ('both). Additionally, the 'no-recurse value can be specified to specify that the signal should not be recursive. By default, emitting the same signal on the same widget will cause the signal to be emitted twice. However, if the 'no-recurse flag is specified, emitting the same signal on the same widget will cause the current signal emission to be restarted. This allows the widget programmer to specify the semantics of signal emission on a per signal basis. (The 'no-recurse flag is used by the gtk-adjustment widget).

The return-val and the remaining arguments specify the return value and the arguments to the signal handler respectively.

Note: There is an implicit first argument to every signal handler which is the widget the signal has been emitted from.

The variable argument list params specifies the types of the arguments (use gtk-type-from-name to get gtk type identifiers). It is OK to use (gtk-type-from-name "none") for return-val. (This corresponds to not returning a value).

 
(define button(gtk-button-new))
button
=> #<foreign:gtk-button:84c7150>
(define guint-type(gtk-type-from-name "guint"))
guint-type => 6
(define button-type(gtk-type-from-name "GtkButton"))
button-type => 40469
(gtk-signal-new-generic "sum2"
			'(both)
			button-type ;; signal object type
			guint-type  ;; signal return type
			guint-type  ;; signal 1st arg type
			guint-type  ;; signal 2st arg type
			)
=> 82
(gtk-signal-connect button
                    "sum2"
                    (lambda (button n1 n2) (+ n1 n2))))
=> 4
(gtk-signal-emit button "print-sum" 2 3)
=> 5

procedure: gtk-signal-query-object-type o::gtk-signal-query => gtk-type

Access the object-type of gtk-signal-query structure. See gtk-signal-query procedure description for more detail.

 
(gtk-signal-query-object-type
 (gtk-signal-query
  (gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> 21

procedure: gtk-signal-query-signal-id o::gtk-signal-query => uint

Access the signal-id of gtk-signal-query structure. See gtk-signal-query procedure description for more detail.

 
(gtk-signal-query-signal-id
 (gtk-signal-query
  (gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> 1

procedure: gtk-signal-query-signal-name o::gtk-signal-query => string

Access the signal-name of gtk-signal-query structure. See gtk-signal-query procedure description for more detail.

 
(gtk-signal-query-signal-name
 (gtk-signal-query
  (gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> "destroy"

procedure: gtk-signal-query-is-user-signal o::gtk-signal-query => bool

Access the is-user-signal of gtk-signal-query structure. See gtk-signal-query procedure description for more detail.

 
(gtk-signal-query-is-user-signal
 (gtk-signal-query
  (gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> #f

procedure: gtk-signal-query-signal-flags o::gtk-signal-query => gtk-signal-run-type

Access the signal-flags of gtk-signal-query structure. See gtk-signal-query procedure description for more detail.

 
(gtk-signal-query-signal-flags
 (gtk-signal-query
  (gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))))
=> '(no-hooks both last)

procedure: gtk-signal-query-return-val o::gtk-signal-query => gtk-type

Access the return-val of gtk-signal-query structure. See gtk-signal-query procedure description for more detail.

 
(gtk-type-name
 (gtk-signal-query-return-val
  (gtk-signal-query
   (gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject")))))
=> "void"

procedure: gtk-signal-lookup name::string type::gtk-type => uint

Returns the integer identifier for the signal referenced by name and type. If type does not define the signal name, then the signal is looked for in type's parent type recursively.

 
(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject"))
=> 1

procedure: gtk-signal-name signal-id::uint => string

Lookup a signal by signal identifier signal-id, return signal name. This procedure is complementary to the gtk-signal-lookup procedure.

 
(gtk-signal-name(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject")))
=> "destroy"

procedure: gtk-signal-query signal-id::uint => gtk-signal-query

Query signal information.

 
(let*((signal-id(gtk-signal-lookup "destroy"(gtk-type-from-name "GtkObject")))
      (signal(gtk-signal-query signal-id)))
  (print "type: " (gtk-signal-query-object-type signal))
  (print "signal-id: " (gtk-signal-query-signal-id signal))
  (print "signal-name: " (gtk-signal-query-signal-name signal))
  (print "is-user-signal: " (gtk-signal-query-is-user-signal signal))
  (print "signal-flags: " (gtk-signal-query-signal-flags signal))
  (print "return-val: " (gtk-signal-query-return-val signal)))
-|type: 21
-|signal-id: 1
-|signal-name: destroy
-|is-user-signal: #f
-|signal-flags: (NO-HOOKS BOTH LAST)
-|return-val: 1
-|1


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5 Widget Overview


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.1 The accel group object

procedure: gtk-accel-group-remove accel_group::gtk-accel-group accel_key::uint accel_mods::gdk-modifier-type object::gtk-object => #unspecified
accel_group accel_key accel_mods object
 
=>

procedure: gtk-accel-group-add accel_group::gtk-accel-group accel_key::uint accel_mods::gdk-modifier-type accel_flags::gtk-accel-flags object::gtk-object accel_signal::string => #unspecified
accel_group accel_key accel_mods accel_flags object accel_signal
 
=>

procedure: gtk-accel-group-unlock accel_group::gtk-accel-group => #unspecified
accel_group
 
=>

procedure: gtk-accel-group-lock accel_group::gtk-accel-group => #unspecified
accel_group
 
=>

procedure: gtk-accel-group-detach accel_group::gtk-accel-group object::gtk-object => #unspecified
accel_group object
 
=>

procedure: gtk-accel-group-attach accel_group::gtk-accel-group object::gtk-object => #unspecified
accel_group object
 
=>

procedure: gtk-accel-group-new => gtk-accel-group
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.2 The accel label widget

procedure: gtk-accel-label-set-accel-widget accel_label::gtk-accel-label accel_widget::gtk-widget => #unspecified
accel_label accel_widget
 
=>

procedure: gtk-accel-label-new label::string => gtk-widget
label
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.3 The alignment widget

procedure: gtk-alignment-set alignment::gtk-alignment xalign::float yalign::float xscale::float yscale::float => #unspecified
alignment xalign yalign xscale yscale
 
=>

procedure: gtk-alignment-new xalign::float yalign::float xscale::float yscale::float => gtk-widget
xalign yalign xscale yscale
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.4 The arg object

procedure: gtk-arg-type o::gtk-arg => gtk-type
o
 
=>

procedure: gtk-arg-name o::gtk-arg => string
o
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.5 The arrow widget

procedure: gtk-arrow-set arrow::gtk-arrow arrow_type::gtk-arrow-type shadow_type::gtk-shadow-type => #unspecified
arrow arrow_type shadow_type
 
=>

procedure: gtk-arrow-new arrow_type::gtk-arrow-type shadow_type::gtk-shadow-type => gtk-widget
arrow_type shadow_type
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.6 The aspect frame widget

procedure: gtk-aspect-frame-set aspect_frame::gtk-aspect-frame xalign::float yalign::float ratio::float obey_child::bool => #unspecified
aspect_frame xalign yalign ratio obey_child
 
=>

procedure: gtk-aspect-frame-new label::string xalign::float yalign::float ratio::float obey_child::bool => gtk-widget
label xalign yalign ratio obey_child
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.7 The bin widget


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.8 The box widget

procedure: gtk-box-set-child-packing box::gtk-box child::gtk-widget expand::bool fill::bool padding::int pack_type::gtk-pack-type => #unspecified
box child expand fill padding pack_type
 
=>

procedure: gtk-box-reorder-child box::gtk-box child::gtk-widget pos::uint => #unspecified
box child pos
 
=>

procedure: gtk-box-set-spacing box::gtk-box spacing::int => #unspecified
box spacing
 
=>

procedure: gtk-box-set-homogeneous box::gtk-box homogenous::bool => #unspecified
box homogenous
 
=>

procedure: gtk-box-pack-end-defaults box::gtk-box child::gtk-widget => #unspecified
box child
 
=>

procedure: gtk-box-pack-start-defaults box::gtk-box child::gtk-widget => #unspecified
box child
 
=>

procedure: gtk-box-pack-end box::gtk-box child::gtk-widget #!optional expand fill padding => #unspecified
box child expand fill padding
 
=>

procedure: gtk-box-pack-start box::gtk-box child::gtk-widget #!optional expand fill padding => #unspecified
box child expand fill padding
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.9 The handle box widget

procedure: gtk-handle-box-new => gtk-widget
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.10 The button box widget

procedure: gtk-button-box-set-child-ipadding widget::gtk-button-box ipad_x::int ipad_y::int => #unspecified
widget ipad_x ipad_y
 
=>

procedure: gtk-button-box-set-child-size widget::gtk-button-box min_width::int min_height::int => #unspecified
widget min_width min_height
 
=>

procedure: gtk-button-box-set-layout widget::gtk-button-box layout_style::gtk-button-box-style => #unspecified
widget layout_style
 
=>

procedure: gtk-button-box-set-spacing widget::gtk-button-box spacing::int => #unspecified
widget spacing
 
=>

procedure: gtk-button-box-get-layout widget::gtk-button-box => gtk-button-box-style
widget
 
=>

procedure: gtk-button-box-get-spacing widget::gtk-button-box => int
widget
 
=>

procedure: gtk-button-box-set-child-ipadding-default ipad_x::int ipad_y::int => #unspecified
ipad_x ipad_y
 
=>

procedure: gtk-button-box-set-child-size-default min_width::int min_height::int => #unspecified
min_width min_height
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.11 The button widget

procedure: gtk-button-leave button::gtk-button => #unspecified
button
 
=>

procedure: gtk-button-enter button::gtk-button => #unspecified
button
 
=>

procedure: gtk-button-clicked button::gtk-button => #unspecified
button
 
=>

procedure: gtk-button-released button::gtk-button => #unspecified
button
 
=>

procedure: gtk-button-pressed button::gtk-button => #unspecified
button
 
=>

procedure: gtk-button-new label::string => gtk-widget
label
 
=>

procedure: gtk-button-child o::gtk-button => gtk-widget
o
 
=>

procedure: gtk-button-in-button o::gtk-button => bool
o
 
=>

procedure: gtk-button-button-down o::gtk-button => bool
o
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.12 The calendar widget

procedure: gtk-calendar-thaw calendar::gtk-calendar => #unspecified
calendar
 
=>

procedure: gtk-calendar-freeze calendar::gtk-calendar => #unspecified
calendar
 
=>

procedure: gtk-calendar-clear-marks calendar::gtk-calendar => #unspecified
calendar
 
=>

procedure: gtk-calendar-unmark-day calendar::gtk-calendar day::int => int
calendar day
 
=>

procedure: gtk-calendar-mark-day calendar::gtk-calendar day::int => int
calendar day
 
=>

procedure: gtk-calendar-select-day calendar::gtk-calendar day::int => #unspecified
calendar day
 
=>

procedure: gtk-calendar-select-month calendar::gtk-calendar month::int year::int => int
calendar month year
 
=>

procedure: gtk-calendar-new => gtk-widget
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.13 The check button widget

procedure: gtk-check-button-new label::string => gtk-widget
label
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.14 The curve widget

procedure: gtk-curve-set-curve-type curve::gtk-curve type::gtk-curve-type => #unspecified
curve type
 
=>

procedure: gtk-curve-set-range curve::gtk-curve min_x::float max_x::float min_y::float max_y::float => #unspecified
curve min_x max_x min_y max_y
 
=>

procedure: gtk-curve-set-gamma curve::gtk-curve gamma::float => #unspecified
curve gamma
 
=>

procedure: gtk-curve-reset curve::gtk-curve => #unspecified
curve
 
=>

procedure: gtk-curve-new => gtk-widget
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.15 The spin button widget

procedure: gtk-spin-button-set-update-policy spin_button::gtk-spin-button policy::gtk-spin-button-update-policy => #unspecified
spin_button policy
 
=>

procedure: gtk-spin-button-set-value spin_button::gtk-spin-button value::float => #unspecified
spin_button value
 
=>

procedure: gtk-spin-button-get-value-as-int spin_button::gtk-spin-button => int
spin_button
 
=>

procedure: gtk-spin-button-get-value-as-float spin_button::gtk-spin-button => float
spin_button
 
=>

procedure: gtk-spin-button-set-digits spin_button::gtk-spin-button digits::int => #unspecified
spin_button digits
 
=>

procedure: gtk-spin-button-get-adjustment spin_button::gtk-spin-button => gtk-adjustment
spin_button
 
=>

procedure: gtk-spin-button-set-adjustment spin_button::gtk-spin-button adjustment::gtk-adjustment => #unspecified
spin_button adjustment
 
=>

procedure: gtk-spin-button-new adjustment::gtk-adjustment climb_rate::float digits::int => gtk-widget
adjustment climb_rate digits
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.16 The check menu item widget

procedure: gtk-check-menu-item-toggled check_menu_item::gtk-check-menu-item => #unspecified
check_menu_item
 
=>

procedure: gtk-check-menu-item-set-show-toggle menu_item::gtk-check-menu-item always::bool => #unspecified
menu_item always
 
=>

procedure: gtk-check-menu-item-set-state check_menu_item::gtk-check-menu-item state::bool => #unspecified
check_menu_item state
 
=>

procedure: gtk-check-menu-item-new label::string => gtk-widget
label
 
=>

procedure: gtk-check-menu-item-set-active check_menu_item::gtk-check-menu-item is_active::bool => #unspecified
check_menu_item is_active
 
=>

procedure: gtk-check-menu-item-active o::gtk-check-menu-item => bool
o
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.17 The compound list widget

procedure: gtk-clist-for-each clist::gtk-clist handle::procedure => #unspecified

The gtk-clist-for-each calls the handle procedure for each row in clist with the contents of each row cell as argument. The type of each argument depends on the type of corresponding cell contents as follows:

empty   => #f
text    => bstring
pixmap  => (list pixmap::gtk-pixmap mask::gtk-bitmap)
pixtext =>
  (list text::bstring spacing::uint pixmap::gtk-pixmap mask::gtk-bitmap)
widget  => gtk-widget

The following example prints contents of two-column clist, all the cells of which are simple text:

 
(gtk-clist-for-each clist
  (lambda(column1 column2)(print column1 " " column2)))

procedure: gtk-clist-get-text clist::gtk-clist row::int column::int => bstring
row clist row number, 0-based column clist column number, 0-based

Returns the cell content string. Signals error if the cell is not of GtkCellText type or indices out of bounds.

 
=>

procedure: gtk-clist-set-auto-sort clist::gtk-clist auto_sort::bool => #unspecified
clist auto_sort
 
=>

procedure: gtk-clist-sort clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-set-sort-type clist::gtk-clist sort_type::gtk-sort-type => #unspecified
clist sort_type
 
=>

procedure: gtk-clist-set-sort-column clist::gtk-clist column::int => #unspecified
clist column
 
=>

procedure: gtk-clist-swap-rows clist::gtk-clist row1::int row2::int => #unspecified
clist row1 row2
 
=>

procedure: gtk-clist-unselect-all clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-clear clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-undo-selection clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-unselect-row clist::gtk-clist row::int column::int => #unspecified
clist row column
 
=>

procedure: gtk-clist-select-row clist::gtk-clist row::int column::int => #unspecified
clist row column
 
=>

procedure: gtk-clist-remove clist::gtk-clist row::int => #unspecified
clist row
 
=>

procedure: gtk-clist-get-selectable clist::gtk-clist row::int => bool
clist row
 
=>

procedure: gtk-clist-set-selectable clist::gtk-clist row::int selectable::bool => #unspecified
clist row selectable
 
=>

procedure: gtk-clist-set-shift clist::gtk-clist row::int column::int vertical::int horizontal::int => #unspecified
clist row column vertical horizontal
 
=>

procedure: gtk-clist-get-row-style clist::gtk-clist row::int => gtk-style
clist row
 
=>

procedure: gtk-clist-set-row-style clist::gtk-clist row::int style::gtk-style => #unspecified
clist row style
 
=>

procedure: gtk-clist-get-cell-style clist::gtk-clist row::int column::int => gtk-style
clist row column
 
=>

procedure: gtk-clist-set-cell-style clist::gtk-clist row::int column::int style::gtk-style => #unspecified
clist row column style
 
=>

procedure: gtk-clist-set-background clist::gtk-clist row::int color::gdk-color => #unspecified
clist row color
 
=>

procedure: gtk-clist-set-foreground clist::gtk-clist row::int color::gdk-color => #unspecified
clist row color
 
=>

procedure: gtk-clist-set-text clist::gtk-clist row::int column::int text::string => #unspecified
clist row column text
 
=>

procedure: gtk-clist-get-cell-type clist::gtk-clist row::int column::int => gtk-cell-type
clist row column
 
=>

procedure: gtk-clist-row-is-visible clist::gtk-clist row::int => gtk-visibility
clist row
 
=>

procedure: gtk-clist-moveto clist::gtk-clist row::int column::int row_align::float column_align::float => #unspecified
clist row column row_align column_align
 
=>

procedure: gtk-clist-set-row-height clist::gtk-clist height::int => #unspecified
clist height
 
=>

procedure: gtk-clist-set-column-max-width clist::gtk-clist column::int max_width::int => #unspecified
clist column max_width
 
=>

procedure: gtk-clist-set-column-min-width clist::gtk-clist column::int min_width::int => #unspecified
clist column min_width
 
=>

procedure: gtk-clist-set-column-width clist::gtk-clist column::int width::int => #unspecified
clist column width
 
=>

procedure: gtk-clist-optimal-column-width clist::gtk-clist column::int => int
clist column
 
=>

procedure: gtk-clist-columns-autosize clist::gtk-clist => int
clist
 
=>

procedure: gtk-clist-set-column-auto-resize clist::gtk-clist column::int auto_resize::bool => #unspecified
clist column auto_resize
 
=>

procedure: gtk-clist-set-column-resizeable clist::gtk-clist column::int resizeable::bool => #unspecified
clist column resizeable
 
=>

procedure: gtk-clist-set-column-visibility clist::gtk-clist column::int visible::bool => #unspecified
clist column visible
 
=>

procedure: gtk-clist-set-column-justification clist::gtk-clist column::int justification::gtk-justification => #unspecified
clist column justification
 
=>

procedure: gtk-clist-get-column-widget clist::gtk-clist column::int => gtk-widget
clist column
 
=>

procedure: gtk-clist-set-column-widget clist::gtk-clist column::int widget::gtk-widget => #unspecified
clist column widget
 
=>

procedure: gtk-clist-set-column-title clist::gtk-clist column::int title::string => #unspecified
clist column title
 
=>

procedure: gtk-clist-column-titles-passive clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-column-titles-active clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-column-title-passive clist::gtk-clist column::int => #unspecified
clist column
 
=>

procedure: gtk-clist-column-title-active clist::gtk-clist column::int => #unspecified
clist column
 
=>

procedure: gtk-clist-column-titles-hide clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-column-titles-show clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-thaw clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-freeze clist::gtk-clist => #unspecified
clist
 
=>

procedure: gtk-clist-set-button-actions list::gtk-clist button::uint button_actions::uint => #unspecified
list button button_actions
 
=>

procedure: gtk-clist-set-use-drag-icons list::gtk-clist use_icons::bool => #unspecified
list use_icons
 
=>

procedure: gtk-clist-set-reorderable clist::gtk-clist reorderable::bool => #unspecified
clist reorderable
 
=>

procedure: gtk-clist-set-selection-mode clist::gtk-clist mode::gtk-selection-mode => #unspecified
clist mode
 
=>

procedure: gtk-clist-get-vadjustment clist::gtk-clist => gtk-adjustment
clist
 
=>

procedure: gtk-clist-get-hadjustment clist::gtk-clist => gtk-adjustment
clist
 
=>

procedure: gtk-clist-set-vadjustment clist::gtk-clist adjustment::gtk-adjustment => #unspecified
clist adjustment
 
=>

procedure: gtk-clist-set-hadjustment clist::gtk-clist adjustment::gtk-adjustment => #unspecified
clist adjustment
 
=>

procedure: gtk-clist-new arg . titles => gtk-widget

Create gtk-clist type object with optional titles. There are two methods of calling this procedure.

Note: this procedure obsoletes guile-gtk gtk-clist-new-with-titles procedure.

Example1: create 3-column gtk-clist:
 
(gtk-clist-new 3)

Example1: create 2-column gtk-clist and set the column titles to "Column1" and "Column2":
 
(gtk-clist-new "Column1" "Column2")

procedure: gtk-clist-append clist::gtk-clist #!rest columns => #unspecified

Append a row to clist. The columns parameters should all be strings forming a new row. The length of columns should be equal to the number of columns in clist.

 
(gtk-clist-append(gtk-clist-new "Column1" "Column2") "Value1" "Value2")

procedure: gtk-clist-prepend clist::gtk-clist #!rest columns => #unspecified

Prepend a row to clist. The columns parameters should all be strings forming a new row. The length of columns should be equal to the number of columns in clist.

 
(gtk-clist-prepend(gtk-clist-new "Column1" "Column2") "Value1" "Value2")


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.18 The color selector widget

procedure: gtk-color-selection-set-opacity colorsel::gtk-color-selection use_opacity::bool => #unspecified
colorsel use_opacity
 
=>

procedure: gtk-color-selection-set-update-policy colorsel::gtk-color-selection policy::gtk-update-type => #unspecified
colorsel policy
 
=>

procedure: gtk-color-selection-new => gtk-widget
 
=>

procedure: gtk-color-selection-dialog-new title::string => gtk-widget
title
 
=>

procedure: gtk-color-selection-dialog-colorsel o::gtk-color-selection-dialog => gtk-widget
o
 
=>

procedure: gtk-color-selection-dialog-main-vbox o::gtk-color-selection-dialog => gtk-widget
o
 
=>

procedure: gtk-color-selection-dialog-ok-button o::gtk-color-selection-dialog => gtk-widget
o
 
=>

procedure: gtk-color-selection-dialog-reset-button o::gtk-color-selection-dialog => gtk-widget
o
 
=>

procedure: gtk-color-selection-dialog-cancel-button o::gtk-color-selection-dialog => gtk-widget
o
 
=>

procedure: gtk-color-selection-dialog-help-button o::gtk-color-selection-dialog => gtk-widget
o
 
=>

procedure: gtk-color-selection-get-color selection::gtk-color-selection => pair

Return current color selection as list of four double values (RGB+opacity).

 
(let* ((window(gtk-color-selection-dialog-new "color selection dialog"))
       (selection(gtk-color-selection-dialog-colorsel window)))
  (gtk-color-selection-get-color selection))
=> (1.0 1.0 1.0 1.527836969495e-312)


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.19 The combo widget

procedure: gtk-combo-disable-activate combo::gtk-combo => #unspecified
combo
 
=>

procedure: gtk-combo-set-item-string combo::gtk-combo item::gtk-item item_value::string => #unspecified
combo item item_value
 
=>

procedure: gtk-combo-set-case-sensitive combo::gtk-combo val::bool => #unspecified
combo val
 
=>

procedure: gtk-combo-set-use-arrows-always combo::gtk-combo val::bool => #unspecified
combo val
 
=>

procedure: gtk-combo-set-use-arrows combo::gtk-combo val::bool => #unspecified
combo val
 
=>

procedure: gtk-combo-set-value-in-list combo::gtk-combo val::bool ok_if_empty::bool => #unspecified
combo val ok_if_empty
 
=>

procedure: gtk-combo-new => gtk-widget
 
=>

procedure: gtk-combo-entry o::gtk-combo => gtk-widget
o
 
=>

procedure: gtk-combo-button o::gtk-combo => gtk-widget
o
 
=>

procedure: gtk-combo-popup o::gtk-combo => gtk-widget
o
 
=>

procedure: gtk-combo-popwin o::gtk-combo => gtk-widget
o
 
=>

procedure: gtk-combo-list o::gtk-combo => gtk-widget
o
 
=>

procedure: gtk-combo-set-popdown-strings combo::gtk-combo strings::pair-nil => #unspecified
combo strings
 
=>


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

8.2.5.20 The container widget

procedure: gtk-container-unregister-toplevel container::gtk-container => #unspecified
container
 
=>

procedure: gtk-container-register-toplevel container::gtk-container => #unspecified
container
 
=>

procedure: gtk-container-focus container::gtk-container direction::gtk-direction-type => gtk-direction-type
container direction
 
=>

procedure: gtk-container-remove container::gtk-container widget::gtk-widget => #unspecified
container widget
 
=>

procedure: gtk-container-add container::gtk-container widget::gtk-widget => #unspecified
container widget
 
=>

procedure: gtk-container-border-width container::gtk-container border_width::int => #unspecified
container border_width
 
=>

procedure: gtk-container-set-focus-hadjustment container::gtk-container adjustm