guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GLib GObject & Javadot Notation for scheme?


From: Andreas Rottmann
Subject: Re: GLib GObject & Javadot Notation for scheme?
Date: Mon, 26 Apr 2004 20:36:03 +0200
User-agent: Gnus/5.1002 (Gnus v5.10.2) Emacs/21.3 (gnu/linux)

address@hidden (Linas Vepstas) writes:

> Hi,
>
> I was reading about  JScheme and in particular 'javadot notation':
>
>   http://jscheme.sourceforge.net/jscheme/doc/javadot.html
>
> and I was wondering if anybody had done anything similar for 
> GLib GObjects for guile?  The idea seems pretty slick ...
>
There is something even better: guile-gobject[0]. Just as an
appetizer:

(use-modules (gnome gtk))

(define (app)
  (let* ((window (make <gtk-window> #:type 'toplevel))
         (button (make <gtk-button> #:label "Hello, World!")))

    ;; since window is a container, this generic maps onto the function
    ;; gtk-container-set-border-width
    (set-border-width window 10)

    ;; note that we can set the border width with a gobject property as
    ;; well:
    (gobject-set-property window 'border-width 15)

    ;; (gnome gobject generics), re-exported by (gnome gtk), defines a
    ;; generic `set' method for gobject-set-property, se we can also do
    ;; it like this:
    (set window 'border-width 20)

    ;; this is much less typing :-)
    (add window button)
    
    ;; see (gnome gobject generics) for a full list of gobject generic
    ;; functions
    (connect button 'clicked (lambda (b) (gtk-main-quit)))

    ;; generic functions for .defs apis are defined in the .defs files,
    ;; not manually
    (show-all window)

    (gtk-main)))

(app)

Cheers, Andy
-- 
Andreas Rottmann         | address@hidden      | address@hidden | address@hidden
http://yi.org/rotty      | GnuPG Key: http://yi.org/rotty/gpg.asc
Fingerprint              | DFB4 4EB4 78A4 5EEE 6219  F228 F92F CFC5 01FD 5B62

The best way to accelerate a Windows machine is at 9.81 m/s^2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]