(scroller2 (gtk-scrolled-window-new))
(layout1 (make-demo-layout 200 200))
(layout2 (make-demo-layout 200 200))
- (resizer (make-fix-resizer layout1 -1 10)))
+ (resizer (make-fix-resizer -1 10)))
(gtk-window-set-opacity window 0.90)
(gtk-window-set-title window "fix-layout-demo")
(gtk-window-set-geometry-hints window window 'min-width 10 'min-height 10)
(gtk-container-set-border-width window 10)
(gtk-container-add scroller1 layout1)
(gtk-box-pack-start vbox scroller1 #t #t 0)
+ (set-fix-resizer-resizee! resizer layout1)
(gtk-box-pack-start vbox resizer #f #f 0)
(gtk-container-add scroller2 layout2)
(gtk-box-pack-start vbox scroller2 #t #t 0)
;;; This is a simple <fix-widget> that handles expose events by
;;; calling gtk_paint_handle().
-(define-class (<fix-resizer> (constructor (resizee) (width height)))
+(define-class (<fix-resizer> (constructor () (width height)))
(<fix-widget>)
;; Inferred from aspect ratio (for now?).
(stack-vertical? define standard)
;; The widget that is above or left of this widget.
- (resizee define accessor)
+ (resizee define standard initial-value #f)
;; While a gtk_grab_add is in effect, this is the starting position
;; of the pointer (in parent coords!) and the starting size of the
(define (resizer-press-handler resizer type button modifiers x y)
;;; (declare (ignore type)) ;; 'press
(%trace ";resizer-press-handler "type" "button" "modifiers" "x","y"\n")
- (if (eq? button 1)
- (let* ((geom (fix-widget-geometry resizer))
- (x-parent (fix:+ x (fix-rect-x geom)))
- (y-parent (fix:+ y (fix-rect-y geom)))
- (width.height (gtk-widget-get-size resizee)))
- (%trace "; drag start"
- " at "x-parent","y-parent
- " with "(car width.height)"x"(cdr width.height)"!\n")
- (set-fix-resizer-drag-start! resizer (cons (cons x-parent y-parent)
- width.height))
- (C-call "gtk_grab_add" (gobject-alien resizer)))))
+ (let ((resizee (fix-resizer-resizee resizer)))
+ (if (and resizee (eq? button 1))
+ (let* ((geom (fix-widget-geometry resizer))
+ (x-parent (fix:+ x (fix-rect-x geom)))
+ (y-parent (fix:+ y (fix-rect-y geom)))
+ (width.height (gtk-widget-get-size resizee)))
+ (%trace "; drag start"
+ " at "x-parent","y-parent
+ " with "(car width.height)"x"(cdr width.height)"!\n")
+ (set-fix-resizer-drag-start! resizer (cons (cons x-parent y-parent)
+ width.height))
+ (C-call "gtk_grab_add" (gobject-alien resizer))))))
(define (resizer-release-handler resizer type button modifiers x y)
;;; (declare (ignore type)) ;; 'release