#lang racket
(require racket/gui racket/class)
(provide flower-dialog%)
(define flower-dialog%
{class
dialog%
(init garden)
(define my-garden garden)
(super-new [label "Flowers"]
[parent (send my-garden get-table)]
[stretchable-width #f]
[stretchable-height #f])
(define flowers
(list
"Pale Green" "Lavender"
"FloralWhite"
"MistyRose"
"Cornflower Blue"
"Orchid"
"Violet Red"
))
(define flower-chooser
(new radio-box%
[label #f]
[parent (new group-box-panel%
[parent this]
[label "You can pick a flower!"]
[stretchable-width #f]
[stretchable-height #f])]
[choices flowers]))
(define bottom-panel
(new horizontal-panel%
[parent this]
[alignment '(center center)]
[stretchable-height #f]))
(new button%
[parent bottom-panel]
[label "&Ok"]
[style '(border)]
[callback {lambda (b e)
(send this show #f)
(send my-garden flower-picked
(vector-ref (list->vector flowers)
(send flower-chooser get-selection)))
} ])
(define/public (flower-present)
(send this center)
(send this show #t))
})