;;;;
;;;; scroll1.stk    -- GTklos Scroll Widget Demo
;;;;
;;;; Copyright © 2002-2021 Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
;;;;
;;;;
;;;; This program is free software; you can redistribute it and/or modify
;;;; it under the terms of the GNU General Public License as published by
;;;; the Free Software Foundation; either version 2 of the License, or
;;;; (at your option) any later version.
;;;;
;;;; This program is distributed in the hope that it will be useful,
;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;;; GNU General Public License for more details.
;;;;
;;;; You should have received a copy of the GNU General Public License
;;;; along with this program; if not, write to the Free Software
;;;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
;;;; USA.
;;;;
;;;;           Author: Erick Gallesio [eg@unice.fr]
;;;;    Creation date: 11-Feb-2002 16:05 (eg)
;;;;

(include "demos-utils.stk")

(define demo-msg "
Scroll Demo

This is a demo showing a scrollable window containing
a bunch of buttons.
Try to resize the window to see the scrollbars disappear
")


(define (main args)
  (let* ((win    (make <demo-window> #:title "Scroll Demo"
                       #:file "scroll1" #:border-width 5 #:message demo-msg
                       #:width 500 #:height 400
                       #:expand #t #:fill #t))
         (scroll (make <scroll> #:parent win 
                       #:hpolicy 'automatic
                       #:vpolicy 'automatic))
         (grid   (make <grid> #:parent scroll #:row-spacing 10 #:column-spacing 10)))
    
    ;; Build a set of  buttons in the grid contained in <scroll>
    (dotimes (i 100)
      (make <button>
            #:text (format "Button #~A" i)
            #:parent (list grid #:top (quotient i 5) #:left (modulo i 5))
            #:command (lambda _ (eprintf "You have clicked on button #~A\n" i))))
    (gtk-main)))
