1
#| nokogiri-widget-test.jl -- test harness for widgets
3
$Id: widget-test.jl,v 1.6 2000/09/11 07:44:42 john Exp $
5
Copyright (C) 2000 John Harper <john@dcs.warwick.ac.uk>
7
This file is part of sawfish.
9
sawfish is free software; you can redistribute it and/or modify it
10
under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2, or (at your option)
14
sawfish is distributed in the hope that it will be useful, but
15
WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
GNU General Public License for more details.
19
You should have received a copy of the GNU General Public License
20
along with sawfish; see the file COPYING. If not, write to
21
the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24
(define-structure sawfish.gtk.widget-test
33
(define (test-widget spec #!optional initial-value)
35
(setq widget (make-widget spec (lambda ()
37
(format standard-output
39
(widget-ref widget))))))
41
(or (widget-valid-p widget initial-value)
42
(error "Value is not suitable for widget: %s" initial-value))
43
(widget-set widget initial-value))
44
(let ((window (gtk-window-new 'toplevel)))
45
(gtk-container-add window (widget-gtk-widget widget))
46
(gtk-signal-connect window "delete_event"
47
(lambda () (throw 'done t)))
48
(gtk-widget-show-all window)
52
(gtk-widget-destroy window)